1 | /*
|
---|
2 | * Copyright (C) 2002 Patrik Stridvall
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __WINE_FDI_H
|
---|
29 | #define __WINE_FDI_H
|
---|
30 |
|
---|
31 | #include <basetsd.h>
|
---|
32 |
|
---|
33 | #ifdef __cplusplus
|
---|
34 | extern "C" {
|
---|
35 | #endif /* defined(__cplusplus) */
|
---|
36 |
|
---|
37 | #ifndef _WIN64
|
---|
38 | #include <pshpack4.h>
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #ifndef INCLUDED_TYPES_FCI_FDI
|
---|
42 | #define INCLUDED_TYPES_FCI_FDI 1
|
---|
43 |
|
---|
44 | /***********************************************************************
|
---|
45 | * Common FCI/TDI declarations
|
---|
46 | */
|
---|
47 |
|
---|
48 | typedef ULONG CHECKSUM;
|
---|
49 |
|
---|
50 | typedef ULONG UOFF;
|
---|
51 | typedef ULONG COFF;
|
---|
52 |
|
---|
53 | /**********************************************************************/
|
---|
54 |
|
---|
55 | typedef struct {
|
---|
56 | int erfOper; /* FCI/FDI error code - see {FCI,FDI}ERROR_XXX for details. */
|
---|
57 | int erfType; /* Optional error value filled in by FCI/FDI. */
|
---|
58 | BOOL fError; /* TRUE => error present */
|
---|
59 | } ERF, *PERF;
|
---|
60 |
|
---|
61 | /**********************************************************************/
|
---|
62 |
|
---|
63 | #define CB_MAX_CHUNK 32768U
|
---|
64 | #define CB_MAX_DISK __MSABI_LONG(0x7fffffff)
|
---|
65 | #define CB_MAX_FILENAME 256
|
---|
66 | #define CB_MAX_CABINET_NAME 256
|
---|
67 | #define CB_MAX_CAB_PATH 256
|
---|
68 | #define CB_MAX_DISK_NAME 256
|
---|
69 |
|
---|
70 | /**********************************************************************/
|
---|
71 |
|
---|
72 | typedef unsigned short TCOMP;
|
---|
73 |
|
---|
74 | #define tcompMASK_TYPE 0x000F /* Mask for compression type */
|
---|
75 | #define tcompTYPE_NONE 0x0000 /* No compression */
|
---|
76 | #define tcompTYPE_MSZIP 0x0001 /* MSZIP */
|
---|
77 | #define tcompTYPE_QUANTUM 0x0002 /* Quantum */
|
---|
78 | #define tcompTYPE_LZX 0x0003 /* LZX */
|
---|
79 | #define tcompBAD 0x000F /* Unspecified compression type */
|
---|
80 |
|
---|
81 | #define tcompMASK_LZX_WINDOW 0x1F00 /* Mask for LZX Compression Memory */
|
---|
82 | #define tcompLZX_WINDOW_LO 0x0F00 /* Lowest LZX Memory (15) */
|
---|
83 | #define tcompLZX_WINDOW_HI 0x1500 /* Highest LZX Memory (21) */
|
---|
84 | #define tcompSHIFT_LZX_WINDOW 8 /* Amount to shift over to get int */
|
---|
85 |
|
---|
86 | #define tcompMASK_QUANTUM_LEVEL 0x00F0 /* Mask for Quantum Compression Level */
|
---|
87 | #define tcompQUANTUM_LEVEL_LO 0x0010 /* Lowest Quantum Level (1) */
|
---|
88 | #define tcompQUANTUM_LEVEL_HI 0x0070 /* Highest Quantum Level (7) */
|
---|
89 | #define tcompSHIFT_QUANTUM_LEVEL 4 /* Amount to shift over to get int */
|
---|
90 |
|
---|
91 | #define tcompMASK_QUANTUM_MEM 0x1F00 /* Mask for Quantum Compression Memory */
|
---|
92 | #define tcompQUANTUM_MEM_LO 0x0A00 /* Lowest Quantum Memory (10) */
|
---|
93 | #define tcompQUANTUM_MEM_HI 0x1500 /* Highest Quantum Memory (21) */
|
---|
94 | #define tcompSHIFT_QUANTUM_MEM 8 /* Amount to shift over to get int */
|
---|
95 |
|
---|
96 | #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
|
---|
97 |
|
---|
98 | /**********************************************************************/
|
---|
99 |
|
---|
100 | #define CompressionTypeFromTCOMP(tc) \
|
---|
101 | ((tc) & tcompMASK_TYPE)
|
---|
102 |
|
---|
103 | #define CompressionLevelFromTCOMP(tc) \
|
---|
104 | (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
|
---|
105 |
|
---|
106 | #define CompressionMemoryFromTCOMP(tc) \
|
---|
107 | (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
|
---|
108 |
|
---|
109 | #define TCOMPfromTypeLevelMemory(t, l, m) \
|
---|
110 | (((m) << tcompSHIFT_QUANTUM_MEM ) | \
|
---|
111 | ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
|
---|
112 | ( t ))
|
---|
113 |
|
---|
114 | #define LZXCompressionWindowFromTCOMP(tc) \
|
---|
115 | (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
|
---|
116 |
|
---|
117 | #define TCOMPfromLZXWindow(w) \
|
---|
118 | (((w) << tcompSHIFT_LZX_WINDOW) | \
|
---|
119 | ( tcompTYPE_LZX ))
|
---|
120 |
|
---|
121 | #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
|
---|
122 |
|
---|
123 | /***********************************************************************
|
---|
124 | * FDI declarations
|
---|
125 | */
|
---|
126 |
|
---|
127 | typedef enum {
|
---|
128 | FDIERROR_NONE,
|
---|
129 | FDIERROR_CABINET_NOT_FOUND,
|
---|
130 | FDIERROR_NOT_A_CABINET,
|
---|
131 | FDIERROR_UNKNOWN_CABINET_VERSION,
|
---|
132 | FDIERROR_CORRUPT_CABINET,
|
---|
133 | FDIERROR_ALLOC_FAIL,
|
---|
134 | FDIERROR_BAD_COMPR_TYPE,
|
---|
135 | FDIERROR_MDI_FAIL,
|
---|
136 | FDIERROR_TARGET_FILE,
|
---|
137 | FDIERROR_RESERVE_MISMATCH,
|
---|
138 | FDIERROR_WRONG_CABINET,
|
---|
139 | FDIERROR_USER_ABORT,
|
---|
140 | } FDIERROR;
|
---|
141 |
|
---|
142 | /**********************************************************************/
|
---|
143 |
|
---|
144 | #ifndef _A_NAME_IS_UTF
|
---|
145 | #define _A_NAME_IS_UTF 0x80
|
---|
146 | #endif
|
---|
147 |
|
---|
148 | #ifndef _A_EXEC
|
---|
149 | #define _A_EXEC 0x40
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | /**********************************************************************/
|
---|
153 |
|
---|
154 | typedef void *HFDI;
|
---|
155 |
|
---|
156 | /**********************************************************************/
|
---|
157 |
|
---|
158 | typedef struct {
|
---|
159 | LONG cbCabinet; /* Total length of cabinet file */
|
---|
160 | USHORT cFolders; /* Count of folders in cabinet */
|
---|
161 | USHORT cFiles; /* Count of files in cabinet */
|
---|
162 | USHORT setID; /* Cabinet set ID */
|
---|
163 | USHORT iCabinet; /* Cabinet number in set (0 based) */
|
---|
164 | BOOL fReserve; /* TRUE => RESERVE present in cabinet */
|
---|
165 | BOOL hasprev; /* TRUE => Cabinet is chained prev */
|
---|
166 | BOOL hasnext; /* TRUE => Cabinet is chained next */
|
---|
167 | } FDICABINETINFO, *PFDICABINETINFO; /* pfdici */
|
---|
168 |
|
---|
169 | /**********************************************************************/
|
---|
170 |
|
---|
171 | typedef enum {
|
---|
172 | fdidtNEW_CABINET, /* New cabinet */
|
---|
173 | fdidtNEW_FOLDER, /* New folder */
|
---|
174 | fdidtDECRYPT, /* Decrypt a data block */
|
---|
175 | } FDIDECRYPTTYPE;
|
---|
176 |
|
---|
177 | /**********************************************************************/
|
---|
178 |
|
---|
179 | typedef struct {
|
---|
180 | FDIDECRYPTTYPE fdidt; /* Command type (selects union below) */
|
---|
181 |
|
---|
182 | void *pvUser; /* Decryption context */
|
---|
183 |
|
---|
184 | union {
|
---|
185 | struct { /* fdidtNEW_CABINET */
|
---|
186 | void *pHeaderReserve; /* RESERVE section from CFHEADER */
|
---|
187 | USHORT cbHeaderReserve; /* Size of pHeaderReserve */
|
---|
188 | USHORT setID; /* Cabinet set ID */
|
---|
189 | int iCabinet; /* Cabinet number in set (0 based) */
|
---|
190 | } cabinet;
|
---|
191 |
|
---|
192 | struct { /* fdidtNEW_FOLDER */
|
---|
193 | void *pFolderReserve; /* RESERVE section from CFFOLDER */
|
---|
194 | USHORT cbFolderReserve; /* Size of pFolderReserve */
|
---|
195 | USHORT iFolder; /* Folder number in cabinet (0 based) */
|
---|
196 | } folder;
|
---|
197 |
|
---|
198 | struct { /* fdidtDECRYPT */
|
---|
199 | void *pDataReserve; /* RESERVE section from CFDATA */
|
---|
200 | USHORT cbDataReserve; /* Size of pDataReserve */
|
---|
201 | void *pbData; /* Data buffer */
|
---|
202 | USHORT cbData; /* Size of data buffer */
|
---|
203 | BOOL fSplit; /* TRUE if this is a split data block */
|
---|
204 | USHORT cbPartial; /* 0 if this is not a split block, or
|
---|
205 | * the first piece of a split block;
|
---|
206 | * Greater than 0 if this is the
|
---|
207 | * second piece of a split block.
|
---|
208 | */
|
---|
209 | } decrypt;
|
---|
210 | } DUMMYUNIONNAME;
|
---|
211 | } FDIDECRYPT, *PFDIDECRYPT;
|
---|
212 |
|
---|
213 | /**********************************************************************/
|
---|
214 |
|
---|
215 | typedef void * (__cdecl *PFNALLOC)(ULONG cb);
|
---|
216 | #define FNALLOC(fn) void * __cdecl fn(ULONG cb)
|
---|
217 |
|
---|
218 | typedef void (__cdecl *PFNFREE)(void *pv);
|
---|
219 | #define FNFREE(fn) void __cdecl fn(void *pv)
|
---|
220 |
|
---|
221 | typedef INT_PTR (__cdecl *PFNOPEN) (char *pszFile, int oflag, int pmode);
|
---|
222 | #define FNOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode)
|
---|
223 |
|
---|
224 | typedef UINT (__cdecl *PFNREAD) (INT_PTR hf, void *pv, UINT cb);
|
---|
225 | #define FNREAD(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
|
---|
226 |
|
---|
227 | typedef UINT (__cdecl *PFNWRITE)(INT_PTR hf, void *pv, UINT cb);
|
---|
228 | #define FNWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
|
---|
229 |
|
---|
230 | typedef int (__cdecl *PFNCLOSE)(INT_PTR hf);
|
---|
231 | #define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
|
---|
232 |
|
---|
233 | typedef LONG (__cdecl *PFNSEEK) (INT_PTR hf, LONG dist, int seektype);
|
---|
234 | #define FNSEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype)
|
---|
235 |
|
---|
236 | typedef int (__cdecl *PFNFDIDECRYPT)(PFDIDECRYPT pfdid);
|
---|
237 | #define FNFDIDECRYPT(fn) int __cdecl fn(PFDIDECRYPT pfdid)
|
---|
238 |
|
---|
239 | typedef struct {
|
---|
240 | LONG cb;
|
---|
241 | char *psz1;
|
---|
242 | char *psz2;
|
---|
243 | char *psz3; /* Points to a 256 character buffer */
|
---|
244 | void *pv; /* Value for client */
|
---|
245 |
|
---|
246 | INT_PTR hf;
|
---|
247 |
|
---|
248 | USHORT date;
|
---|
249 | USHORT time;
|
---|
250 | USHORT attribs;
|
---|
251 |
|
---|
252 | USHORT setID; /* Cabinet set ID */
|
---|
253 | USHORT iCabinet; /* Cabinet number (0-based) */
|
---|
254 | USHORT iFolder; /* Folder number (0-based) */
|
---|
255 |
|
---|
256 | FDIERROR fdie;
|
---|
257 | } FDINOTIFICATION, *PFDINOTIFICATION;
|
---|
258 |
|
---|
259 | typedef enum {
|
---|
260 | fdintCABINET_INFO, /* General information about cabinet */
|
---|
261 | fdintPARTIAL_FILE, /* First file in cabinet is continuation */
|
---|
262 | fdintCOPY_FILE, /* File to be copied */
|
---|
263 | fdintCLOSE_FILE_INFO, /* Close the file, set relevant info */
|
---|
264 | fdintNEXT_CABINET, /* File continued to next cabinet */
|
---|
265 | fdintENUMERATE, /* Enumeration status */
|
---|
266 | } FDINOTIFICATIONTYPE;
|
---|
267 |
|
---|
268 | typedef INT_PTR (__cdecl *PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint,
|
---|
269 | PFDINOTIFICATION pfdin);
|
---|
270 | #define FNFDINOTIFY(fn) INT_PTR __cdecl fn(FDINOTIFICATIONTYPE fdint, \
|
---|
271 | PFDINOTIFICATION pfdin)
|
---|
272 |
|
---|
273 | #ifndef _WIN64
|
---|
274 | #include <pshpack1.h>
|
---|
275 | #endif
|
---|
276 |
|
---|
277 | typedef struct {
|
---|
278 | char ach[2]; /* Set to { '*', '\0' } */
|
---|
279 | LONG cbFile; /* Required spill file size */
|
---|
280 | } FDISPILLFILE, *PFDISPILLFILE;
|
---|
281 |
|
---|
282 | #ifndef _WIN64
|
---|
283 | #include <poppack.h>
|
---|
284 | #endif
|
---|
285 |
|
---|
286 | #define cpuUNKNOWN (-1) /* FDI does detection */
|
---|
287 | #define cpu80286 (0) /* '286 opcodes only */
|
---|
288 | #define cpu80386 (1) /* '386 opcodes used */
|
---|
289 |
|
---|
290 | /**********************************************************************/
|
---|
291 |
|
---|
292 | HFDI __cdecl FDICreate(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE,
|
---|
293 | PFNCLOSE, PFNSEEK, int, PERF);
|
---|
294 | BOOL __cdecl FDIIsCabinet(HFDI, INT_PTR, PFDICABINETINFO);
|
---|
295 | BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY,
|
---|
296 | PFNFDIDECRYPT, void *pvUser);
|
---|
297 | BOOL __cdecl FDIDestroy(HFDI);
|
---|
298 | BOOL __cdecl FDITruncateCabinet(HFDI, char *, USHORT);
|
---|
299 |
|
---|
300 | /**********************************************************************/
|
---|
301 |
|
---|
302 | #ifndef _WIN64
|
---|
303 | #include <poppack.h>
|
---|
304 | #endif
|
---|
305 |
|
---|
306 | #ifdef __cplusplus
|
---|
307 | } /* extern "C" */
|
---|
308 | #endif /* defined(__cplusplus) */
|
---|
309 |
|
---|
310 | #endif /* __WINE_FDI_H */
|
---|