CreateCompressor function

Generates a new COMPRESSOR_HANDLE.

Syntax

BOOL CreateCompressor(
  DWORD                         Algorithm,
  PCOMPRESS_ALLOCATION_ROUTINES AllocationRoutines,
  PCOMPRESSOR_HANDLE            CompressorHandle
);

Parameters

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

AllocationRoutines

Optional memory allocation and deallocation routines in a COMPRESS_ALLOCATION_ROUTINES structure.

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

   
Target Platform Windows
Header compressapi.h
Library Cabinet.lib
DLL Cabinet.dll

See Also

COMPRESS_ALLOCATION_ROUTINES

Compression API Functions