ReactOS  0.4.15-dev-1197-g8081ba9
cabinet.h File Reference
#include <typedefs.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <string>
#include <list>
Include dependency graph for cabinet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CFHEADER
 
struct  _CFFOLDER
 
struct  _CFFILE
 
struct  _CFDATA
 
struct  _CFDATA_NODE
 
struct  _CFFOLDER_NODE
 
struct  _CFFILE_NODE
 
struct  _SEARCH_CRITERIA
 
struct  _CAB_SEARCH
 
class  CCABCodec
 
class  CCabinet
 

Macros

#define PATH_MAX   MAX_PATH
 
#define C_ASSERT(expr)   extern char (*c_assert(void)) [(expr) ? 1 : -1]
 
#define DIR_SEPARATOR_CHAR   '/'
 
#define DIR_SEPARATOR_STRING   "/"
 
#define NORMAL_MASK   0x000000FF
 
#define SPECIAL_MASK   0xFFFFFF00
 
#define MIN_TRACE   0x00000001
 
#define MID_TRACE   0x00000002
 
#define MAX_TRACE   0x00000003
 
#define DEBUG_MEMORY   0x00000100
 
#define DPRINT(_t_, _x_)   do { } while(0)
 
#define ASSERT(_x_)
 
#define CAB_SIGNATURE   0x4643534D
 
#define CAB_VERSION   0x0103
 
#define CAB_BLOCKSIZE   32768
 
#define CAB_COMP_MASK   0x00FF
 
#define CAB_COMP_NONE   0x0000
 
#define CAB_COMP_MSZIP   0x0001
 
#define CAB_COMP_QUANTUM   0x0002
 
#define CAB_COMP_LZX   0x0003
 
#define CAB_FLAG_HASPREV   0x0001
 
#define CAB_FLAG_HASNEXT   0x0002
 
#define CAB_FLAG_RESERVE   0x0004
 
#define CAB_ATTRIB_READONLY   0x0001
 
#define CAB_ATTRIB_HIDDEN   0x0002
 
#define CAB_ATTRIB_SYSTEM   0x0004
 
#define CAB_ATTRIB_VOLUME   0x0008
 
#define CAB_ATTRIB_DIRECTORY   0x0010
 
#define CAB_ATTRIB_ARCHIVE   0x0020
 
#define CAB_ATTRIB_EXECUTE   0x0040
 
#define CAB_ATTRIB_UTF_NAME   0x0080
 
#define CAB_FILE_MAX_FOLDER   0xFFFC
 
#define CAB_FILE_CONTINUED   0xFFFD
 
#define CAB_FILE_SPLIT   0xFFFE
 
#define CAB_FILE_PREV_NEXT   0xFFFF
 
#define CAB_STATUS_SUCCESS   0x00000000
 
#define CAB_STATUS_FAILURE   0x00000001
 
#define CAB_STATUS_NOMEMORY   0x00000002
 
#define CAB_STATUS_CANNOT_OPEN   0x00000003
 
#define CAB_STATUS_CANNOT_CREATE   0x00000004
 
#define CAB_STATUS_CANNOT_READ   0x00000005
 
#define CAB_STATUS_CANNOT_WRITE   0x00000006
 
#define CAB_STATUS_FILE_EXISTS   0x00000007
 
#define CAB_STATUS_INVALID_CAB   0x00000008
 
#define CAB_STATUS_NOFILE   0x00000009
 
#define CAB_STATUS_UNSUPPCOMP   0x0000000A
 
#define CS_SUCCESS   0x0000 /* All data consumed */
 
#define CS_NOMEMORY   0x0001 /* Not enough free memory */
 
#define CS_BADSTREAM   0x0002 /* Bad data stream */
 
#define CAB_CODEC_RAW   0x00
 
#define CAB_CODEC_LZX   0x01
 
#define CAB_CODEC_MSZIP   0x02
 

Typedefs

typedef struct _CFHEADER CFHEADER
 
typedef struct _CFHEADERPCFHEADER
 
typedef struct _CFFOLDER CFFOLDER
 
typedef struct _CFFOLDERPCFFOLDER
 
typedef struct _CFFILE CFFILE
 
typedef struct _CFFILEPCFFILE
 
typedef struct _CFDATA CFDATA
 
typedef struct _CFDATAPCFDATA
 
typedef struct _CFDATA_NODE CFDATA_NODE
 
typedef struct _CFDATA_NODEPCFDATA_NODE
 
typedef struct _CFFOLDER_NODE CFFOLDER_NODE
 
typedef struct _CFFOLDER_NODEPCFFOLDER_NODE
 
typedef struct _CFFILE_NODE CFFILE_NODE
 
typedef struct _CFFILE_NODEPCFFILE_NODE
 
typedef struct _SEARCH_CRITERIA SEARCH_CRITERIA
 
typedef struct _SEARCH_CRITERIAPSEARCH_CRITERIA
 
typedef struct _CAB_SEARCH CAB_SEARCH
 
typedef struct _CAB_SEARCHPCAB_SEARCH
 

Functions

LONG GetSizeOfFile (FILE *handle)
 
 C_ASSERT (sizeof(CFFOLDER)==8)
 
 C_ASSERT (sizeof(CFFILE)==16)
 
 C_ASSERT (sizeof(CFDATA)==8)
 

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   _x_)

Definition at line 101 of file cabinet.h.

◆ C_ASSERT

#define C_ASSERT (   expr)    extern char (*c_assert(void)) [(expr) ? 1 : -1]

Definition at line 36 of file cabinet.h.

◆ CAB_ATTRIB_ARCHIVE

#define CAB_ATTRIB_ARCHIVE   0x0020

Definition at line 127 of file cabinet.h.

◆ CAB_ATTRIB_DIRECTORY

#define CAB_ATTRIB_DIRECTORY   0x0010

Definition at line 126 of file cabinet.h.

◆ CAB_ATTRIB_EXECUTE

#define CAB_ATTRIB_EXECUTE   0x0040

Definition at line 128 of file cabinet.h.

◆ CAB_ATTRIB_HIDDEN

#define CAB_ATTRIB_HIDDEN   0x0002

Definition at line 123 of file cabinet.h.

◆ CAB_ATTRIB_READONLY

#define CAB_ATTRIB_READONLY   0x0001

Definition at line 122 of file cabinet.h.

◆ CAB_ATTRIB_SYSTEM

#define CAB_ATTRIB_SYSTEM   0x0004

Definition at line 124 of file cabinet.h.

◆ CAB_ATTRIB_UTF_NAME

#define CAB_ATTRIB_UTF_NAME   0x0080

Definition at line 129 of file cabinet.h.

◆ CAB_ATTRIB_VOLUME

#define CAB_ATTRIB_VOLUME   0x0008

Definition at line 125 of file cabinet.h.

◆ CAB_BLOCKSIZE

#define CAB_BLOCKSIZE   32768

Definition at line 110 of file cabinet.h.

◆ CAB_CODEC_LZX

#define CAB_CODEC_LZX   0x01

Definition at line 298 of file cabinet.h.

◆ CAB_CODEC_MSZIP

#define CAB_CODEC_MSZIP   0x02

Definition at line 299 of file cabinet.h.

◆ CAB_CODEC_RAW

#define CAB_CODEC_RAW   0x00

Definition at line 297 of file cabinet.h.

◆ CAB_COMP_LZX

#define CAB_COMP_LZX   0x0003

Definition at line 116 of file cabinet.h.

◆ CAB_COMP_MASK

#define CAB_COMP_MASK   0x00FF

Definition at line 112 of file cabinet.h.

◆ CAB_COMP_MSZIP

#define CAB_COMP_MSZIP   0x0001

Definition at line 114 of file cabinet.h.

◆ CAB_COMP_NONE

#define CAB_COMP_NONE   0x0000

Definition at line 113 of file cabinet.h.

◆ CAB_COMP_QUANTUM

#define CAB_COMP_QUANTUM   0x0002

Definition at line 115 of file cabinet.h.

◆ CAB_FILE_CONTINUED

#define CAB_FILE_CONTINUED   0xFFFD

Definition at line 132 of file cabinet.h.

◆ CAB_FILE_MAX_FOLDER

#define CAB_FILE_MAX_FOLDER   0xFFFC

Definition at line 131 of file cabinet.h.

◆ CAB_FILE_PREV_NEXT

#define CAB_FILE_PREV_NEXT   0xFFFF

Definition at line 134 of file cabinet.h.

◆ CAB_FILE_SPLIT

#define CAB_FILE_SPLIT   0xFFFE

Definition at line 133 of file cabinet.h.

◆ CAB_FLAG_HASNEXT

#define CAB_FLAG_HASNEXT   0x0002

Definition at line 119 of file cabinet.h.

◆ CAB_FLAG_HASPREV

#define CAB_FLAG_HASPREV   0x0001

Definition at line 118 of file cabinet.h.

◆ CAB_FLAG_RESERVE

#define CAB_FLAG_RESERVE   0x0004

Definition at line 120 of file cabinet.h.

◆ CAB_SIGNATURE

#define CAB_SIGNATURE   0x4643534D

Definition at line 108 of file cabinet.h.

◆ CAB_STATUS_CANNOT_CREATE

#define CAB_STATUS_CANNOT_CREATE   0x00000004

Definition at line 258 of file cabinet.h.

◆ CAB_STATUS_CANNOT_OPEN

#define CAB_STATUS_CANNOT_OPEN   0x00000003

Definition at line 257 of file cabinet.h.

◆ CAB_STATUS_CANNOT_READ

#define CAB_STATUS_CANNOT_READ   0x00000005

Definition at line 259 of file cabinet.h.

◆ CAB_STATUS_CANNOT_WRITE

#define CAB_STATUS_CANNOT_WRITE   0x00000006

Definition at line 260 of file cabinet.h.

◆ CAB_STATUS_FAILURE

#define CAB_STATUS_FAILURE   0x00000001

Definition at line 255 of file cabinet.h.

◆ CAB_STATUS_FILE_EXISTS

#define CAB_STATUS_FILE_EXISTS   0x00000007

Definition at line 261 of file cabinet.h.

◆ CAB_STATUS_INVALID_CAB

#define CAB_STATUS_INVALID_CAB   0x00000008

Definition at line 262 of file cabinet.h.

◆ CAB_STATUS_NOFILE

#define CAB_STATUS_NOFILE   0x00000009

Definition at line 263 of file cabinet.h.

◆ CAB_STATUS_NOMEMORY

#define CAB_STATUS_NOMEMORY   0x00000002

Definition at line 256 of file cabinet.h.

◆ CAB_STATUS_SUCCESS

#define CAB_STATUS_SUCCESS   0x00000000

Definition at line 254 of file cabinet.h.

◆ CAB_STATUS_UNSUPPCOMP

#define CAB_STATUS_UNSUPPCOMP   0x0000000A

Definition at line 264 of file cabinet.h.

◆ CAB_VERSION

#define CAB_VERSION   0x0103

Definition at line 109 of file cabinet.h.

◆ CS_BADSTREAM

#define CS_BADSTREAM   0x0002 /* Bad data stream */

Definition at line 293 of file cabinet.h.

◆ CS_NOMEMORY

#define CS_NOMEMORY   0x0001 /* Not enough free memory */

Definition at line 292 of file cabinet.h.

◆ CS_SUCCESS

#define CS_SUCCESS   0x0000 /* All data consumed */

Definition at line 291 of file cabinet.h.

◆ DEBUG_MEMORY

#define DEBUG_MEMORY   0x00000100

Definition at line 71 of file cabinet.h.

◆ DIR_SEPARATOR_CHAR

#define DIR_SEPARATOR_CHAR   '/'

Definition at line 46 of file cabinet.h.

◆ DIR_SEPARATOR_STRING

#define DIR_SEPARATOR_STRING   "/"

Definition at line 47 of file cabinet.h.

◆ DPRINT

#define DPRINT (   _t_,
  _x_ 
)    do { } while(0)

Definition at line 98 of file cabinet.h.

◆ MAX_TRACE

#define MAX_TRACE   0x00000003

Definition at line 69 of file cabinet.h.

◆ MID_TRACE

#define MID_TRACE   0x00000002

Definition at line 68 of file cabinet.h.

◆ MIN_TRACE

#define MIN_TRACE   0x00000001

Definition at line 67 of file cabinet.h.

◆ NORMAL_MASK

#define NORMAL_MASK   0x000000FF

Definition at line 65 of file cabinet.h.

◆ PATH_MAX

#define PATH_MAX   MAX_PATH

Definition at line 32 of file cabinet.h.

◆ SPECIAL_MASK

#define SPECIAL_MASK   0xFFFFFF00

Definition at line 66 of file cabinet.h.

Typedef Documentation

◆ CAB_SEARCH

◆ CFDATA

◆ CFDATA_NODE

◆ CFFILE

◆ CFFILE_NODE

◆ CFFOLDER

◆ CFFOLDER_NODE

◆ CFHEADER

◆ PCAB_SEARCH

◆ PCFDATA

typedef struct _CFDATA * PCFDATA

◆ PCFDATA_NODE

◆ PCFFILE

typedef struct _CFFILE * PCFFILE

◆ PCFFILE_NODE

◆ PCFFOLDER

◆ PCFFOLDER_NODE

◆ PCFHEADER

◆ PSEARCH_CRITERIA

◆ SEARCH_CRITERIA

Function Documentation

◆ C_ASSERT() [1/3]

C_ASSERT ( sizeof(CFFOLDER = =8)

◆ C_ASSERT() [2/3]

C_ASSERT ( sizeof(CFFILE = =16)

◆ C_ASSERT() [3/3]

C_ASSERT ( sizeof(CFDATA = =8)

◆ GetSizeOfFile()

LONG GetSizeOfFile ( FILE handle)
inline

Definition at line 50 of file cabinet.h.

51 {
52  LONG size;
53  LONG currentPos = ftell(handle);
54 
55  if (fseek(handle, 0, SEEK_END) != 0)
56  return (LONG)-1;
57 
58  size = ftell(handle);
59  fseek(handle, 0, SEEK_SET);
60  return size;
61 }
long LONG
Definition: pedump.c:60
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
#define SEEK_SET
Definition: jmemansi.c:26
GLsizeiptr size
Definition: glext.h:5919
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
#define SEEK_END
Definition: cabinet.c:27

Referenced by CCabinet::AddFile(), CDFParser::Load(), and CCabinet::SetCabinetReservedFile().