CreateCompressor function

Generates a new COMPRESSOR_HANDLE.

Syntax


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

Parameters

Algorithm [in]

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.

ValueMeaning
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 [in, optional]

Optional memory allocation and deallocation routines in a COMPRESS_ALLOCATION_ROUTINES structure.

CompressorHandle [out]

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.

Windows Phone 8.1: This API is supported.

Requirements

Header

Compressapi.h on Windows 8 and Windows Server 2012

Library

Cabinet.lib

See also

Compression API Functions
COMPRESS_ALLOCATION_ROUTINES

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.