| 1 | /**
 | 
|---|
| 2 |  * This file has no copyright assigned and is placed in the Public Domain.
 | 
|---|
| 3 |  * This file is part of the mingw-w64 runtime package.
 | 
|---|
| 4 |  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 | 
|---|
| 5 |  */
 | 
|---|
| 6 | #ifndef INCLUDED_TYPES_FCI_FDI
 | 
|---|
| 7 | #define INCLUDED_TYPES_FCI_FDI 1
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #ifdef __cplusplus
 | 
|---|
| 10 | extern "C" {
 | 
|---|
| 11 | #endif
 | 
|---|
| 12 | 
 | 
|---|
| 13 | #ifndef HUGE
 | 
|---|
| 14 | #define HUGE
 | 
|---|
| 15 | #endif
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #ifndef FAR
 | 
|---|
| 18 | #define FAR
 | 
|---|
| 19 | #endif
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #ifndef DIAMONDAPI
 | 
|---|
| 22 | #define DIAMONDAPI __cdecl
 | 
|---|
| 23 | #endif
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #ifndef _WIN64
 | 
|---|
| 26 | #include <pshpack4.h>
 | 
|---|
| 27 | #endif
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #ifndef BASETYPES
 | 
|---|
| 30 | #define BASETYPES
 | 
|---|
| 31 |   typedef unsigned __LONG32 ULONG;
 | 
|---|
| 32 |   typedef ULONG *PULONG;
 | 
|---|
| 33 |   typedef unsigned short USHORT;
 | 
|---|
| 34 |   typedef USHORT *PUSHORT;
 | 
|---|
| 35 |   typedef unsigned char UCHAR;
 | 
|---|
| 36 |   typedef UCHAR *PUCHAR;
 | 
|---|
| 37 |   typedef char *PSZ;
 | 
|---|
| 38 | #endif
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #if !defined(_INC_WINDOWS) && !defined(_WINDOWS_)
 | 
|---|
| 41 |   typedef int WINBOOL;
 | 
|---|
| 42 |   typedef unsigned char BYTE;
 | 
|---|
| 43 |   typedef unsigned int UINT;
 | 
|---|
| 44 | #endif
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   typedef unsigned __LONG32 CHECKSUM;
 | 
|---|
| 47 |   typedef unsigned __LONG32 UOFF;
 | 
|---|
| 48 |   typedef unsigned __LONG32 COFF;
 | 
|---|
| 49 | 
 | 
|---|
| 50 | #ifndef TRUE
 | 
|---|
| 51 | #define TRUE 1
 | 
|---|
| 52 | #endif
 | 
|---|
| 53 | 
 | 
|---|
| 54 | #ifndef FALSE
 | 
|---|
| 55 | #define FALSE 0
 | 
|---|
| 56 | #endif
 | 
|---|
| 57 | 
 | 
|---|
| 58 | #ifndef NULL
 | 
|---|
| 59 | #define NULL 0
 | 
|---|
| 60 | #endif
 | 
|---|
| 61 | 
 | 
|---|
| 62 |   typedef struct {
 | 
|---|
| 63 |     int erfOper;
 | 
|---|
| 64 |     int erfType;
 | 
|---|
| 65 |     WINBOOL fError;
 | 
|---|
| 66 |   } ERF;
 | 
|---|
| 67 |   typedef ERF *PERF;
 | 
|---|
| 68 | 
 | 
|---|
| 69 | #define STATIC static
 | 
|---|
| 70 | 
 | 
|---|
| 71 | #define CB_MAX_CHUNK 32768U
 | 
|---|
| 72 | #define CB_MAX_DISK __MSABI_LONG(0x7fffffff)
 | 
|---|
| 73 | #define CB_MAX_FILENAME 256
 | 
|---|
| 74 | #define CB_MAX_CABINET_NAME 256
 | 
|---|
| 75 | #define CB_MAX_CAB_PATH 256
 | 
|---|
| 76 | #define CB_MAX_DISK_NAME 256
 | 
|---|
| 77 | 
 | 
|---|
| 78 |   typedef unsigned short TCOMP;
 | 
|---|
| 79 | 
 | 
|---|
| 80 | #define tcompMASK_TYPE 0x000F
 | 
|---|
| 81 | #define tcompTYPE_NONE 0x0000
 | 
|---|
| 82 | #define tcompTYPE_MSZIP 0x0001
 | 
|---|
| 83 | #define tcompTYPE_QUANTUM 0x0002
 | 
|---|
| 84 | #define tcompTYPE_LZX 0x0003
 | 
|---|
| 85 | #define tcompBAD 0x000F
 | 
|---|
| 86 | 
 | 
|---|
| 87 | #define tcompMASK_LZX_WINDOW 0x1F00
 | 
|---|
| 88 | #define tcompLZX_WINDOW_LO 0x0F00
 | 
|---|
| 89 | #define tcompLZX_WINDOW_HI 0x1500
 | 
|---|
| 90 | #define tcompSHIFT_LZX_WINDOW 8
 | 
|---|
| 91 | 
 | 
|---|
| 92 | #define tcompMASK_QUANTUM_LEVEL 0x00F0
 | 
|---|
| 93 | #define tcompQUANTUM_LEVEL_LO 0x0010
 | 
|---|
| 94 | #define tcompQUANTUM_LEVEL_HI 0x0070
 | 
|---|
| 95 | #define tcompSHIFT_QUANTUM_LEVEL 4
 | 
|---|
| 96 | 
 | 
|---|
| 97 | #define tcompMASK_QUANTUM_MEM 0x1F00
 | 
|---|
| 98 | #define tcompQUANTUM_MEM_LO 0x0A00
 | 
|---|
| 99 | #define tcompQUANTUM_MEM_HI 0x1500
 | 
|---|
| 100 | #define tcompSHIFT_QUANTUM_MEM 8
 | 
|---|
| 101 | 
 | 
|---|
| 102 | #define tcompMASK_RESERVED 0xE000
 | 
|---|
| 103 | 
 | 
|---|
| 104 | #define CompressionTypeFromTCOMP(tc) ((tc) & tcompMASK_TYPE)
 | 
|---|
| 105 | #define CompressionLevelFromTCOMP(tc) (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
 | 
|---|
| 106 | #define CompressionMemoryFromTCOMP(tc) (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
 | 
|---|
| 107 | #define TCOMPfromTypeLevelMemory(t,l,m) (((m) << tcompSHIFT_QUANTUM_MEM) | ((l) << tcompSHIFT_QUANTUM_LEVEL) | (t))
 | 
|---|
| 108 | #define LZXCompressionWindowFromTCOMP(tc) (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
 | 
|---|
| 109 | #define TCOMPfromLZXWindow(w) (((w) << tcompSHIFT_LZX_WINDOW) | (tcompTYPE_LZX))
 | 
|---|
| 110 | 
 | 
|---|
| 111 | #ifndef _WIN64
 | 
|---|
| 112 | #include <poppack.h>
 | 
|---|
| 113 | #endif
 | 
|---|
| 114 | 
 | 
|---|
| 115 | #ifdef __cplusplus
 | 
|---|
| 116 | }
 | 
|---|
| 117 | #endif
 | 
|---|
| 118 | #endif
 | 
|---|
| 119 | 
 | 
|---|
| 120 | #ifndef INCLUDED_FCI
 | 
|---|
| 121 | #define INCLUDED_FCI 1
 | 
|---|
| 122 | 
 | 
|---|
| 123 | #include <basetsd.h>
 | 
|---|
| 124 | 
 | 
|---|
| 125 | #ifdef __cplusplus
 | 
|---|
| 126 | extern "C" {
 | 
|---|
| 127 | #endif
 | 
|---|
| 128 | 
 | 
|---|
| 129 | #ifndef _WIN64
 | 
|---|
| 130 | #pragma pack(4)
 | 
|---|
| 131 | #endif
 | 
|---|
| 132 | 
 | 
|---|
| 133 |   typedef enum {
 | 
|---|
| 134 |     FCIERR_NONE,FCIERR_OPEN_SRC,FCIERR_READ_SRC,FCIERR_ALLOC_FAIL,FCIERR_TEMP_FILE,FCIERR_BAD_COMPR_TYPE,FCIERR_CAB_FILE,FCIERR_USER_ABORT,
 | 
|---|
| 135 |     FCIERR_MCI_FAIL
 | 
|---|
| 136 |   } FCIERROR;
 | 
|---|
| 137 | 
 | 
|---|
| 138 | #ifndef _A_NAME_IS_UTF
 | 
|---|
| 139 | #define _A_NAME_IS_UTF 0x80
 | 
|---|
| 140 | #endif
 | 
|---|
| 141 | 
 | 
|---|
| 142 | #ifndef _A_EXEC
 | 
|---|
| 143 | #define _A_EXEC 0x40
 | 
|---|
| 144 | #endif
 | 
|---|
| 145 | 
 | 
|---|
| 146 |   typedef void *HFCI;
 | 
|---|
| 147 | 
 | 
|---|
| 148 |   typedef struct {
 | 
|---|
| 149 |     ULONG cb;
 | 
|---|
| 150 |     ULONG cbFolderThresh;
 | 
|---|
| 151 |     UINT cbReserveCFHeader;
 | 
|---|
| 152 |     UINT cbReserveCFFolder;
 | 
|---|
| 153 |     UINT cbReserveCFData;
 | 
|---|
| 154 |     int iCab;
 | 
|---|
| 155 |     int iDisk;
 | 
|---|
| 156 | #ifndef REMOVE_CHICAGO_M6_HACK
 | 
|---|
| 157 |     int fFailOnIncompressible;
 | 
|---|
| 158 | #endif
 | 
|---|
| 159 |     USHORT setID;
 | 
|---|
| 160 |     char szDisk[CB_MAX_DISK_NAME];
 | 
|---|
| 161 |     char szCab[CB_MAX_CABINET_NAME];
 | 
|---|
| 162 |     char szCabPath[CB_MAX_CAB_PATH];
 | 
|---|
| 163 |   } CCAB;
 | 
|---|
| 164 | 
 | 
|---|
| 165 |   typedef CCAB *PCCAB;
 | 
|---|
| 166 | 
 | 
|---|
| 167 |   typedef void *(DIAMONDAPI *PFNFCIALLOC)(ULONG cb);
 | 
|---|
| 168 | #define FNFCIALLOC(fn) void *DIAMONDAPI fn(ULONG cb)
 | 
|---|
| 169 | 
 | 
|---|
| 170 |   typedef void (DIAMONDAPI *PFNFCIFREE)(void *memory);
 | 
|---|
| 171 | #define FNFCIFREE(fn) void DIAMONDAPI fn(void *memory)
 | 
|---|
| 172 | 
 | 
|---|
| 173 |   typedef INT_PTR (DIAMONDAPI *PFNFCIOPEN) (char *pszFile,int oflag,int pmode,int *err,void *pv);
 | 
|---|
| 174 |   typedef UINT (DIAMONDAPI *PFNFCIREAD) (INT_PTR hf,void *memory,UINT cb,int *err,void *pv);
 | 
|---|
| 175 |   typedef UINT (DIAMONDAPI *PFNFCIWRITE)(INT_PTR hf,void *memory,UINT cb,int *err,void *pv);
 | 
|---|
| 176 |   typedef int (DIAMONDAPI *PFNFCICLOSE)(INT_PTR hf,int *err,void *pv);
 | 
|---|
| 177 |   typedef __LONG32 (DIAMONDAPI *PFNFCISEEK) (INT_PTR hf,__LONG32 dist,int seektype,int *err,void *pv);
 | 
|---|
| 178 |   typedef int (DIAMONDAPI *PFNFCIDELETE) (char *pszFile,int *err,void *pv);
 | 
|---|
| 179 | 
 | 
|---|
| 180 | #define FNFCIOPEN(fn) INT_PTR DIAMONDAPI fn(char *pszFile,int oflag,int pmode,int *err,void *pv)
 | 
|---|
| 181 | #define FNFCIREAD(fn) UINT DIAMONDAPI fn(INT_PTR hf,void *memory,UINT cb,int *err,void *pv)
 | 
|---|
| 182 | #define FNFCIWRITE(fn) UINT DIAMONDAPI fn(INT_PTR hf,void *memory,UINT cb,int *err,void *pv)
 | 
|---|
| 183 | #define FNFCICLOSE(fn) int DIAMONDAPI fn(INT_PTR hf,int *err,void *pv)
 | 
|---|
| 184 | #define FNFCISEEK(fn) __LONG32 DIAMONDAPI fn(INT_PTR hf,__LONG32 dist,int seektype,int *err,void *pv)
 | 
|---|
| 185 | #define FNFCIDELETE(fn) int DIAMONDAPI fn(char *pszFile,int *err,void *pv)
 | 
|---|
| 186 | 
 | 
|---|
| 187 |   typedef WINBOOL (DIAMONDAPI *PFNFCIGETNEXTCABINET)(PCCAB pccab,ULONG cbPrevCab,void *pv);
 | 
|---|
| 188 | #define FNFCIGETNEXTCABINET(fn) WINBOOL DIAMONDAPI fn(PCCAB pccab,ULONG cbPrevCab,void *pv)
 | 
|---|
| 189 |   typedef int (DIAMONDAPI *PFNFCIFILEPLACED)(PCCAB pccab,char *pszFile,__LONG32 cbFile,WINBOOL fContinuation,void *pv);
 | 
|---|
| 190 | #define FNFCIFILEPLACED(fn) int DIAMONDAPI fn(PCCAB pccab,char *pszFile,__LONG32 cbFile,WINBOOL fContinuation,void *pv)
 | 
|---|
| 191 |   typedef INT_PTR (DIAMONDAPI *PFNFCIGETOPENINFO)(char *pszName,USHORT *pdate,USHORT *ptime,USHORT *pattribs,int *err,void *pv);
 | 
|---|
| 192 | #define FNFCIGETOPENINFO(fn) INT_PTR DIAMONDAPI fn(char *pszName,USHORT *pdate,USHORT *ptime,USHORT *pattribs,int *err,void *pv)
 | 
|---|
| 193 | 
 | 
|---|
| 194 | #define statusFile 0
 | 
|---|
| 195 | #define statusFolder 1
 | 
|---|
| 196 | #define statusCabinet 2
 | 
|---|
| 197 | 
 | 
|---|
| 198 |   typedef __LONG32 (DIAMONDAPI *PFNFCISTATUS)(UINT typeStatus,ULONG cb1,ULONG cb2,void *pv);
 | 
|---|
| 199 | #define FNFCISTATUS(fn) __LONG32 DIAMONDAPI fn(UINT typeStatus,ULONG cb1,ULONG cb2,void *pv)
 | 
|---|
| 200 |   typedef WINBOOL (DIAMONDAPI *PFNFCIGETTEMPFILE)(char *pszTempName,int cbTempName,void *pv);
 | 
|---|
| 201 | #define FNFCIGETTEMPFILE(fn) WINBOOL DIAMONDAPI fn(char *pszTempName,int cbTempName,void *pv)
 | 
|---|
| 202 | 
 | 
|---|
| 203 |   HFCI DIAMONDAPI FCICreate(PERF perf,PFNFCIFILEPLACED pfnfcifp,PFNFCIALLOC pfna,PFNFCIFREE pfnf,PFNFCIOPEN pfnopen,PFNFCIREAD pfnread,PFNFCIWRITE pfnwrite,PFNFCICLOSE pfnclose,PFNFCISEEK pfnseek,PFNFCIDELETE pfndelete,PFNFCIGETTEMPFILE pfnfcigtf,PCCAB pccab,void *pv);
 | 
|---|
| 204 |   WINBOOL DIAMONDAPI FCIAddFile(HFCI hfci,char *pszSourceFile,char *pszFileName,WINBOOL fExecute,PFNFCIGETNEXTCABINET pfnfcignc,PFNFCISTATUS pfnfcis,PFNFCIGETOPENINFO pfnfcigoi,TCOMP typeCompress);
 | 
|---|
| 205 |   WINBOOL DIAMONDAPI FCIFlushCabinet(HFCI hfci,WINBOOL fGetNextCab,PFNFCIGETNEXTCABINET pfnfcignc,PFNFCISTATUS pfnfcis);
 | 
|---|
| 206 |   WINBOOL DIAMONDAPI FCIFlushFolder(HFCI hfci,PFNFCIGETNEXTCABINET pfnfcignc,PFNFCISTATUS pfnfcis);
 | 
|---|
| 207 |   WINBOOL DIAMONDAPI FCIDestroy (HFCI hfci);
 | 
|---|
| 208 | 
 | 
|---|
| 209 | #ifndef _WIN64
 | 
|---|
| 210 | #pragma pack()
 | 
|---|
| 211 | #endif
 | 
|---|
| 212 | 
 | 
|---|
| 213 | #ifdef __cplusplus
 | 
|---|
| 214 | }
 | 
|---|
| 215 | #endif
 | 
|---|
| 216 | #endif
 | 
|---|