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_FCI_H
|
---|
29 | #define __WINE_FCI_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 | * FCI declarations
|
---|
125 | */
|
---|
126 |
|
---|
127 | typedef enum {
|
---|
128 | FCIERR_NONE,
|
---|
129 | FCIERR_OPEN_SRC,
|
---|
130 | FCIERR_READ_SRC,
|
---|
131 | FCIERR_ALLOC_FAIL,
|
---|
132 | FCIERR_TEMP_FILE,
|
---|
133 | FCIERR_BAD_COMPR_TYPE,
|
---|
134 | FCIERR_CAB_FILE,
|
---|
135 | FCIERR_USER_ABORT,
|
---|
136 | FCIERR_MCI_FAIL,
|
---|
137 | } FCIERROR;
|
---|
138 |
|
---|
139 | /**********************************************************************/
|
---|
140 |
|
---|
141 | #ifndef _A_NAME_IS_UTF
|
---|
142 | #define _A_NAME_IS_UTF 0x80
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | #ifndef _A_EXEC
|
---|
146 | #define _A_EXEC 0x40
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | /**********************************************************************/
|
---|
150 |
|
---|
151 | typedef void *HFCI;
|
---|
152 |
|
---|
153 | /**********************************************************************/
|
---|
154 |
|
---|
155 | typedef struct {
|
---|
156 | ULONG cb; /* Size available for cabinet on this media */
|
---|
157 | ULONG cbFolderThresh; /* Threshold for forcing a new Folder */
|
---|
158 |
|
---|
159 | UINT cbReserveCFHeader; /* Space to reserve in CFHEADER */
|
---|
160 | UINT cbReserveCFFolder; /* Space to reserve in CFFOLDER */
|
---|
161 | UINT cbReserveCFData; /* Space to reserve in CFDATA */
|
---|
162 | int iCab; /* Sequential numbers for cabinets */
|
---|
163 | int iDisk; /* Disk number */
|
---|
164 | #ifndef REMOVE_CHICAGO_M6_HACK
|
---|
165 | int fFailOnIncompressible; /* TRUE => Fail if a block is incompressible */
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | USHORT setID; /* Cabinet set ID */
|
---|
169 |
|
---|
170 | char szDisk[CB_MAX_DISK_NAME]; /* Current disk name */
|
---|
171 | char szCab[CB_MAX_CABINET_NAME]; /* Current cabinet name */
|
---|
172 | char szCabPath[CB_MAX_CAB_PATH]; /* Path for creating cabinet */
|
---|
173 | } CCAB, *PCCAB;
|
---|
174 |
|
---|
175 | /**********************************************************************/
|
---|
176 |
|
---|
177 | typedef void * (__cdecl __WINE_ALLOC_SIZE(1) *PFNFCIALLOC)(ULONG cb);
|
---|
178 | #define FNFCIALLOC(fn) void * __cdecl fn(ULONG cb)
|
---|
179 |
|
---|
180 | typedef void (__cdecl *PFNFCIFREE)(void *memory);
|
---|
181 | #define FNFCIFREE(fn) void __cdecl fn(void *memory)
|
---|
182 |
|
---|
183 | typedef INT_PTR (__cdecl *PFNFCIOPEN) (char *pszFile, int oflag, int pmode, int *err, void *pv);
|
---|
184 | #define FNFCIOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode, int *err, void *pv)
|
---|
185 |
|
---|
186 | typedef UINT (__cdecl *PFNFCIREAD) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
|
---|
187 | #define FNFCIREAD(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
|
---|
188 |
|
---|
189 | typedef UINT (__cdecl *PFNFCIWRITE)(INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
|
---|
190 | #define FNFCIWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
|
---|
191 |
|
---|
192 | typedef int (__cdecl *PFNFCICLOSE)(INT_PTR hf, int *err, void *pv);
|
---|
193 | #define FNFCICLOSE(fn) int __cdecl fn(INT_PTR hf, int *err, void *pv)
|
---|
194 |
|
---|
195 | typedef LONG (__cdecl *PFNFCISEEK) (INT_PTR hf, LONG dist, int seektype, int *err, void *pv);
|
---|
196 | #define FNFCISEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
|
---|
197 |
|
---|
198 | typedef int (__cdecl *PFNFCIDELETE) (char *pszFile, int *err, void *pv);
|
---|
199 | #define FNFCIDELETE(fn) int __cdecl fn(char *pszFile, int *err, void *pv)
|
---|
200 |
|
---|
201 | typedef BOOL (__cdecl *PFNFCIGETNEXTCABINET)(PCCAB pccab, ULONG cbPrevCab, void *pv);
|
---|
202 | #define FNFCIGETNEXTCABINET(fn) BOOL __cdecl fn(PCCAB pccab, \
|
---|
203 | ULONG cbPrevCab, \
|
---|
204 | void *pv)
|
---|
205 |
|
---|
206 | typedef int (__cdecl *PFNFCIFILEPLACED)(PCCAB pccab,
|
---|
207 | char *pszFile,
|
---|
208 | LONG cbFile,
|
---|
209 | BOOL fContinuation,
|
---|
210 | void *pv);
|
---|
211 | #define FNFCIFILEPLACED(fn) int __cdecl fn(PCCAB pccab, \
|
---|
212 | char *pszFile, \
|
---|
213 | LONG cbFile, \
|
---|
214 | BOOL fContinuation, \
|
---|
215 | void *pv)
|
---|
216 |
|
---|
217 | typedef INT_PTR (__cdecl *PFNFCIGETOPENINFO)(char *pszName,
|
---|
218 | USHORT *pdate,
|
---|
219 | USHORT *ptime,
|
---|
220 | USHORT *pattribs,
|
---|
221 | int *err,
|
---|
222 | void *pv);
|
---|
223 | #define FNFCIGETOPENINFO(fn) INT_PTR __cdecl fn(char *pszName, \
|
---|
224 | USHORT *pdate, \
|
---|
225 | USHORT *ptime, \
|
---|
226 | USHORT *pattribs, \
|
---|
227 | int *err, \
|
---|
228 | void *pv)
|
---|
229 |
|
---|
230 | #define statusFile 0 /* Add File to Folder callback */
|
---|
231 | #define statusFolder 1 /* Add Folder to Cabinet callback */
|
---|
232 | #define statusCabinet 2 /* Write out a completed cabinet callback */
|
---|
233 |
|
---|
234 | typedef LONG (__cdecl *PFNFCISTATUS)(UINT typeStatus,
|
---|
235 | ULONG cb1,
|
---|
236 | ULONG cb2,
|
---|
237 | void *pv);
|
---|
238 | #define FNFCISTATUS(fn) LONG __cdecl fn(UINT typeStatus, \
|
---|
239 | ULONG cb1, \
|
---|
240 | ULONG cb2, \
|
---|
241 | void *pv)
|
---|
242 |
|
---|
243 | typedef BOOL (__cdecl *PFNFCIGETTEMPFILE)(char *pszTempName,
|
---|
244 | int cbTempName,
|
---|
245 | void *pv);
|
---|
246 | #define FNFCIGETTEMPFILE(fn) BOOL __cdecl fn(char *pszTempName, \
|
---|
247 | int cbTempName, \
|
---|
248 | void *pv)
|
---|
249 |
|
---|
250 | /**********************************************************************/
|
---|
251 |
|
---|
252 | HFCI __cdecl FCICreate(PERF, PFNFCIFILEPLACED, PFNFCIALLOC, PFNFCIFREE,
|
---|
253 | PFNFCIOPEN, PFNFCIREAD, PFNFCIWRITE, PFNFCICLOSE,
|
---|
254 | PFNFCISEEK, PFNFCIDELETE, PFNFCIGETTEMPFILE, PCCAB,
|
---|
255 | void *);
|
---|
256 | BOOL __cdecl FCIAddFile(HFCI, char *, char *, BOOL, PFNFCIGETNEXTCABINET,
|
---|
257 | PFNFCISTATUS, PFNFCIGETOPENINFO, TCOMP);
|
---|
258 | BOOL __cdecl FCIFlushCabinet(HFCI, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS);
|
---|
259 | BOOL __cdecl FCIFlushFolder(HFCI, PFNFCIGETNEXTCABINET, PFNFCISTATUS);
|
---|
260 | BOOL __cdecl FCIDestroy(HFCI hfci);
|
---|
261 |
|
---|
262 | /**********************************************************************/
|
---|
263 |
|
---|
264 | #ifndef _WIN64
|
---|
265 | #include <poppack.h>
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #ifdef __cplusplus
|
---|
269 | } /* extern "C" */
|
---|
270 | #endif /* defined(__cplusplus) */
|
---|
271 |
|
---|
272 | #endif /* __WINE_FCI_H */
|
---|