Compartilhar via


FSCTL_SET_COMPRESSION (Windows CE 5.0)

Send Feedback

This IOCTL sets the compression state of a file or directory on a volume whose file system supports per-file and per-directory compression. You can use this IOCTL to compress or uncompress a file or directory on such a volume.

Parameters

  • hDevice
    [in] Handle to the file, alternate stream, or directory to be compressed or decompressed. To retrieve a device handle, call the CreateFile function.
  • dwIoControlCode
    [in] Set to FSCTL_SET_COMPRESSION.
  • lpInBuf
    [in] Pointer to a buffer containing a USHORT value that specifies a new compression state for the file or directory. The following table shows the possible values for lpInBuf.
    Value Description
    COMPRESSION_FORMAT_NONE Uncompress the file or directory.
    COMPRESSION_FORMAT_DEFAULT Compress the file or directory, using the default compression format.
    COMPRESSION_FORMAT_LZNT1 Compress the file or directory, using the LZNT1 compression format.
  • nInBufSize
    [in] Size of the input buffer, in bytes. The buffer must be large enough to contain one USHORT value.
  • lpOutBuf
    Not used. Set to NULL.
  • nOutBufSize
    Not used. Set to NULL.
  • lpBytesReturned
    [out] Pointer to a variable that receives the size of the data stored in the output buffer, in bytes.
  • lpOverlapped
    Not used.

Return Values

If the operation succeeds, DeviceIoControl returns a nonzero value.

If the operation fails, DeviceIoControl returns zero. For extended error information, call GetLastError.

Remarks

LZNT1 is the only compression algorithm implemented. As a result, LZNT1 is used as the DEFAULT compression method.

If the file system of the volume containing the specified file or directory does not support per-file or per-directory compression, the operation fails.

The compression state change of the file or directory occurs synchronously with the call to DeviceIoControl.

You can retrieve the compression attribute of a file or directory by calling the GetFileAttributes function. The compression attribute indicates whether a file or directory is compressed. The compression state indicates whether a file or directory is compressed, and if it is, the format of the compressed data.

Directories are not actually compressed by this IOCTL. Rather, this IOCTL sets the default state for file created in the directory to be compressed.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Fsioctl.h

See Also

FSD IOCTLs | CreateFile | DeviceIoControl | GetLastError | GetFileAttributes

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.