main
h 62 lines 1.79 KB
Raw
1 #pragma once
2 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5 #include <fci.h>
6 #include <fcntl.h>
7 #include <msi.h>
8
9 // Callback from PFNFCIGETNEXTCABINET CabCGetNextCabinet method
10 // First argument is the name of splitting cabinet without extension e.g. "cab1"
11 // Second argument is name of the new cabinet that would be formed by splitting e.g. "cab1b.cab"
12 // Third argument is the file token of the first file present in the splitting cabinet
13 typedef void (__stdcall * FileSplitCabNamesCallback)(LPCWSTR, LPCWSTR, LPCWSTR);
14
15 #define CAB_MAX_SIZE 0x7FFFFFFF // (see KB: Q174866)
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 extern const int CABC_HANDLE_BYTES;
22
23 // time vs. space trade-off
24 typedef enum COMPRESSION_TYPE
25 {
26 COMPRESSION_TYPE_NONE, // fastest
27 COMPRESSION_TYPE_LOW,
28 COMPRESSION_TYPE_MEDIUM,
29 COMPRESSION_TYPE_HIGH, // smallest
30 COMPRESSION_TYPE_MSZIP
31 } COMPRESSION_TYPE;
32
33 // functions
34 HRESULT DAPI CabCBegin(
35 __in_z LPCWSTR wzCab,
36 __in_z LPCWSTR wzCabDir,
37 __in DWORD dwMaxFiles,
38 __in DWORD dwMaxSize,
39 __in DWORD dwMaxThresh,
40 __in COMPRESSION_TYPE ct,
41 __out_bcount(CABC_HANDLE_BYTES) HANDLE *phContext
42 );
43 HRESULT DAPI CabCNextCab(
44 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
45 );
46 HRESULT DAPI CabCAddFile(
47 __in_z LPCWSTR wzFile,
48 __in_z_opt LPCWSTR wzToken,
49 __in_opt PMSIFILEHASHINFO pmfHash,
50 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
51 );
52 HRESULT DAPI CabCFinish(
53 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext,
54 __in_opt FileSplitCabNamesCallback fileSplitCabNamesCallback
55 );
56 void DAPI CabCCancel(
57 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
58 );
59
60 #ifdef __cplusplus
61 }
62 #endif