ReactOS  r76032
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 oflag
 
typedef int int pmode
 
typedef int int interr
 
typedef int int int voidpv
 
typedef voidmemory
 
typedef void UINT cb
 
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 dist
 
typedef LONG int seektype
 
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

typedef INT_PTR (__cdecl *PFNFCIOPEN)(char *pszFile
 
typedef UINT (__cdecl *PFNFCIREAD)(INT_PTR hf
 
typedef LONG (__cdecl *PFNFCISEEK)(INT_PTR hf
 
typedef int (__cdecl *PFNFCIDELETE)(char *pszFile
 
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

#define _A_EXEC   0x40

Definition at line 135 of file fci.h.

Referenced by add_file_data().

#define _A_NAME_IS_UTF   0x80

Definition at line 131 of file fci.h.

#define CB_MAX_CAB_PATH   256

Definition at line 56 of file fci.h.

Referenced by write_cabinet().

#define CB_MAX_CABINET_NAME   256

Definition at line 55 of file fci.h.

Referenced by fci_flush_cabinet(), fci_flush_folder(), FCIAddFile(), FCICreate(), and write_cabinet().

#define CB_MAX_CHUNK   32768U

Definition at line 52 of file fci.h.

#define CB_MAX_DISK   0x7fffffffL

Definition at line 53 of file fci.h.

#define CB_MAX_DISK_NAME   256

Definition at line 57 of file fci.h.

Referenced by fci_flush_cabinet(), fci_flush_folder(), FCIAddFile(), and FCICreate().

#define CB_MAX_FILENAME   256

Definition at line 54 of file fci.h.

Referenced by create_temp_file(), FCIAddFile(), and write_files().

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

Definition at line 92 of file fci.h.

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

Definition at line 95 of file fci.h.

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

Definition at line 89 of file fci.h.

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

Definition at line 167 of file fci.h.

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

Definition at line 182 of file fci.h.

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

Definition at line 188 of file fci.h.

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

Definition at line 200 of file fci.h.

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

Definition at line 170 of file fci.h.

#define FNFCIGETNEXTCABINET (   fn)
Value:
BOOL __cdecl fn(PCCAB pccab, \
ULONG cbPrevCab, \
void *pv)
#define __cdecl
Definition: accygwin.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
Definition: fci.h:144
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD void * pv
Definition: msvc.h:87
unsigned int ULONG
Definition: retypes.h:1

Definition at line 191 of file fci.h.

#define FNFCIGETOPENINFO (   fn)
Value:
INT_PTR __cdecl fn(char *pszName, \
USHORT *pdate, \
USHORT *ptime, \
USHORT *pattribs, \
int *err, \
void *pv)
#define __cdecl
Definition: accygwin.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
int32_t INT_PTR
Definition: typedefs.h:62
int int int * err
Definition: fci.h:172
DWORD void * pv
Definition: msvc.h:87
unsigned short USHORT
Definition: pedump.c:61

Definition at line 212 of file fci.h.

#define FNFCIGETTEMPFILE (   fn)
Value:
BOOL __cdecl fn(char *pszTempName, \
int cbTempName, \
void *pv)
#define __cdecl
Definition: accygwin.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD void * pv
Definition: msvc.h:87

Definition at line 235 of file fci.h.

#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.

#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.

#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.

#define FNFCISTATUS (   fn)
Value:
LONG __cdecl fn(UINT typeStatus, \
ULONG cb1, \
ULONG cb2, \
void *pv)
#define __cdecl
Definition: accygwin.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
long LONG
Definition: pedump.c:60
DWORD void * pv
Definition: msvc.h:87
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1

Definition at line 227 of file fci.h.

#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.

#define INCLUDED_TYPES_FCI_FDI   1

Definition at line 31 of file fci.h.

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

Definition at line 103 of file fci.h.

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

Definition at line 221 of file fci.h.

Referenced by write_cabinet().

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

Definition at line 219 of file fci.h.

Referenced by add_data_block().

#define statusFolder   1 /* Add Folder to Cabinet callback */
#define tcompBAD   0x000F /* Unspecified compression type */

Definition at line 68 of file fci.h.

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

Definition at line 106 of file fci.h.

#define TCOMPfromTypeLevelMemory (   t,
  l,
  m 
)
Value:
( t ))
#define tcompSHIFT_QUANTUM_LEVEL
Definition: fci.h:78
GLdouble GLdouble t
Definition: gl.h:2047
#define tcompSHIFT_QUANTUM_MEM
Definition: fci.h:83
r l[0]
Definition: byte_order.h:167
CONST GLfloat m[16]
Definition: m_xform.h:144

Definition at line 98 of file fci.h.

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

Definition at line 72 of file fci.h.

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

Definition at line 71 of file fci.h.

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

Definition at line 70 of file fci.h.

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

Definition at line 75 of file fci.h.

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

Definition at line 80 of file fci.h.

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

Definition at line 85 of file fci.h.

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

Definition at line 63 of file fci.h.

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

Definition at line 77 of file fci.h.

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

Definition at line 76 of file fci.h.

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

Definition at line 82 of file fci.h.

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

Definition at line 81 of file fci.h.

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

Definition at line 73 of file fci.h.

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

Definition at line 78 of file fci.h.

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

Definition at line 83 of file fci.h.

#define tcompTYPE_LZX   0x0003 /* LZX */

Definition at line 67 of file fci.h.

#define tcompTYPE_MSZIP   0x0001 /* MSZIP */

Definition at line 65 of file fci.h.

Referenced by add_file(), create_cab_file(), and FCIAddFile().

#define tcompTYPE_NONE   0x0000 /* No compression */

Definition at line 64 of file fci.h.

Referenced by create_cc_test_files(), and FCIAddFile().

#define tcompTYPE_QUANTUM   0x0002 /* Quantum */

Definition at line 66 of file fci.h.

Typedef Documentation

static void * __WINE_ALLOC_SIZE
inline

Definition at line 166 of file fci.h.

typedef void UINT cb

Definition at line 175 of file fci.h.

typedef ULONG CHECKSUM

Definition at line 37 of file fci.h.

typedef ULONG COFF

Definition at line 40 of file fci.h.

typedef LONG dist

Definition at line 184 of file fci.h.

typedef int * err

Definition at line 172 of file fci.h.

typedef void* HFCI

Definition at line 140 of file fci.h.

typedef void* memory

Definition at line 175 of file fci.h.

typedef int oflag

Definition at line 172 of file fci.h.

typedef struct CCAB * PCCAB
typedef struct ERF * PERF
typedef int(__cdecl * PFNFCICLOSE)(INT_PTR hf, int *err, void *pv)

Definition at line 181 of file fci.h.

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

Definition at line 195 of file fci.h.

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

Definition at line 169 of file fci.h.

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

Definition at line 190 of file fci.h.

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.

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

Definition at line 232 of file fci.h.

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

Definition at line 223 of file fci.h.

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

Definition at line 178 of file fci.h.

typedef int int pmode

Definition at line 172 of file fci.h.

typedef int void* pv

Definition at line 172 of file fci.h.

typedef LONG int seektype

Definition at line 184 of file fci.h.

typedef unsigned short TCOMP

Definition at line 61 of file fci.h.

typedef ULONG UOFF

Definition at line 39 of file fci.h.

Enumeration Type Documentation

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.

Function Documentation

BOOL __cdecl FCIAddFile ( HFCI  ,
char ,
char ,
BOOL  ,
PFNFCIGETNEXTCABINET  ,
PFNFCISTATUS  ,
PFNFCIGETOPENINFO  ,
TCOMP   
)

Definition at line 1385 of file fci.c.

Referenced by add_file().

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

Definition at line 986 of file fci.c.

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

1000 {
1001  FCI_Int *p_fci_internal;
1002 
1003  if (!perf) {
1005  return NULL;
1006  }
1007  if ((!pfnalloc) || (!pfnfree) || (!pfnopen) || (!pfnread) ||
1008  (!pfnwrite) || (!pfnclose) || (!pfnseek) || (!pfndelete) ||
1009  (!pfnfcigtf) || (!pccab)) {
1010  perf->erfOper = FCIERR_NONE;
1011  perf->erfType = ERROR_BAD_ARGUMENTS;
1012  perf->fError = TRUE;
1013 
1015  return NULL;
1016  }
1017 
1018  if (!((p_fci_internal = pfnalloc(sizeof(FCI_Int))))) {
1019  perf->erfOper = FCIERR_ALLOC_FAIL;
1020  perf->erfType = ERROR_NOT_ENOUGH_MEMORY;
1021  perf->fError = TRUE;
1022 
1024  return NULL;
1025  }
1026 
1027  memset(p_fci_internal, 0, sizeof(FCI_Int));
1028  p_fci_internal->magic = FCI_INT_MAGIC;
1029  p_fci_internal->perf = perf;
1030  p_fci_internal->fileplaced = pfnfiledest;
1031  p_fci_internal->alloc = pfnalloc;
1032  p_fci_internal->free = pfnfree;
1033  p_fci_internal->open = pfnopen;
1034  p_fci_internal->read = pfnread;
1035  p_fci_internal->write = pfnwrite;
1036  p_fci_internal->close = pfnclose;
1037  p_fci_internal->seek = pfnseek;
1038  p_fci_internal->delete = pfndelete;
1039  p_fci_internal->gettemp = pfnfcigtf;
1040  p_fci_internal->ccab = *pccab;
1041  p_fci_internal->pccab = pccab;
1042  p_fci_internal->pv = pv;
1043  p_fci_internal->data.handle = -1;
1044  p_fci_internal->compress = compress_NONE;
1045 
1046  list_init( &p_fci_internal->folders_list );
1047  list_init( &p_fci_internal->files_list );
1048  list_init( &p_fci_internal->blocks_list );
1049 
1050  memcpy(p_fci_internal->szPrevCab, pccab->szCab, CB_MAX_CABINET_NAME);
1051  memcpy(p_fci_internal->szPrevDisk, pccab->szDisk, CB_MAX_DISK_NAME);
1052 
1053  return (HFCI)p_fci_internal;
1054 }
PFNFCISEEK seek
Definition: fci.c:144
#define TRUE
Definition: types.h:120
PFNFCIDELETE delete
Definition: fci.c:145
PFNFCIALLOC alloc
Definition: fci.c:138
unsigned int magic
Definition: fci.c:135
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232
CCAB ccab
Definition: fci.c:147
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PFNFCIFREE free
Definition: fci.c:139
char szPrevDisk[CB_MAX_DISK_NAME]
Definition: fci.c:157
Definition: fci.c:133
smooth NULL
Definition: ftsmooth.c:557
struct list folders_list
Definition: fci.c:170
PFNFCIFILEPLACED fileplaced
Definition: fci.c:137
cab_UWORD(* compress)(struct FCI_Int *)
Definition: fci.c:179
#define SetLastError(x)
Definition: compat.h:409
#define FCI_INT_MAGIC
Definition: fci.c:182
static cab_UWORD compress_NONE(FCI_Int *fci)
Definition: fci.c:894
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD void * pv
Definition: msvc.h:87
#define CB_MAX_DISK_NAME
Definition: fci.h:57
PFNFCIGETTEMPFILE gettemp
Definition: fci.c:146
#define CB_MAX_CABINET_NAME
Definition: fci.h:55
PFNFCIREAD read
Definition: fci.c:141
struct temp_file data
Definition: fci.c:167
char szPrevCab[CB_MAX_CABINET_NAME]
Definition: fci.c:156
PFNFCIWRITE write
Definition: fci.c:142
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
PFNFCIOPEN open
Definition: fci.c:140
PFNFCICLOSE close
Definition: fci.c:143
struct list blocks_list
Definition: fci.c:172
struct list files_list
Definition: fci.c:171
void * pv
Definition: fci.c:155
#define memset(x, y, z)
Definition: compat.h:39
PCCAB pccab
Definition: fci.c:148
PERF perf
Definition: fci.c:136
BOOL __cdecl FCIDestroy ( HFCI  hfci)

Definition at line 1697 of file fci.c.

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

1698 {
1699  struct folder *folder, *folder_next;
1700  struct file *file, *file_next;
1701  struct data_block *block, *block_next;
1702  FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1703 
1704  if (!p_fci_internal) return FALSE;
1705 
1706  /* before hfci can be removed all temporary files must be closed */
1707  /* and deleted */
1708  p_fci_internal->magic = 0;
1709 
1710  LIST_FOR_EACH_ENTRY_SAFE( folder, folder_next, &p_fci_internal->folders_list, struct folder, entry )
1711  {
1712  free_folder( p_fci_internal, folder );
1713  }
1714  LIST_FOR_EACH_ENTRY_SAFE( file, file_next, &p_fci_internal->files_list, struct file, entry )
1715  {
1716  free_file( p_fci_internal, file );
1717  }
1718  LIST_FOR_EACH_ENTRY_SAFE( block, block_next, &p_fci_internal->blocks_list, struct data_block, entry )
1719  {
1720  free_data_block( p_fci_internal, block );
1721  }
1722 
1723  close_temp_file( p_fci_internal, &p_fci_internal->data );
1724 
1725  /* hfci can now be removed */
1726  p_fci_internal->free(hfci);
1727  return TRUE;
1728 }
static unsigned int block
Definition: xmlmemory.c:118
#define TRUE
Definition: types.h:120
Definition: fci.c:103
unsigned int magic
Definition: fci.c:135
uint8_t entry
Definition: isohybrid.c:63
PFNFCIFREE free
Definition: fci.c:139
Definition: fci.c:133
#define FALSE
Definition: types.h:117
struct CFFOLDER folder
Definition: fdi.c:110
struct list folders_list
Definition: fci.c:170
static void free_folder(FCI_Int *fci, struct folder *folder)
Definition: fci.c:405
const char file[]
Definition: icontest.c:11
static void free_data_block(FCI_Int *fci, struct data_block *block)
Definition: fci.c:378
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static void free_file(FCI_Int *fci, struct file *file)
Definition: fci.c:294
struct temp_file data
Definition: fci.c:167
static FCI_Int * get_fci_ptr(HFCI hfci)
Definition: fci.c:192
struct list blocks_list
Definition: fci.c:172
struct list files_list
Definition: fci.c:171
static BOOL close_temp_file(FCI_Int *fci, struct temp_file *file)
Definition: fci.c:239
Definition: fci.c:114
BOOL __cdecl FCIFlushCabinet ( HFCI  ,
BOOL  ,
PFNFCIGETNEXTCABINET  ,
PFNFCISTATUS   
)

Definition at line 1663 of file fci.c.

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

1668 {
1669  FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1670 
1671  if (!p_fci_internal) return FALSE;
1672 
1673  if(!fci_flush_cabinet(p_fci_internal,fGetNextCab,pfnfcignc,pfnfcis)) return FALSE;
1674 
1675  while( p_fci_internal->files_size>0 ||
1676  p_fci_internal->placed_files_size>0 ) {
1677  if(!fci_flush_cabinet(p_fci_internal,fGetNextCab,pfnfcignc,pfnfcis)) return FALSE;
1678  }
1679 
1680  return TRUE;
1681 }
#define TRUE
Definition: types.h:120
static BOOL fci_flush_cabinet(FCI_Int *p_fci_internal, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1219
cab_ULONG placed_files_size
Definition: fci.c:175
cab_ULONG files_size
Definition: fci.c:174
Definition: fci.c:133
#define FALSE
Definition: types.h:117
static FCI_Int * get_fci_ptr(HFCI hfci)
Definition: fci.c:192
BOOL __cdecl FCIFlushFolder ( HFCI  ,
PFNFCIGETNEXTCABINET  ,
PFNFCISTATUS   
)

Definition at line 1619 of file fci.c.

Referenced by FCIAddFile().

1623 {
1624  FCI_Int *p_fci_internal = get_fci_ptr( hfci );
1625 
1626  if (!p_fci_internal) return FALSE;
1627  return fci_flush_folder(p_fci_internal,FALSE,pfnfcignc,pfnfcis);
1628 }
Definition: fci.c:133
#define FALSE
Definition: types.h:117
static BOOL fci_flush_folder(FCI_Int *p_fci_internal, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1059
static FCI_Int * get_fci_ptr(HFCI hfci)
Definition: fci.c:192
typedef int ( __cdecl PFNFCIDELETE)
typedef INT_PTR ( __cdecl PFNFCIOPEN)
typedef LONG ( __cdecl PFNFCISEEK)
typedef UINT ( __cdecl PFNFCIREAD)