1 /**
2  * This file is part of the mingw-w64 runtime package.
3  * No warranty is given; refer to the file DISCLAIMER within this package.
4  */
5 
6 #ifndef _COMPRESSAPI_
7 #define _COMPRESSAPI_
8 
9 #include <windef.h>
10 
11 #if NTDDI_VERSION >= 0x06020000
12 
13 #define COMPRESS_ALGORITHM_INVALID 0
14 #define COMPRESS_ALGORITHM_NULL 1
15 #define COMPRESS_ALGORITHM_MSZIP 2
16 #define COMPRESS_ALGORITHM_XPRESS 3
17 #define COMPRESS_ALGORITHM_XPRESS_HUFF 4
18 #define COMPRESS_ALGORITHM_LZMS 5
19 #define COMPRESS_ALGORITHM_MAX 6
20 
21 #define COMPRESS_RAW (1 << 29)
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27   typedef enum {
28     COMPRESS_INFORMATION_CLASS_INVALID = 0,
29     COMPRESS_INFORMATION_CLASS_BLOCK_SIZE,
30     COMPRESS_INFORMATION_CLASS_LEVEL
31   } COMPRESS_INFORMATION_CLASS;
32 
33   DECLARE_HANDLE (COMPRESSOR_HANDLE);
34 
35   typedef COMPRESSOR_HANDLE *PCOMPRESSOR_HANDLE;
36   typedef COMPRESSOR_HANDLE DECOMPRESSOR_HANDLE;
37   typedef COMPRESSOR_HANDLE *PDECOMPRESSOR_HANDLE;
38   typedef PVOID (__cdecl *PFN_COMPRESS_ALLOCATE) (PVOID UserContext, SIZE_T Size);
39   typedef VOID (__cdecl *PFN_COMPRESS_FREE) (PVOID UserContext, PVOID Memory);
40 
41   typedef struct _COMPRESS_ALLOCATION_ROUTINES {
42     PFN_COMPRESS_ALLOCATE Allocate;
43     PFN_COMPRESS_FREE Free;
44     PVOID UserContext;
45   } COMPRESS_ALLOCATION_ROUTINES,*PCOMPRESS_ALLOCATION_ROUTINES;
46 
47   WINBOOL WINAPI CloseCompressor (COMPRESSOR_HANDLE CompressorHandle);
48   WINBOOL WINAPI CloseDecompressor (DECOMPRESSOR_HANDLE DecompressorHandle);
49   WINBOOL WINAPI Compress (COMPRESSOR_HANDLE CompressorHandle, PVOID UncompressedData, SIZE_T UncompressedDataSize, PVOID CompressedBuffer, SIZE_T CompressedBufferSize, PSIZE_T CompressedDataSize);
50   WINBOOL WINAPI CreateCompressor (DWORD Algorithm, PCOMPRESS_ALLOCATION_ROUTINES AllocationRoutines, PCOMPRESSOR_HANDLE CompressorHandle);
51   WINBOOL WINAPI CreateDecompressor (DWORD Algorithm, PCOMPRESS_ALLOCATION_ROUTINES AllocationRoutines, PDECOMPRESSOR_HANDLE DecompressorHandle);
52   WINBOOL WINAPI Decompress (DECOMPRESSOR_HANDLE DecompressorHandle, PVOID CompressedData, SIZE_T CompressedDataSize, PVOID UncompressedBuffer, SIZE_T UncompressedBufferSize, PSIZE_T UncompressedDataSize);
53   WINBOOL WINAPI QueryCompressorInformation (COMPRESSOR_HANDLE CompressorHandle, COMPRESS_INFORMATION_CLASS CompressInformationClass, PVOID CompressInformation, SIZE_T CompressInformationSize);
54   WINBOOL WINAPI QueryDecompressorInformation (DECOMPRESSOR_HANDLE DecompressorHandle, COMPRESS_INFORMATION_CLASS CompressInformationClass, PVOID CompressInformation, SIZE_T CompressInformationSize);
55   WINBOOL WINAPI ResetCompressor (COMPRESSOR_HANDLE CompressorHandle);
56   WINBOOL WINAPI ResetDecompressor (DECOMPRESSOR_HANDLE DecompressorHandle);
57   WINBOOL WINAPI SetCompressorInformation (COMPRESSOR_HANDLE CompressorHandle, COMPRESS_INFORMATION_CLASS CompressInformationClass, PVOID CompressInformation, SIZE_T CompressInformationSize);
58   WINBOOL WINAPI SetDecompressorInformation (DECOMPRESSOR_HANDLE DecompressorHandle, COMPRESS_INFORMATION_CLASS CompressInformationClass, PVOID CompressInformation, SIZE_T CompressInformationSize);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif
65 #endif
66