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_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 | #include <pshpack4.h>
|
---|
38 |
|
---|
39 | #ifndef INCLUDED_TYPES_FCI_FDI
|
---|
40 | #define INCLUDED_TYPES_FCI_FDI 1
|
---|
41 |
|
---|
42 | /***********************************************************************
|
---|
43 | * Common FCI/TDI declarations
|
---|
44 | */
|
---|
45 |
|
---|
46 | typedef ULONG CHECKSUM;
|
---|
47 |
|
---|
48 | typedef ULONG UOFF;
|
---|
49 | typedef ULONG COFF;
|
---|
50 |
|
---|
51 | /**********************************************************************/
|
---|
52 |
|
---|
53 | typedef struct {
|
---|
54 | int erfOper; /* FCI/FDI error code - see {FCI,FDI}ERROR_XXX for details. */
|
---|
55 | int erfType; /* Optional error value filled in by FCI/FDI. */
|
---|
56 | BOOL fError; /* TRUE => error present */
|
---|
57 | } ERF, *PERF;
|
---|
58 |
|
---|
59 | /**********************************************************************/
|
---|
60 |
|
---|
61 | #define CB_MAX_CHUNK 32768U
|
---|
62 | #define CB_MAX_DISK 0x7fffffffL
|
---|
63 | #define CB_MAX_FILENAME 256
|
---|
64 | #define CB_MAX_CABINET_NAME 256
|
---|
65 | #define CB_MAX_CAB_PATH 256
|
---|
66 | #define CB_MAX_DISK_NAME 256
|
---|
67 |
|
---|
68 | /**********************************************************************/
|
---|
69 |
|
---|
70 | typedef unsigned short TCOMP;
|
---|
71 |
|
---|
72 | #define tcompMASK_TYPE 0x000F /* Mask for compression type */
|
---|
73 | #define tcompTYPE_NONE 0x0000 /* No compression */
|
---|
74 | #define tcompTYPE_MSZIP 0x0001 /* MSZIP */
|
---|
75 | #define tcompTYPE_QUANTUM 0x0002 /* Quantum */
|
---|
76 | #define tcompTYPE_LZX 0x0003 /* LZX */
|
---|
77 | #define tcompBAD 0x000F /* Unspecified compression type */
|
---|
78 |
|
---|
79 | #define tcompMASK_LZX_WINDOW 0x1F00 /* Mask for LZX Compression Memory */
|
---|
80 | #define tcompLZX_WINDOW_LO 0x0F00 /* Lowest LZX Memory (15) */
|
---|
81 | #define tcompLZX_WINDOW_HI 0x1500 /* Highest LZX Memory (21) */
|
---|
82 | #define tcompSHIFT_LZX_WINDOW 8 /* Amount to shift over to get int */
|
---|
83 |
|
---|
84 | #define tcompMASK_QUANTUM_LEVEL 0x00F0 /* Mask for Quantum Compression Level */
|
---|
85 | #define tcompQUANTUM_LEVEL_LO 0x0010 /* Lowest Quantum Level (1) */
|
---|
86 | #define tcompQUANTUM_LEVEL_HI 0x0070 /* Highest Quantum Level (7) */
|
---|
87 | #define tcompSHIFT_QUANTUM_LEVEL 4 /* Amount to shift over to get int */
|
---|
88 |
|
---|
89 | #define tcompMASK_QUANTUM_MEM 0x1F00 /* Mask for Quantum Compression Memory */
|
---|
90 | #define tcompQUANTUM_MEM_LO 0x0A00 /* Lowest Quantum Memory (10) */
|
---|
91 | #define tcompQUANTUM_MEM_HI 0x1500 /* Highest Quantum Memory (21) */
|
---|
92 | #define tcompSHIFT_QUANTUM_MEM 8 /* Amount to shift over to get int */
|
---|
93 |
|
---|
94 | #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
|
---|
95 |
|
---|
96 | /**********************************************************************/
|
---|
97 |
|
---|
98 | #define CompressionTypeFromTCOMP(tc) \
|
---|
99 | ((tc) & tcompMASK_TYPE)
|
---|
100 |
|
---|
101 | #define CompressionLevelFromTCOMP(tc) \
|
---|
102 | (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
|
---|
103 |
|
---|
104 | #define CompressionMemoryFromTCOMP(tc) \
|
---|
105 | (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
|
---|
106 |
|
---|
107 | #define TCOMPfromTypeLevelMemory(t, l, m) \
|
---|
108 | (((m) << tcompSHIFT_QUANTUM_MEM ) | \
|
---|
109 | ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
|
---|
110 | ( t ))
|
---|
111 |
|
---|
112 | #define LZXCompressionWindowFromTCOMP(tc) \
|
---|
113 | (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
|
---|
114 |
|
---|
115 | #define TCOMPfromLZXWindow(w) \
|
---|
116 | (((w) << tcompSHIFT_LZX_WINDOW) | \
|
---|
117 | ( tcompTYPE_LZX ))
|
---|
118 |
|
---|
119 | #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
|
---|
120 |
|
---|
121 | /***********************************************************************
|
---|
122 | * FCI declarations
|
---|
123 | */
|
---|
124 |
|
---|
125 | typedef enum {
|
---|
126 | FCIERR_NONE,
|
---|
127 | FCIERR_OPEN_SRC,
|
---|
128 | FCIERR_READ_SRC,
|
---|
129 | FCIERR_ALLOC_FAIL,
|
---|
130 | FCIERR_TEMP_FILE,
|
---|
131 | FCIERR_BAD_COMPR_TYPE,
|
---|
132 | FCIERR_CAB_FILE,
|
---|
133 | FCIERR_USER_ABORT,
|
---|
134 | FCIERR_MCI_FAIL,
|
---|
135 | } FCIERROR;
|
---|
136 |
|
---|
137 | /**********************************************************************/
|
---|
138 |
|
---|
139 | #ifndef _A_NAME_IS_UTF
|
---|
140 | #define _A_NAME_IS_UTF 0x80
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #ifndef _A_EXEC
|
---|
144 | #define _A_EXEC 0x40
|
---|
145 | #endif
|
---|
146 |
|
---|
147 | /**********************************************************************/
|
---|
148 |
|
---|
149 | typedef void *HFCI;
|
---|
150 |
|
---|
151 | /**********************************************************************/
|
---|
152 |
|
---|
153 | typedef struct {
|
---|
154 | ULONG cb; /* Size available for cabinet on this media */
|
---|
155 | ULONG cbFolderThresh; /* Threshold for forcing a new Folder */
|
---|
156 |
|
---|
157 | UINT cbReserveCFHeader; /* Space to reserve in CFHEADER */
|
---|
158 | UINT cbReserveCFFolder; /* Space to reserve in CFFOLDER */
|
---|
159 | UINT cbReserveCFData; /* Space to reserve in CFDATA */
|
---|
160 | int iCab; /* Sequential numbers for cabinets */
|
---|
161 | int iDisk; /* Disk number */
|
---|
162 | #ifndef REMOVE_CHICAGO_M6_HACK
|
---|
163 | int fFailOnIncompressible; /* TRUE => Fail if a block is incompressible */
|
---|
164 | #endif
|
---|
165 |
|
---|
166 | USHORT setID; /* Cabinet set ID */
|
---|
167 |
|
---|
168 | char szDisk[CB_MAX_DISK_NAME]; /* Current disk name */
|
---|
169 | char szCab[CB_MAX_CABINET_NAME]; /* Current cabinet name */
|
---|
170 | char szCabPath[CB_MAX_CAB_PATH]; /* Path for creating cabinet */
|
---|
171 | } CCAB, *PCCAB;
|
---|
172 |
|
---|
173 | /**********************************************************************/
|
---|
174 |
|
---|
175 | typedef void * (__cdecl __WINE_ALLOC_SIZE(1) *PFNFCIALLOC)(ULONG cb);
|
---|
176 | #define FNFCIALLOC(fn) void * __cdecl fn(ULONG cb)
|
---|
177 |
|
---|
178 | typedef void (__cdecl *PFNFCIFREE)(void *memory);
|
---|
179 | #define FNFCIFREE(fn) void __cdecl fn(void *memory)
|
---|
180 |
|
---|
181 | typedef INT_PTR (__cdecl *PFNFCIOPEN) (char *pszFile, int oflag, int pmode, int *err, void *pv);
|
---|
182 | #define FNFCIOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode, int *err, void *pv)
|
---|
183 |
|
---|
184 | typedef UINT (__cdecl *PFNFCIREAD) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
|
---|
185 | #define FNFCIREAD(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
|
---|
186 |
|
---|
187 | typedef UINT (__cdecl *PFNFCIWRITE)(INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
|
---|
188 | #define FNFCIWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
|
---|
189 |
|
---|
190 | typedef int (__cdecl *PFNFCICLOSE)(INT_PTR hf, int *err, void *pv);
|
---|
191 | #define FNFCICLOSE(fn) int __cdecl fn(INT_PTR hf, int *err, void *pv)
|
---|
192 |
|
---|
193 | typedef LONG (__cdecl *PFNFCISEEK) (INT_PTR hf, LONG dist, int seektype, int *err, void *pv);
|
---|
194 | #define FNFCISEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
|
---|
195 |
|
---|
196 | typedef int (__cdecl *PFNFCIDELETE) (char *pszFile, int *err, void *pv);
|
---|
197 | #define FNFCIDELETE(fn) int __cdecl fn(char *pszFile, int *err, void *pv)
|
---|
198 |
|
---|
199 | typedef BOOL (__cdecl *PFNFCIGETNEXTCABINET)(PCCAB pccab, ULONG cbPrevCab, void *pv);
|
---|
200 | #define FNFCIGETNEXTCABINET(fn) BOOL __cdecl fn(PCCAB pccab, \
|
---|
201 | ULONG cbPrevCab, \
|
---|
202 | void *pv)
|
---|
203 |
|
---|
204 | typedef int (__cdecl *PFNFCIFILEPLACED)(PCCAB pccab,
|
---|
205 | char *pszFile,
|
---|
206 | LONG cbFile,
|
---|
207 | BOOL fContinuation,
|
---|
208 | void *pv);
|
---|
209 | #define FNFCIFILEPLACED(fn) int __cdecl fn(PCCAB pccab, \
|
---|
210 | char *pszFile, \
|
---|
211 | LONG cbFile, \
|
---|
212 | BOOL fContinuation, \
|
---|
213 | void *pv)
|
---|
214 |
|
---|
215 | typedef INT_PTR (__cdecl *PFNFCIGETOPENINFO)(char *pszName,
|
---|
216 | USHORT *pdate,
|
---|
217 | USHORT *ptime,
|
---|
218 | USHORT *pattribs,
|
---|
219 | int *err,
|
---|
220 | void *pv);
|
---|
221 | #define FNFCIGETOPENINFO(fn) INT_PTR __cdecl fn(char *pszName, \
|
---|
222 | USHORT *pdate, \
|
---|
223 | USHORT *ptime, \
|
---|
224 | USHORT *pattribs, \
|
---|
225 | int *err, \
|
---|
226 | void *pv)
|
---|
227 |
|
---|
228 | #define statusFile 0 /* Add File to Folder callback */
|
---|
229 | #define statusFolder 1 /* Add Folder to Cabinet callback */
|
---|
230 | #define statusCabinet 2 /* Write out a completed cabinet callback */
|
---|
231 |
|
---|
232 | typedef LONG (__cdecl *PFNFCISTATUS)(UINT typeStatus,
|
---|
233 | ULONG cb1,
|
---|
234 | ULONG cb2,
|
---|
235 | void *pv);
|
---|
236 | #define FNFCISTATUS(fn) LONG __cdecl fn(UINT typeStatus, \
|
---|
237 | ULONG cb1, \
|
---|
238 | ULONG cb2, \
|
---|
239 | void *pv)
|
---|
240 |
|
---|
241 | typedef BOOL (__cdecl *PFNFCIGETTEMPFILE)(char *pszTempName,
|
---|
242 | int cbTempName,
|
---|
243 | void *pv);
|
---|
244 | #define FNFCIGETTEMPFILE(fn) BOOL __cdecl fn(char *pszTempName, \
|
---|
245 | int cbTempName, \
|
---|
246 | void *pv)
|
---|
247 |
|
---|
248 | /**********************************************************************/
|
---|
249 |
|
---|
250 | HFCI __cdecl FCICreate(PERF, PFNFCIFILEPLACED, PFNFCIALLOC, PFNFCIFREE,
|
---|
251 | PFNFCIOPEN, PFNFCIREAD, PFNFCIWRITE, PFNFCICLOSE,
|
---|
252 | PFNFCISEEK, PFNFCIDELETE, PFNFCIGETTEMPFILE, PCCAB,
|
---|
253 | void *);
|
---|
254 | BOOL __cdecl FCIAddFile(HFCI, char *, char *, BOOL, PFNFCIGETNEXTCABINET,
|
---|
255 | PFNFCISTATUS, PFNFCIGETOPENINFO, TCOMP);
|
---|
256 | BOOL __cdecl FCIFlushCabinet(HFCI, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS);
|
---|
257 | BOOL __cdecl FCIFlushFolder(HFCI, PFNFCIGETNEXTCABINET, PFNFCISTATUS);
|
---|
258 | BOOL __cdecl FCIDestroy(HFCI hfci);
|
---|
259 |
|
---|
260 | /**********************************************************************/
|
---|
261 |
|
---|
262 | #include <poppack.h>
|
---|
263 |
|
---|
264 | #ifdef __cplusplus
|
---|
265 | } /* extern "C" */
|
---|
266 | #endif /* defined(__cplusplus) */
|
---|
267 |
|
---|
268 | #endif /* __WINE_FCI_H */
|
---|