CreateCompressor function (compressapi.h)

Generates a new COMPRESSOR_HANDLE.

Syntax

BOOL CreateCompressor(
  [in]           DWORD                         Algorithm,
  [in, optional] PCOMPRESS_ALLOCATION_ROUTINES AllocationRoutines,
  [out]          PCOMPRESSOR_HANDLE            CompressorHandle
);

Parameters

[in] Algorithm

The type of compression algorithm and mode to be used by this compressor.

This parameter can have one of the following values optionally combined with the COMPRESS_RAW flag. Use a "bitwise OR" operator to include COMPRESS_RAW and to create a block mode compressor. If COMPRESS_RAW is not included, the Compression API creates a buffer mode compressor. For more information about selecting a compression algorithm and mode, see Using the Compression API.

Value Meaning
COMPRESS_ALGORITHM_MSZIP
2
MSZIP compression algorithm
COMPRESS_ALGORITHM_XPRESS
3
XPRESS compression algorithm
COMPRESS_ALGORITHM_XPRESS_HUFF
4
XPRESS compression algorithm with Huffman encoding
COMPRESS_ALGORITHM_LZMS
5
LZMS compression algorithm

[in, optional] AllocationRoutines

Optional memory allocation and deallocation routines in a COMPRESS_ALLOCATION_ROUTINES structure.

[out] CompressorHandle

If the function succeeds, the handle to the specified compressor.

Return value

If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the compression algorithm fails for some internal reason, the error from GetLastError can be ERROR_FUNCTION_FAILED. If the system can find no compression algorithm matching the specified name and version, the error can be ERROR_NOT_SUPPORTED.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header compressapi.h
Library Cabinet.lib
DLL Cabinet.dll

See also

COMPRESS_ALLOCATION_ROUTINES

Compression API Functions