Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This I/O control 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 I/O control to compress or decompress 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 CreateFilefunction.

dwIoControlCode

[in] Set to FSCTL_SET_COMPRESSION.

lpInBuf

[in] Pointer to a buffer containing a USHORTvalue that specifies a new compression state for the file or directory. The following table shows possible values.

Value Description

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.

COMPRESSION_FORMAT_NONE

Decompress the file or directory.

nInBufSize

[in] Size of the input buffer, in bytes. The buffer must be large enough to contain one USHORTvalue.

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, the DeviceIoControlfunction returns a nonzero value. If the operation fails, DeviceIoControlreturns zero. For extended error information, call GetLastError.

Remarks

LZNT1 is the only compression algorithm implemented.

If the file system of the volume that contains 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 calls to DeviceIoControl.

You can obtain the compression attribute of a file or directory with the GetFileAttributesfunction. 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 compressed by this I/O control. Rather, this I/O control sets the default compression state for new files created in the directory.

Requirements

Header fsioctl.h
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also