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