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