|
|
|
1 |
|
/*** types.h - Common defines for FCI/FDI stuff -- goes into FCI/FDI.H |
2 |
|
* |
3 |
|
* Copyright (C) Microsoft Corporation |
4 |
|
* All Rights Reserved. |
5 |
|
* |
6 |
|
*/ |
7 |
|
|
8 |
|
#ifndef INCLUDED_TYPES_FCI_FDI |
9 |
|
#define INCLUDED_TYPES_FCI_FDI 1 |
10 |
|
|
11 |
|
#ifdef __cplusplus |
12 |
|
extern "C" { /* Assume C declarations for C++ */ |
13 |
|
#endif /* __cplusplus */ |
14 |
|
|
15 |
|
|
16 |
|
//** Define away for 32-bit build |
17 |
|
#ifndef HUGE |
18 |
|
#define HUGE |
19 |
|
#endif |
20 |
|
|
21 |
|
#ifndef FAR |
22 |
|
#define FAR |
23 |
|
#endif |
24 |
|
|
25 |
|
|
26 |
|
#ifndef DIAMONDAPI |
27 |
|
#define DIAMONDAPI __cdecl |
28 |
|
#endif |
29 |
|
|
30 |
|
|
31 |
|
//** Specify structure packing explicitly for clients of FDI |
32 |
|
|
33 |
|
#ifndef _WIN64 |
34 |
|
#include <pshpack4.h> |
35 |
|
#endif |
36 |
|
|
37 |
|
|
38 |
|
//** Don't redefine types defined in Win16 WINDOWS.H (_INC_WINDOWS) |
39 |
|
// or Win32 WINDOWS.H (_WINDOWS_) |
40 |
|
// |
41 |
|
#if !defined(_INC_WINDOWS) && !defined(_WINDOWS_) |
42 |
|
typedef int BOOL; /* f */ |
43 |
|
typedef unsigned char BYTE; /* b */ |
44 |
|
typedef unsigned int UINT; /* ui */ |
45 |
|
typedef unsigned short USHORT; /* us */ |
46 |
|
typedef unsigned long ULONG; /* ul */ |
47 |
|
#endif // _INC_WINDOWS |
48 |
|
|
49 |
|
typedef unsigned long CHECKSUM; /* csum */ |
50 |
|
|
51 |
|
typedef unsigned long UOFF; /* uoff - uncompressed offset */ |
52 |
|
typedef unsigned long COFF; /* coff - cabinet file offset */ |
53 |
|
|
54 |
|
|
55 |
|
#ifndef TRUE |
56 |
|
#define TRUE 1 |
57 |
|
#endif |
58 |
|
|
59 |
|
#ifndef FALSE |
60 |
|
#define FALSE 0 |
61 |
|
#endif |
62 |
|
|
63 |
|
#ifndef NULL |
64 |
|
#define NULL 0 |
65 |
|
#endif |
66 |
|
|
67 |
|
|
68 |
|
/*** ERF - Error structure |
69 |
|
* |
70 |
|
* This structure returns error information from FCI/FDI. The caller should |
71 |
|
* not modify this structure. |
72 |
|
*/ |
73 |
|
typedef struct { |
74 |
|
int erfOper; // FCI/FDI error code -- see FDIERROR_XXX |
75 |
|
// and FCIERR_XXX equates for details. |
76 |
|
|
77 |
|
int erfType; // Optional error value filled in by FCI/FDI. |
78 |
|
// For FCI, this is usually the C run-time |
79 |
|
// *errno* value. |
80 |
|
|
81 |
|
BOOL fError; // TRUE => error present |
82 |
|
} ERF; /* erf */ |
83 |
|
typedef ERF FAR *PERF; /* perf */ |
84 |
|
|
85 |
|
#ifdef _DEBUG |
86 |
|
// don't hide statics from map during debugging |
87 |
|
#define STATIC |
88 |
|
#else // !DEBUG |
89 |
|
#define STATIC static |
90 |
|
#endif // !DEBUG |
91 |
|
|
92 |
|
#define CB_MAX_CHUNK 32768U |
93 |
|
#define CB_MAX_DISK 0x7fffffffL |
94 |
|
#define CB_MAX_FILENAME 256 |
95 |
|
#define CB_MAX_CABINET_NAME 256 |
96 |
|
#define CB_MAX_CAB_PATH 256 |
97 |
|
#define CB_MAX_DISK_NAME 256 |
98 |
|
|
99 |
|
/*** tcompXXX - Diamond compression types |
100 |
|
* |
101 |
|
* These are passed to FCIAddFile(), and are also stored in the CFFOLDER |
102 |
|
* structures in cabinet files. |
103 |
|
* |
104 |
|
* NOTE: We reserve bits for the TYPE, QUANTUM_LEVEL, and QUANTUM_MEM |
105 |
|
* to provide room for future expansion. Since this value is stored |
106 |
|
* in the CFDATA records in the cabinet file, we don't want to |
107 |
|
* have to change the format for existing compression configurations |
108 |
|
* if we add new ones in the future. This will allows us to read |
109 |
|
* old cabinet files in the future. |
110 |
|
*/ |
111 |
|
|
112 |
|
typedef unsigned short TCOMP; /* tcomp */ |
113 |
|
|
114 |
|
#define tcompMASK_TYPE 0x000F // Mask for compression type |
1190 |
|
* Entry: |
1191 |
|
* hfdi - handle to FDI context (created by FDICreate()) |
1192 |
|
* |
1193 |
|
* Exit-Success: |
1194 |
|
* Returns TRUE; |
1195 |
|
* |
1196 |
|
* Exit-Failure: |
1197 |
|
* Returns FALSE; |
1198 |
|
*/ |
1199 |
|
BOOL FAR DIAMONDAPI FDIDestroy(__in HFDI hfdi); |
1200 |
|
|
1201 |
|
|
1202 |
|
/*** FDITruncateCabinet - truncate a cabinet, starting at folder # |
1203 |
|
* |
1204 |
|
* Entry: |
1205 |
|
* hfdi - handle to FDI context (created by FDICreate()) |
1206 |
|
* pszCabinet - full pathname of cabinet file |
1207 |
|
* iFolderToDelete - first folder # to delete |
1208 |
|
* |
1209 |
|
* Exit-Success: |
1210 |
|
* Returns TRUE; |
1211 |
|
* |
1212 |
|
* Exit-Failure: |
1213 |
|
* Returns FALSE; |
1214 |
|
* |
1215 |
|
* Most likely failure is unable to open cabinet for writing. |
1216 |
|
* |
1217 |
|
* NOTE: This function relies on additional feature in the |
1218 |
|
* supplied PFNWRITE function, that a write of 0 bytes |
1219 |
|
* will truncate the file at the current position. |
1220 |
|
*/ |
1221 |
|
|
1222 |
|
BOOL FAR DIAMONDAPI FDITruncateCabinet(__in HFDI hfdi, |
1223 |
|
__in LPSTR pszCabinetName, |
1224 |
|
USHORT iFolderToDelete); |
1225 |
|
|
1226 |
|
|
1227 |
|
//** Revert to default structure packing |
1228 |
|
#ifndef _WIN64 |
1229 |
|
#include <poppack.h> |
1230 |
|
#endif |
1231 |
|
|
1232 |
|
#ifdef __cplusplus |
1233 |
|
} |
1234 |
|
#endif /* __cplusplus */ |
1235 |
|
|
1236 |
|
#endif //!INCLUDED_FDI |
1237 |
|
|
1238 |
|
|
|
|
|