ReactOS 0.4.15-dev-8417-gb6b82fe
fci.h File Reference
#include <basetsd.h>
#include <pshpack4.h>
#include <poppack.h>
Include dependency graph for fci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ERF
 
struct  CCAB
 

Macros

#define INCLUDED_TYPES_FCI_FDI   1
 
#define CB_MAX_CHUNK   32768U
 
#define CB_MAX_DISK   0x7fffffffL
 
#define CB_MAX_FILENAME   256
 
#define CB_MAX_CABINET_NAME   256
 
#define CB_MAX_CAB_PATH   256
 
#define CB_MAX_DISK_NAME   256
 
#define tcompMASK_TYPE   0x000F /* Mask for compression type */
 
#define tcompTYPE_NONE   0x0000 /* No compression */
 
#define tcompTYPE_MSZIP   0x0001 /* MSZIP */
 
#define tcompTYPE_QUANTUM   0x0002 /* Quantum */
 
#define tcompTYPE_LZX   0x0003 /* LZX */
 
#define tcompBAD   0x000F /* Unspecified compression type */
 
#define tcompMASK_LZX_WINDOW   0x1F00 /* Mask for LZX Compression Memory */
 
#define tcompLZX_WINDOW_LO   0x0F00 /* Lowest LZX Memory (15) */
 
#define tcompLZX_WINDOW_HI   0x1500 /* Highest LZX Memory (21) */
 
#define tcompSHIFT_LZX_WINDOW   8 /* Amount to shift over to get int */
 
#define tcompMASK_QUANTUM_LEVEL   0x00F0 /* Mask for Quantum Compression Level */
 
#define tcompQUANTUM_LEVEL_LO   0x0010 /* Lowest Quantum Level (1) */
 
#define tcompQUANTUM_LEVEL_HI   0x0070 /* Highest Quantum Level (7) */
 
#define tcompSHIFT_QUANTUM_LEVEL   4 /* Amount to shift over to get int */
 
#define tcompMASK_QUANTUM_MEM   0x1F00 /* Mask for Quantum Compression Memory */
 
#define tcompQUANTUM_MEM_LO   0x0A00 /* Lowest Quantum Memory (10) */
 
#define tcompQUANTUM_MEM_HI   0x1500 /* Highest Quantum Memory (21) */
 
#define tcompSHIFT_QUANTUM_MEM   8 /* Amount to shift over to get int */
 
#define tcompMASK_RESERVED   0xE000 /* Reserved bits (high 3 bits) */
 
#define CompressionTypeFromTCOMP(tc)    ((tc) & tcompMASK_TYPE)
 
#define CompressionLevelFromTCOMP(tc)    (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
 
#define CompressionMemoryFromTCOMP(tc)    (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
 
#define TCOMPfromTypeLevelMemory(t, l, m)
 
#define LZXCompressionWindowFromTCOMP(tc)    (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
 
#define TCOMPfromLZXWindow(w)
 
#define _A_NAME_IS_UTF   0x80
 
#define _A_EXEC   0x40
 
#define FNFCIALLOC(fn)   void * __cdecl fn(ULONG cb)
 
#define FNFCIFREE(fn)   void __cdecl fn(void *memory)
 
#define FNFCIOPEN(fn)   INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode, int *err, void *pv)
 
#define FNFCIREAD(fn)   UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
#define FNFCIWRITE(fn)   UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
#define FNFCICLOSE(fn)   int __cdecl fn(INT_PTR hf, int *err, void *pv)
 
#define FNFCISEEK(fn)   LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
 
#define FNFCIDELETE(fn)   int __cdecl fn(char *pszFile, int *err, void *pv)
 
#define FNFCIGETNEXTCABINET(fn)
 
#define FNFCIFILEPLACED(fn)
 
#define FNFCIGETOPENINFO(fn)
 
#define statusFile   0 /* Add File to Folder callback */
 
#define statusFolder   1 /* Add Folder to Cabinet callback */
 
#define statusCabinet   2 /* Write out a completed cabinet callback */
 
#define FNFCISTATUS(fn)
 
#define FNFCIGETTEMPFILE(fn)
 

Typedefs

typedef ULONG CHECKSUM
 
typedef ULONG UOFF
 
typedef ULONG COFF
 
typedef struct ERFPERF
 
typedef unsigned short TCOMP
 
typedef voidHFCI
 
typedef struct CCABPCCAB
 
typedef void *__cdecl __WINE_ALLOC_SIZE(1) *PFNFCIALLOC) (ULONG cb)
 
typedef void(__cdeclPFNFCIFREE) (void *memory)
 
typedef INT_PTR(__cdeclPFNFCIOPEN) (char *pszFile, int oflag, int pmode, int *err, void *pv)
 
typedef UINT(__cdeclPFNFCIREAD) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
typedef UINT(__cdeclPFNFCIWRITE) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
typedef int(__cdeclPFNFCICLOSE) (INT_PTR hf, int *err, void *pv)
 
typedef LONG(__cdeclPFNFCISEEK) (INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
 
typedef int(__cdeclPFNFCIDELETE) (char *pszFile, int *err, void *pv)
 
typedef BOOL(__cdeclPFNFCIGETNEXTCABINET) (PCCAB pccab, ULONG cbPrevCab, void *pv)
 
typedef int(__cdeclPFNFCIFILEPLACED) (PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
 
typedef INT_PTR(__cdeclPFNFCIGETOPENINFO) (char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
 
typedef LONG(__cdeclPFNFCISTATUS) (UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
 
typedef BOOL(__cdeclPFNFCIGETTEMPFILE) (char *pszTempName, int cbTempName, void *pv)
 

Enumerations

enum  FCIERROR {
  FCIERR_NONE , FCIERR_OPEN_SRC , FCIERR_READ_SRC , FCIERR_ALLOC_FAIL ,
  FCIERR_TEMP_FILE , FCIERR_BAD_COMPR_TYPE , FCIERR_CAB_FILE , FCIERR_USER_ABORT ,
  FCIERR_MCI_FAIL
}
 

Functions

HFCI __cdecl FCICreate (PERF, PFNFCIFILEPLACED, PFNFCIALLOC, PFNFCIFREE, PFNFCIOPEN, PFNFCIREAD, PFNFCIWRITE, PFNFCICLOSE, PFNFCISEEK, PFNFCIDELETE, PFNFCIGETTEMPFILE, PCCAB, void *)
 
BOOL __cdecl FCIAddFile (HFCI, char *, char *, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS, PFNFCIGETOPENINFO, TCOMP)
 
BOOL __cdecl FCIFlushCabinet (HFCI, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS)
 
BOOL __cdecl FCIFlushFolder (HFCI, PFNFCIGETNEXTCABINET, PFNFCISTATUS)
 
BOOL __cdecl FCIDestroy (HFCI hfci)
 

Macro Definition Documentation

◆ _A_EXEC

#define _A_EXEC   0x40

Definition at line 135 of file fci.h.

◆ _A_NAME_IS_UTF

#define _A_NAME_IS_UTF   0x80

Definition at line 131 of file fci.h.

◆ CB_MAX_CAB_PATH

#define CB_MAX_CAB_PATH   256

Definition at line 56 of file fci.h.

◆ CB_MAX_CABINET_NAME

#define CB_MAX_CABINET_NAME   256

Definition at line 55 of file fci.h.

◆ CB_MAX_CHUNK

#define CB_MAX_CHUNK   32768U

Definition at line 52 of file fci.h.

◆ CB_MAX_DISK

#define CB_MAX_DISK   0x7fffffffL

Definition at line 53 of file fci.h.

◆ CB_MAX_DISK_NAME

#define CB_MAX_DISK_NAME   256

Definition at line 57 of file fci.h.

◆ CB_MAX_FILENAME

#define CB_MAX_FILENAME   256

Definition at line 54 of file fci.h.

◆ CompressionLevelFromTCOMP

#define CompressionLevelFromTCOMP (   tc)     (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)

Definition at line 92 of file fci.h.

◆ CompressionMemoryFromTCOMP

#define CompressionMemoryFromTCOMP (   tc)     (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)

Definition at line 95 of file fci.h.

◆ CompressionTypeFromTCOMP

#define CompressionTypeFromTCOMP (   tc)     ((tc) & tcompMASK_TYPE)

Definition at line 89 of file fci.h.

◆ FNFCIALLOC

#define FNFCIALLOC (   fn)    void * __cdecl fn(ULONG cb)

Definition at line 167 of file fci.h.

◆ FNFCICLOSE

#define FNFCICLOSE (   fn)    int __cdecl fn(INT_PTR hf, int *err, void *pv)

Definition at line 182 of file fci.h.

◆ FNFCIDELETE

#define FNFCIDELETE (   fn)    int __cdecl fn(char *pszFile, int *err, void *pv)

Definition at line 188 of file fci.h.

◆ FNFCIFILEPLACED

#define FNFCIFILEPLACED (   fn)
Value:
int __cdecl fn(PCCAB pccab, \
char *pszFile, \
LONG cbFile, \
BOOL fContinuation, \
void *pv)
#define __cdecl
Definition: accygwin.h:79
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: fci.h:144
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

Definition at line 200 of file fci.h.

◆ FNFCIFREE

#define FNFCIFREE (   fn)    void __cdecl fn(void *memory)

Definition at line 170 of file fci.h.

◆ FNFCIGETNEXTCABINET

#define FNFCIGETNEXTCABINET (   fn)
Value:
BOOL __cdecl fn(PCCAB pccab, \
ULONG cbPrevCab, \
void *pv)
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 191 of file fci.h.

◆ FNFCIGETOPENINFO

#define FNFCIGETOPENINFO (   fn)
Value:
INT_PTR __cdecl fn(char *pszName, \
USHORT *pdate, \
USHORT *ptime, \
USHORT *pattribs, \
int *err, \
void *pv)
unsigned short USHORT
Definition: pedump.c:61
#define err(...)
int32_t INT_PTR
Definition: typedefs.h:64

Definition at line 212 of file fci.h.

◆ FNFCIGETTEMPFILE

#define FNFCIGETTEMPFILE (   fn)
Value:
BOOL __cdecl fn(char *pszTempName, \
int cbTempName, \
void *pv)

Definition at line 235 of file fci.h.

◆ FNFCIOPEN

#define FNFCIOPEN (   fn)    INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode, int *err, void *pv)

Definition at line 173 of file fci.h.

◆ FNFCIREAD

#define FNFCIREAD (   fn)    UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)

Definition at line 176 of file fci.h.

◆ FNFCISEEK

#define FNFCISEEK (   fn)    LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)

Definition at line 185 of file fci.h.

◆ FNFCISTATUS

#define FNFCISTATUS (   fn)
Value:
LONG __cdecl fn(UINT typeStatus, \
ULONG cb1, \
ULONG cb2, \
void *pv)
unsigned int UINT
Definition: ndis.h:50

Definition at line 227 of file fci.h.

◆ FNFCIWRITE

#define FNFCIWRITE (   fn)    UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)

Definition at line 179 of file fci.h.

◆ INCLUDED_TYPES_FCI_FDI

#define INCLUDED_TYPES_FCI_FDI   1

Definition at line 31 of file fci.h.

◆ LZXCompressionWindowFromTCOMP

#define LZXCompressionWindowFromTCOMP (   tc)     (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)

Definition at line 103 of file fci.h.

◆ statusCabinet

#define statusCabinet   2 /* Write out a completed cabinet callback */

Definition at line 221 of file fci.h.

◆ statusFile

#define statusFile   0 /* Add File to Folder callback */

Definition at line 219 of file fci.h.

◆ statusFolder

#define statusFolder   1 /* Add Folder to Cabinet callback */

Definition at line 220 of file fci.h.

◆ tcompBAD

#define tcompBAD   0x000F /* Unspecified compression type */

Definition at line 68 of file fci.h.

◆ TCOMPfromLZXWindow

#define TCOMPfromLZXWindow (   w)
Value:
#define tcompTYPE_LZX
Definition: fci.h:67
#define tcompSHIFT_LZX_WINDOW
Definition: fci.h:73
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102

Definition at line 106 of file fci.h.

◆ TCOMPfromTypeLevelMemory

#define TCOMPfromTypeLevelMemory (   t,
  l,
  m 
)
Value:
( t ))
r l[0]
Definition: byte_order.h:168
#define tcompSHIFT_QUANTUM_LEVEL
Definition: fci.h:78
#define tcompSHIFT_QUANTUM_MEM
Definition: fci.h:83
GLdouble GLdouble t
Definition: gl.h:2047
const GLfloat * m
Definition: glext.h:10848

Definition at line 98 of file fci.h.

◆ tcompLZX_WINDOW_HI

#define tcompLZX_WINDOW_HI   0x1500 /* Highest LZX Memory (21) */

Definition at line 72 of file fci.h.

◆ tcompLZX_WINDOW_LO

#define tcompLZX_WINDOW_LO   0x0F00 /* Lowest LZX Memory (15) */

Definition at line 71 of file fci.h.

◆ tcompMASK_LZX_WINDOW

#define tcompMASK_LZX_WINDOW   0x1F00 /* Mask for LZX Compression Memory */

Definition at line 70 of file fci.h.

◆ tcompMASK_QUANTUM_LEVEL

#define tcompMASK_QUANTUM_LEVEL   0x00F0 /* Mask for Quantum Compression Level */

Definition at line 75 of file fci.h.

◆ tcompMASK_QUANTUM_MEM

#define tcompMASK_QUANTUM_MEM   0x1F00 /* Mask for Quantum Compression Memory */

Definition at line 80 of file fci.h.

◆ tcompMASK_RESERVED

#define tcompMASK_RESERVED   0xE000 /* Reserved bits (high 3 bits) */

Definition at line 85 of file fci.h.

◆ tcompMASK_TYPE

#define tcompMASK_TYPE   0x000F /* Mask for compression type */

Definition at line 63 of file fci.h.

◆ tcompQUANTUM_LEVEL_HI

#define tcompQUANTUM_LEVEL_HI   0x0070 /* Highest Quantum Level (7) */

Definition at line 77 of file fci.h.

◆ tcompQUANTUM_LEVEL_LO

#define tcompQUANTUM_LEVEL_LO   0x0010 /* Lowest Quantum Level (1) */

Definition at line 76 of file fci.h.

◆ tcompQUANTUM_MEM_HI

#define tcompQUANTUM_MEM_HI   0x1500 /* Highest Quantum Memory (21) */

Definition at line 82 of file fci.h.

◆ tcompQUANTUM_MEM_LO

#define tcompQUANTUM_MEM_LO   0x0A00 /* Lowest Quantum Memory (10) */

Definition at line 81 of file fci.h.

◆ tcompSHIFT_LZX_WINDOW

#define tcompSHIFT_LZX_WINDOW   8 /* Amount to shift over to get int */

Definition at line 73 of file fci.h.

◆ tcompSHIFT_QUANTUM_LEVEL

#define tcompSHIFT_QUANTUM_LEVEL   4 /* Amount to shift over to get int */

Definition at line 78 of file fci.h.

◆ tcompSHIFT_QUANTUM_MEM

#define tcompSHIFT_QUANTUM_MEM   8 /* Amount to shift over to get int */

Definition at line 83 of file fci.h.

◆ tcompTYPE_LZX

#define tcompTYPE_LZX   0x0003 /* LZX */

Definition at line 67 of file fci.h.

◆ tcompTYPE_MSZIP

#define tcompTYPE_MSZIP   0x0001 /* MSZIP */

Definition at line 65 of file fci.h.

◆ tcompTYPE_NONE

#define tcompTYPE_NONE   0x0000 /* No compression */

Definition at line 64 of file fci.h.

◆ tcompTYPE_QUANTUM

#define tcompTYPE_QUANTUM   0x0002 /* Quantum */

Definition at line 66 of file fci.h.

Typedef Documentation

◆ __WINE_ALLOC_SIZE

static void * __WINE_ALLOC_SIZE
inline

Definition at line 166 of file fci.h.

◆ CHECKSUM

typedef ULONG CHECKSUM

Definition at line 37 of file fci.h.

◆ COFF

typedef ULONG COFF

Definition at line 40 of file fci.h.

◆ HFCI

typedef void* HFCI

Definition at line 140 of file fci.h.

◆ PCCAB

typedef struct CCAB * PCCAB

◆ PERF

typedef struct ERF * PERF

◆ PFNFCICLOSE

typedef int(__cdecl * PFNFCICLOSE) (INT_PTR hf, int *err, void *pv)

Definition at line 181 of file fci.h.

◆ PFNFCIDELETE

typedef int(__cdecl * PFNFCIDELETE) (char *pszFile, int *err, void *pv)

Definition at line 187 of file fci.h.

◆ PFNFCIFILEPLACED

typedef int(__cdecl * PFNFCIFILEPLACED) (PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)

Definition at line 195 of file fci.h.

◆ PFNFCIFREE

typedef void(__cdecl * PFNFCIFREE) (void *memory)

Definition at line 169 of file fci.h.

◆ PFNFCIGETNEXTCABINET

typedef BOOL(__cdecl * PFNFCIGETNEXTCABINET) (PCCAB pccab, ULONG cbPrevCab, void *pv)

Definition at line 190 of file fci.h.

◆ PFNFCIGETOPENINFO

typedef INT_PTR(__cdecl * PFNFCIGETOPENINFO) (char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)

Definition at line 206 of file fci.h.

◆ PFNFCIGETTEMPFILE

typedef BOOL(__cdecl * PFNFCIGETTEMPFILE) (char *pszTempName, int cbTempName, void *pv)

Definition at line 232 of file fci.h.

◆ PFNFCIOPEN

typedef INT_PTR(__cdecl * PFNFCIOPEN) (char *pszFile, int oflag, int pmode, int *err, void *pv)

Definition at line 172 of file fci.h.

◆ PFNFCIREAD

typedef UINT(__cdecl * PFNFCIREAD) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)

Definition at line 175 of file fci.h.

◆ PFNFCISEEK

typedef LONG(__cdecl * PFNFCISEEK) (INT_PTR hf, LONG dist, int seektype, int *err, void *pv)

Definition at line 184 of file fci.h.

◆ PFNFCISTATUS

typedef LONG(__cdecl * PFNFCISTATUS) (UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)

Definition at line 223 of file fci.h.

◆ PFNFCIWRITE

typedef UINT(__cdecl * PFNFCIWRITE) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)

Definition at line 178 of file fci.h.

◆ TCOMP

typedef unsigned short TCOMP

Definition at line 61 of file fci.h.

◆ UOFF

typedef ULONG UOFF

Definition at line 39 of file fci.h.

Enumeration Type Documentation

◆ FCIERROR

Enumerator
FCIERR_NONE 
FCIERR_OPEN_SRC 
FCIERR_READ_SRC 
FCIERR_ALLOC_FAIL 
FCIERR_TEMP_FILE 
FCIERR_BAD_COMPR_TYPE 
FCIERR_CAB_FILE 
FCIERR_USER_ABORT 
FCIERR_MCI_FAIL 

Definition at line 116 of file fci.h.

116 {
126} FCIERROR;
FCIERROR
Definition: fci.h:116
@ FCIERR_MCI_FAIL
Definition: fci.h:125
@ FCIERR_BAD_COMPR_TYPE
Definition: fci.h:122
@ FCIERR_TEMP_FILE
Definition: fci.h:121
@ FCIERR_USER_ABORT
Definition: fci.h:124
@ FCIERR_OPEN_SRC
Definition: fci.h:118
@ FCIERR_CAB_FILE
Definition: fci.h:123
@ FCIERR_ALLOC_FAIL
Definition: fci.h:120
@ FCIERR_READ_SRC
Definition: fci.h:119
@ FCIERR_NONE
Definition: fci.h:117

Function Documentation

◆ FCIAddFile()

BOOL __cdecl FCIAddFile ( HFCI  hfci,
char pszSourceFile,
char pszFileName,
BOOL  fExecute,
PFNFCIGETNEXTCABINET  pfnfcignc,
PFNFCISTATUS  pfnfcis,
PFNFCIGETOPENINFO  pfnfcigoi,
TCOMP  typeCompress 
)

Definition at line 1397 of file fci.c.

1406{
1407 cab_ULONG read_result;
1408 FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1409
1410 if (!p_fci_internal) return FALSE;
1411
1412 if ((!pszSourceFile) || (!pszFileName) || (!pfnfcignc) || (!pfnfcis) ||
1413 (!pfnfcigoi) || strlen(pszFileName)>=CB_MAX_FILENAME) {
1414 set_error( p_fci_internal, FCIERR_NONE, ERROR_BAD_ARGUMENTS );
1415 return FALSE;
1416 }
1417
1418 if (typeCompress != p_fci_internal->compression)
1419 {
1420 if (!FCIFlushFolder( hfci, pfnfcignc, pfnfcis )) return FALSE;
1421 switch (typeCompress)
1422 {
1423 case tcompTYPE_MSZIP:
1424#ifdef HAVE_ZLIB
1425 p_fci_internal->compression = tcompTYPE_MSZIP;
1426 p_fci_internal->compress = compress_MSZIP;
1427 break;
1428#endif
1429 default:
1430 FIXME( "compression %x not supported, defaulting to none\n", typeCompress );
1431 /* fall through */
1432 case tcompTYPE_NONE:
1433 p_fci_internal->compression = tcompTYPE_NONE;
1434 p_fci_internal->compress = compress_NONE;
1435 break;
1436 }
1437 }
1438
1439 /* TODO check if pszSourceFile??? */
1440
1441 if(p_fci_internal->fGetNextCabInVain && p_fci_internal->fNextCab) {
1442 /* internal error */
1443 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1444 return FALSE;
1445 }
1446
1447 if(p_fci_internal->fNextCab) {
1448 /* internal error */
1449 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1450 return FALSE;
1451 }
1452
1453 /* REUSE the variable read_result */
1454 read_result=get_header_size( p_fci_internal ) + p_fci_internal->ccab.cbReserveCFFolder;
1455
1456 read_result+= sizeof(CFFILE) + strlen(pszFileName)+1 +
1457 p_fci_internal->files_size + p_fci_internal->folders_data_size +
1458 p_fci_internal->placed_files_size + p_fci_internal->folders_size +
1459 sizeof(CFFOLDER); /* size of new CFFolder entry */
1460
1461 /* Might be too much data for the maximum size of a cabinet.*/
1462 /* When any further data will be added later, it might not */
1463 /* be possible to flush the cabinet, because there might */
1464 /* not be enough space to store the name of the following */
1465 /* cabinet and name of the corresponding disk. */
1466 /* So take care of this and get the name of the next cabinet */
1467 if( p_fci_internal->fGetNextCabInVain==FALSE &&
1468 p_fci_internal->fNextCab==FALSE &&
1469 ( p_fci_internal->ccab.cb < read_result +
1471 )
1472 ) {
1473 /* increment cabinet index */
1474 ++(p_fci_internal->pccab->iCab);
1475 /* get name of next cabinet */
1476 p_fci_internal->estimatedCabinetSize=p_fci_internal->statusFolderTotal;
1477 if (!(*pfnfcignc)(p_fci_internal->pccab,
1478 p_fci_internal->estimatedCabinetSize, /* estimated size of cab */
1479 p_fci_internal->pv)) {
1480 /* error handling */
1481 set_error( p_fci_internal, FCIERR_NONE, ERROR_FUNCTION_FAILED );
1482 return FALSE;
1483 }
1484 /* Skip a few lines of code. This is caught by the next if. */
1485 p_fci_internal->fGetNextCabInVain=TRUE;
1486 }
1487
1488 if( p_fci_internal->fGetNextCabInVain &&
1489 p_fci_internal->fNextCab
1490 ) {
1491 /* THIS CAN NEVER HAPPEN */
1492 /* set error code */
1493 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1494 return FALSE;
1495 }
1496
1497 /* too much data for cabinet */
1498 if( p_fci_internal->fGetNextCabInVain &&
1499 (
1500 p_fci_internal->ccab.cb < read_result +
1501 strlen(p_fci_internal->pccab->szCab)+1+
1502 strlen(p_fci_internal->pccab->szDisk)+1
1503 )) {
1504 p_fci_internal->fGetNextCabInVain=FALSE;
1505 p_fci_internal->fNextCab=TRUE;
1506 if(!fci_flush_cabinet( p_fci_internal, FALSE, pfnfcignc, pfnfcis)) return FALSE;
1507 }
1508
1509 if( p_fci_internal->fNextCab ) {
1510 /* THIS MAY NEVER HAPPEN */
1511 /* set error code */
1512 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1513 return FALSE;
1514 }
1515
1516 if (!add_file_data( p_fci_internal, pszSourceFile, pszFileName, fExecute, pfnfcigoi, pfnfcis ))
1517 return FALSE;
1518
1519 /* REUSE the variable read_result */
1520 read_result = get_header_size( p_fci_internal ) + p_fci_internal->ccab.cbReserveCFFolder;
1521 read_result+= p_fci_internal->pending_data_size +
1522 p_fci_internal->files_size + p_fci_internal->folders_data_size +
1523 p_fci_internal->placed_files_size + p_fci_internal->folders_size +
1524 sizeof(CFFOLDER); /* set size of new CFFolder entry */
1525
1526 /* too much data for the maximum size of a cabinet */
1527 /* (ignoring the unflushed data block) */
1528 if( p_fci_internal->fGetNextCabInVain==FALSE &&
1529 p_fci_internal->fNextCab==FALSE && /* this is always the case */
1530 p_fci_internal->ccab.cb < read_result ) {
1531 return fci_flush_cabinet( p_fci_internal, FALSE, pfnfcignc, pfnfcis);
1532 }
1533
1534 /* Might be too much data for the maximum size of a cabinet.*/
1535 /* When any further data will be added later, it might not */
1536 /* be possible to flush the cabinet, because there might */
1537 /* not be enough space to store the name of the following */
1538 /* cabinet and name of the corresponding disk. */
1539 /* So take care of this and get the name of the next cabinet */
1540 /* (ignoring the unflushed data block) */
1541 if( p_fci_internal->fGetNextCabInVain==FALSE &&
1542 p_fci_internal->fNextCab==FALSE &&
1543 ( p_fci_internal->ccab.cb < read_result +
1545 )
1546 ) {
1547 /* increment cabinet index */
1548 ++(p_fci_internal->pccab->iCab);
1549 /* get name of next cabinet */
1550 p_fci_internal->estimatedCabinetSize=p_fci_internal->statusFolderTotal;
1551 if (!(*pfnfcignc)(p_fci_internal->pccab,
1552 p_fci_internal->estimatedCabinetSize,/* estimated size of cab */
1553 p_fci_internal->pv)) {
1554 /* error handling */
1555 set_error( p_fci_internal, FCIERR_NONE, ERROR_FUNCTION_FAILED );
1556 return FALSE;
1557 }
1558 /* Skip a few lines of code. This is caught by the next if. */
1559 p_fci_internal->fGetNextCabInVain=TRUE;
1560 }
1561
1562 if( p_fci_internal->fGetNextCabInVain &&
1563 p_fci_internal->fNextCab
1564 ) {
1565 /* THIS CAN NEVER HAPPEN */
1566 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1567 return FALSE;
1568 }
1569
1570 /* too much data for cabinet */
1571 if( (p_fci_internal->fGetNextCabInVain ||
1572 p_fci_internal->fNextCab) && (
1573 p_fci_internal->ccab.cb < read_result +
1574 strlen(p_fci_internal->pccab->szCab)+1+
1575 strlen(p_fci_internal->pccab->szDisk)+1
1576 )) {
1577
1578 p_fci_internal->fGetNextCabInVain=FALSE;
1579 p_fci_internal->fNextCab=TRUE;
1580 return fci_flush_cabinet( p_fci_internal, FALSE, pfnfcignc, pfnfcis);
1581 }
1582
1583 if( p_fci_internal->fNextCab ) {
1584 /* THIS MAY NEVER HAPPEN */
1585 /* set error code */
1586 set_error( p_fci_internal, FCIERR_NONE, ERROR_GEN_FAILURE );
1587 return FALSE;
1588 }
1589
1590 /* if the FolderThreshold has been reached flush the folder automatically */
1591 if (p_fci_internal->cCompressedBytesInFolder >= p_fci_internal->ccab.cbFolderThresh)
1592 return FCIFlushFolder(hfci, pfnfcignc, pfnfcis);
1593
1594 return TRUE;
1595} /* end of FCIAddFile */
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 cab_ULONG
Definition: mszip.h:27
static cab_ULONG get_header_size(FCI_Int *fci)
Definition: fci.c:217
static BOOL add_file_data(FCI_Int *fci, char *sourcefile, char *filename, BOOL execute, PFNFCIGETOPENINFO get_open_info, PFNFCISTATUS status_callback)
Definition: fci.c:353
static cab_UWORD compress_NONE(FCI_Int *fci)
Definition: fci.c:906
static void set_error(FCI_Int *fci, int oper, int err)
Definition: fci.c:196
static FCI_Int * get_fci_ptr(HFCI hfci)
Definition: fci.c:204
static BOOL fci_flush_cabinet(FCI_Int *p_fci_internal, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1231
BOOL __cdecl FCIFlushFolder(HFCI hfci, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1631
#define CB_MAX_DISK_NAME
Definition: fci.h:57
#define CB_MAX_CABINET_NAME
Definition: fci.h:55
#define tcompTYPE_NONE
Definition: fci.h:64
#define CB_MAX_FILENAME
Definition: fci.h:54
#define tcompTYPE_MSZIP
Definition: fci.h:65
UINT cbReserveCFFolder
Definition: fci.h:149
ULONG cbFolderThresh
Definition: fci.h:146
int iCab
Definition: fci.h:151
char szDisk[CB_MAX_DISK_NAME]
Definition: fci.h:159
ULONG cb
Definition: fci.h:145
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
Definition: fci.c:89
Definition: fci.c:82
Definition: fci.c:146
void * pv
Definition: fci.c:167
cab_ULONG folders_size
Definition: fci.c:185
BOOL fGetNextCabInVain
Definition: fci.c:166
cab_ULONG files_size
Definition: fci.c:186
cab_ULONG estimatedCabinetSize
Definition: fci.c:181
cab_ULONG pending_data_size
Definition: fci.c:188
TCOMP compression
Definition: fci.c:190
cab_ULONG statusFolderTotal
Definition: fci.c:165
BOOL fNextCab
Definition: fci.c:162
CCAB ccab
Definition: fci.c:159
cab_ULONG folders_data_size
Definition: fci.c:189
PCCAB pccab
Definition: fci.c:160
ULONG cCompressedBytesInFolder
Definition: fci.c:173
cab_UWORD(* compress)(struct FCI_Int *)
Definition: fci.c:191
cab_ULONG placed_files_size
Definition: fci.c:187
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232

Referenced by add_file().

◆ FCICreate()

HFCI __cdecl FCICreate ( PERF  perf,
PFNFCIFILEPLACED  pfnfiledest,
PFNFCIALLOC  pfnalloc,
PFNFCIFREE  pfnfree,
PFNFCIOPEN  pfnopen,
PFNFCIREAD  pfnread,
PFNFCIWRITE  pfnwrite,
PFNFCICLOSE  pfnclose,
PFNFCISEEK  pfnseek,
PFNFCIDELETE  pfndelete,
PFNFCIGETTEMPFILE  pfnfcigtf,
PCCAB  pccab,
void pv 
)

Definition at line 998 of file fci.c.

1012{
1013 FCI_Int *p_fci_internal;
1014
1015 if (!perf) {
1017 return NULL;
1018 }
1019 if ((!pfnalloc) || (!pfnfree) || (!pfnopen) || (!pfnread) ||
1020 (!pfnwrite) || (!pfnclose) || (!pfnseek) || (!pfndelete) ||
1021 (!pfnfcigtf) || (!pccab)) {
1022 perf->erfOper = FCIERR_NONE;
1024 perf->fError = TRUE;
1025
1027 return NULL;
1028 }
1029
1030 if (!((p_fci_internal = pfnalloc(sizeof(FCI_Int))))) {
1031 perf->erfOper = FCIERR_ALLOC_FAIL;
1033 perf->fError = TRUE;
1034
1036 return NULL;
1037 }
1038
1039 memset(p_fci_internal, 0, sizeof(FCI_Int));
1040 p_fci_internal->magic = FCI_INT_MAGIC;
1041 p_fci_internal->perf = perf;
1042 p_fci_internal->fileplaced = pfnfiledest;
1043 p_fci_internal->alloc = pfnalloc;
1044 p_fci_internal->free = pfnfree;
1045 p_fci_internal->open = pfnopen;
1046 p_fci_internal->read = pfnread;
1047 p_fci_internal->write = pfnwrite;
1048 p_fci_internal->close = pfnclose;
1049 p_fci_internal->seek = pfnseek;
1050 p_fci_internal->delete = pfndelete;
1051 p_fci_internal->gettemp = pfnfcigtf;
1052 p_fci_internal->ccab = *pccab;
1053 p_fci_internal->pccab = pccab;
1054 p_fci_internal->pv = pv;
1055 p_fci_internal->data.handle = -1;
1056 p_fci_internal->compress = compress_NONE;
1057
1058 list_init( &p_fci_internal->folders_list );
1059 list_init( &p_fci_internal->files_list );
1060 list_init( &p_fci_internal->blocks_list );
1061
1062 memcpy(p_fci_internal->szPrevCab, pccab->szCab, CB_MAX_CABINET_NAME);
1063 memcpy(p_fci_internal->szPrevDisk, pccab->szDisk, CB_MAX_DISK_NAME);
1064
1065 return (HFCI)p_fci_internal;
1066}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define FCI_INT_MAGIC
Definition: fci.c:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memset(x, y, z)
Definition: compat.h:39
int erfType
Definition: fci.h:46
BOOL fError
Definition: fci.h:47
int erfOper
Definition: fci.h:45
PFNFCIFREE free
Definition: fci.c:151
char szPrevDisk[CB_MAX_DISK_NAME]
Definition: fci.c:169
PFNFCISEEK seek
Definition: fci.c:156
PFNFCIWRITE write
Definition: fci.c:154
struct temp_file data
Definition: fci.c:179
struct list folders_list
Definition: fci.c:182
struct list files_list
Definition: fci.c:183
PERF perf
Definition: fci.c:148
PFNFCIREAD read
Definition: fci.c:153
PFNFCIFILEPLACED fileplaced
Definition: fci.c:149
PFNFCIDELETE delete
Definition: fci.c:157
PFNFCICLOSE close
Definition: fci.c:155
PFNFCIALLOC alloc
Definition: fci.c:150
PFNFCIOPEN open
Definition: fci.c:152
struct list blocks_list
Definition: fci.c:184
unsigned int magic
Definition: fci.c:147
char szPrevCab[CB_MAX_CABINET_NAME]
Definition: fci.c:168
PFNFCIGETTEMPFILE gettemp
Definition: fci.c:158

Referenced by create_cab_file(), create_cc_test_files(), and test_FDICopy().

◆ FCIDestroy()

BOOL __cdecl FCIDestroy ( HFCI  hfci)

Definition at line 1709 of file fci.c.

1710{
1711 struct folder *folder, *folder_next;
1712 struct file *file, *file_next;
1713 struct data_block *block, *block_next;
1714 FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1715
1716 if (!p_fci_internal) return FALSE;
1717
1718 /* before hfci can be removed all temporary files must be closed */
1719 /* and deleted */
1720 p_fci_internal->magic = 0;
1721
1722 LIST_FOR_EACH_ENTRY_SAFE( folder, folder_next, &p_fci_internal->folders_list, struct folder, entry )
1723 {
1724 free_folder( p_fci_internal, folder );
1725 }
1726 LIST_FOR_EACH_ENTRY_SAFE( file, file_next, &p_fci_internal->files_list, struct file, entry )
1727 {
1728 free_file( p_fci_internal, file );
1729 }
1730 LIST_FOR_EACH_ENTRY_SAFE( block, block_next, &p_fci_internal->blocks_list, struct data_block, entry )
1731 {
1732 free_data_block( p_fci_internal, block );
1733 }
1734
1735 close_temp_file( p_fci_internal, &p_fci_internal->data );
1736
1737 /* hfci can now be removed */
1738 p_fci_internal->free(hfci);
1739 return TRUE;
1740}
static void free_folder(FCI_Int *fci, struct folder *folder)
Definition: fci.c:417
static void free_data_block(FCI_Int *fci, struct data_block *block)
Definition: fci.c:390
static BOOL close_temp_file(FCI_Int *fci, struct temp_file *file)
Definition: fci.c:251
static void free_file(FCI_Int *fci, struct file *file)
Definition: fci.c:306
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
Definition: fci.c:127
Definition: fci.c:116
static unsigned int block
Definition: xmlmemory.c:101

Referenced by create_cab_file(), create_cc_test_files(), and test_FDICopy().

◆ FCIFlushCabinet()

BOOL __cdecl FCIFlushCabinet ( HFCI  hfci,
BOOL  fGetNextCab,
PFNFCIGETNEXTCABINET  pfnfcignc,
PFNFCISTATUS  pfnfcis 
)

Definition at line 1675 of file fci.c.

1680{
1681 FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1682
1683 if (!p_fci_internal) return FALSE;
1684
1685 if(!fci_flush_cabinet(p_fci_internal,fGetNextCab,pfnfcignc,pfnfcis)) return FALSE;
1686
1687 while( p_fci_internal->files_size>0 ||
1688 p_fci_internal->placed_files_size>0 ) {
1689 if(!fci_flush_cabinet(p_fci_internal,fGetNextCab,pfnfcignc,pfnfcis)) return FALSE;
1690 }
1691
1692 return TRUE;
1693}

Referenced by create_cab_file(), create_cc_test_files(), and test_FDICopy().

◆ FCIFlushFolder()

BOOL __cdecl FCIFlushFolder ( HFCI  hfci,
PFNFCIGETNEXTCABINET  pfnfcignc,
PFNFCISTATUS  pfnfcis 
)

Definition at line 1631 of file fci.c.

1635{
1636 FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1637
1638 if (!p_fci_internal) return FALSE;
1639 return fci_flush_folder(p_fci_internal,FALSE,pfnfcignc,pfnfcis);
1640}
static BOOL fci_flush_folder(FCI_Int *p_fci_internal, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1071

Referenced by FCIAddFile().