ReactOS  0.4.15-dev-316-g938df97
CDFParser Class Reference

#include <dfp.h>

Inheritance diagram for CDFParser:
Collaboration diagram for CDFParser:

Public Member Functions

 CDFParser ()
 
virtual ~CDFParser ()
 
ULONG Load (char *FileName)
 
ULONG Parse ()
 
void SetFileRelativePath (char *Path)
 
- Public Member Functions inherited from CCabinet
 CCabinet ()
 
virtual ~CCabinet ()
 
bool IsSeparator (char Char)
 
charConvertPath (char *Path, bool Allocate)
 
charGetFileName (char *Path)
 
void RemoveFileName (char *Path)
 
bool NormalizePath (char *Path, ULONG Length)
 
charGetCabinetName ()
 
void SetCabinetName (char *FileName)
 
void SetDestinationPath (char *DestinationPath)
 
bool SetCabinetReservedFile (char *FileName)
 
charGetCabinetReservedFile ()
 
charGetDestinationPath ()
 
ULONG GetCurrentDiskNumber ()
 
ULONG Open ()
 
void Close ()
 
ULONG FindFirst (PCAB_SEARCH Search)
 
ULONG FindNext (PCAB_SEARCH Search)
 
ULONG ExtractFile (char *FileName)
 
void SelectCodec (LONG Id)
 
bool IsCodecSelected ()
 
ULONG AddSearchCriteria (char *SearchCriteria)
 
void DestroySearchCriteria ()
 
bool HasSearchCriteria ()
 
bool CreateSimpleCabinet ()
 
bool SetCompressionCodec (char *CodecName)
 
ULONG NewCabinet ()
 
ULONG NewDisk ()
 
ULONG NewFolder ()
 
ULONG WriteFileToScratchStorage (PCFFILE_NODE FileNode)
 
ULONG WriteDisk (ULONG MoreDisks)
 
ULONG CommitDisk (ULONG MoreDisks)
 
ULONG CloseDisk ()
 
ULONG CloseCabinet ()
 
ULONG AddFile (char *FileName)
 
void SetMaxDiskSize (ULONG Size)
 
virtual bool OnOverwrite (PCFFILE Entry, char *FileName)
 
virtual void OnExtract (PCFFILE Entry, char *FileName)
 
virtual void OnDiskChange (char *CabinetName, char *DiskLabel)
 
virtual void OnAdd (PCFFILE Entry, char *FileName)
 

Public Attributes

bool InfFileOnly
 
bool DontGenerateInf
 
char FileRelativePath [300]
 

Private Member Functions

virtual bool OnDiskLabel (ULONG Number, char *Label)
 
virtual bool OnCabinetName (ULONG Number, char *Name)
 
void WriteInfLine (char *InfLine)
 
bool SetDiskName (PCABINET_NAME *List, ULONG Number, char *String)
 
bool GetDiskName (PCABINET_NAME *List, ULONG Number, char *String)
 
bool SetDiskNumber (PDISK_NUMBER *List, ULONG Number, ULONG Value)
 
bool GetDiskNumber (PDISK_NUMBER *List, ULONG Number, PULONG Value)
 
bool DoDiskLabel (ULONG Number, char *Label)
 
void DoDiskLabelTemplate (char *Template)
 
bool DoCabinetName (ULONG Number, char *Name)
 
void DoCabinetNameTemplate (char *Template)
 
void DoInfFileName (char *InfFileName)
 
ULONG DoMaxDiskSize (bool NumberValid, ULONG Number)
 
ULONG SetupNewDisk ()
 
ULONG PerformSetCommand ()
 
ULONG PerformNewCommand ()
 
ULONG PerformInfBeginCommand ()
 
ULONG PerformInfEndCommand ()
 
ULONG PerformCommand ()
 
ULONG PerformFileCopy ()
 
void SkipSpaces ()
 
bool IsNextToken (DFP_TOKEN Token, bool NoSpaces)
 
bool ReadLine ()
 
void NextToken ()
 

Private Attributes

bool FileLoaded
 
FILEFileHandle
 
charFileBuffer
 
ULONG FileBufferSize
 
ULONG CurrentOffset
 
char Line [PATH_MAX+6]
 
ULONG LineLength
 
ULONG CurrentLine
 
ULONG CurrentChar
 
DFP_TOKEN CurrentToken
 
ULONG CurrentInteger
 
char CurrentString [256]
 
bool CabinetCreated
 
bool DiskCreated
 
bool FolderCreated
 
bool Cabinet
 
ULONG CabinetFileCountThreshold
 
PCABINET_NAME CabinetName
 
bool CabinetNameTemplateSet
 
char CabinetNameTemplate [128]
 
bool InfFileNameSet
 
char InfFileName [256]
 
bool Compress
 
ULONG CompressionType
 
PCABINET_NAME DiskLabel
 
bool DiskLabelTemplateSet
 
char DiskLabelTemplate [128]
 
ULONG FolderFileCountThreshold
 
ULONG FolderSizeThreshold
 
ULONG MaxCabinetSize
 
ULONG MaxDiskFileCount
 
PDISK_NUMBER MaxDiskSize
 
bool MaxDiskSizeAllSet
 
ULONG MaxDiskSizeAll
 
ULONG ReservePerCabinetSize
 
ULONG ReservePerDataBlockSize
 
ULONG ReservePerFolderSize
 
char SourceDir [256]
 
FILEInfFileHandle
 
bool InfModeEnabled
 

Detailed Description

Definition at line 62 of file dfp.h.

Constructor & Destructor Documentation

◆ CDFParser()

CDFParser::CDFParser ( )

Definition at line 22 of file dfp.cxx.

26 {
27  InfFileOnly = false;
28  DontGenerateInf = false;
29 
30  FileBuffer = NULL;
31  FileLoaded = false;
32  CurrentOffset = 0;
33  CurrentLine = 0;
34  CabinetCreated = false;
35  DiskCreated = false;
36  FolderCreated = false;
37  CabinetName = NULL;
38  DiskLabel = NULL;
39  MaxDiskSize = NULL;
40 
41  MaxDiskSizeAllSet = false;
42  CabinetNameTemplateSet = false;
43  DiskLabelTemplateSet = false;
44  InfFileNameSet = false;
45 
46  InfModeEnabled = false;
48 
50 }
PCABINET_NAME CabinetName
Definition: dfp.h:122
ULONG CurrentOffset
Definition: dfp.h:105
bool FolderCreated
Definition: dfp.h:118
bool MaxDiskSizeAllSet
Definition: dfp.h:137
bool DontGenerateInf
Definition: dfp.h:71
bool InfFileNameSet
Definition: dfp.h:125
PDISK_NUMBER MaxDiskSize
Definition: dfp.h:136
bool DiskLabelTemplateSet
Definition: dfp.h:130
ULONG CurrentLine
Definition: dfp.h:108
bool CabinetCreated
Definition: dfp.h:116
bool CabinetNameTemplateSet
Definition: dfp.h:123
smooth NULL
Definition: ftsmooth.c:416
bool InfFileOnly
Definition: dfp.h:70
char FileRelativePath[300]
Definition: dfp.h:72
bool FileLoaded
Definition: dfp.h:101
bool InfModeEnabled
Definition: dfp.h:144
char * FileBuffer
Definition: dfp.h:103
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
bool DiskCreated
Definition: dfp.h:117
FILE * InfFileHandle
Definition: dfp.h:143
PCABINET_NAME DiskLabel
Definition: dfp.h:129

◆ ~CDFParser()

CDFParser::~CDFParser ( )
virtual

Definition at line 52 of file dfp.cxx.

56 {
57  PCABINET_NAME CNPrev;
58  PCABINET_NAME CNNext;
59  PDISK_NUMBER DNPrev;
60  PDISK_NUMBER DNNext;
61 
62  if (FileBuffer)
64  CNNext = CabinetName;
65  while (CNNext != NULL)
66  {
67  CNPrev = CNNext->Next;
68  free(CNNext);
69  CNNext = CNPrev;
70  }
71  CNNext = DiskLabel;
72  while (CNNext != NULL)
73  {
74  CNPrev = CNNext->Next;
75  free(CNNext);
76  CNNext = CNPrev;
77  }
78  DNNext = MaxDiskSize;
79  while (DNNext != NULL)
80  {
81  DNPrev = DNNext->Next;
82  free(DNNext);
83  DNNext = DNPrev;
84  }
85 
86  if (InfFileHandle != NULL)
88 }
PCABINET_NAME CabinetName
Definition: dfp.h:122
#define free
Definition: debug_ros.c:5
PDISK_NUMBER MaxDiskSize
Definition: dfp.h:136
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
char * FileBuffer
Definition: dfp.h:103
struct _DISK_NUMBER * Next
Definition: dfp.h:21
struct _CABINET_NAME * Next
Definition: dfp.h:14
FILE * InfFileHandle
Definition: dfp.h:143
PCABINET_NAME DiskLabel
Definition: dfp.h:129

Member Function Documentation

◆ DoCabinetName()

bool CDFParser::DoCabinetName ( ULONG  Number,
char Name 
)
private

Definition at line 639 of file dfp.cxx.

648 {
649  DPRINT(MID_TRACE, ("Setting name of cabinet (%u) to '%s'\n", (UINT)Number, Name));
650 
651  return SetDiskName(&CabinetName, Number, Name);
652 }
PCABINET_NAME CabinetName
Definition: dfp.h:122
#define MID_TRACE
Definition: debug.h:15
bool SetDiskName(PCABINET_NAME *List, ULONG Number, char *String)
Definition: dfp.cxx:477
void DPRINT(...)
Definition: polytest.cpp:61
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
unsigned int UINT
Definition: ndis.h:50

Referenced by PerformSetCommand().

◆ DoCabinetNameTemplate()

void CDFParser::DoCabinetNameTemplate ( char Template)
private

Definition at line 655 of file dfp.cxx.

661 {
662  DPRINT(MID_TRACE, ("Setting cabinet name template to '%s'\n", Template));
663 
664  strcpy(CabinetNameTemplate, Template);
665  CabinetNameTemplateSet = true;
666 }
#define MID_TRACE
Definition: debug.h:15
bool CabinetNameTemplateSet
Definition: dfp.h:123
void DPRINT(...)
Definition: polytest.cpp:61
char CabinetNameTemplate[128]
Definition: dfp.h:124
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by PerformSetCommand().

◆ DoDiskLabel()

bool CDFParser::DoDiskLabel ( ULONG  Number,
char Label 
)
private

Definition at line 609 of file dfp.cxx.

618 {
619  DPRINT(MID_TRACE, ("Setting label of disk (%u) to '%s'\n", (UINT)Number, Label));
620 
621  return SetDiskName(&DiskLabel, Number, Label);
622 }
#define MID_TRACE
Definition: debug.h:15
bool SetDiskName(PCABINET_NAME *List, ULONG Number, char *String)
Definition: dfp.cxx:477
void DPRINT(...)
Definition: polytest.cpp:61
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
unsigned int UINT
Definition: ndis.h:50
PWCHAR Label
Definition: format.c:70
PCABINET_NAME DiskLabel
Definition: dfp.h:129

Referenced by PerformSetCommand().

◆ DoDiskLabelTemplate()

void CDFParser::DoDiskLabelTemplate ( char Template)
private

Definition at line 625 of file dfp.cxx.

631 {
632  DPRINT(MID_TRACE, ("Setting disk label template to '%s'\n", Template));
633 
634  strcpy(DiskLabelTemplate, Template);
635  DiskLabelTemplateSet = true;
636 }
#define MID_TRACE
Definition: debug.h:15
bool DiskLabelTemplateSet
Definition: dfp.h:130
void DPRINT(...)
Definition: polytest.cpp:61
char DiskLabelTemplate[128]
Definition: dfp.h:131
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by PerformSetCommand().

◆ DoInfFileName()

void CDFParser::DoInfFileName ( char InfFileName)
private

Definition at line 773 of file dfp.cxx.

779 {
780  DPRINT(MID_TRACE, ("Setting .inf filename to '%s'\n", FileName));
781 
783  InfFileNameSet = true;
784 }
char InfFileName[256]
Definition: dfp.h:126
#define MID_TRACE
Definition: debug.h:15
bool InfFileNameSet
Definition: dfp.h:125
void DPRINT(...)
Definition: polytest.cpp:61
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by PerformSetCommand().

◆ DoMaxDiskSize()

ULONG CDFParser::DoMaxDiskSize ( bool  NumberValid,
ULONG  Number 
)
private

Definition at line 669 of file dfp.cxx.

680 {
681  ULONG A, B, Value;
682 
683  if (IsNextToken(TokenInteger, true))
684  {
685  A = CurrentInteger;
686 
687  if (IsNextToken(TokenPeriod, false))
688  {
689  if (!IsNextToken(TokenInteger, false))
690  return CAB_STATUS_FAILURE;
691 
692  B = CurrentInteger;
693 
694  }
695  else
696  B = 0;
697 
699  {
700  switch (CurrentString[0])
701  {
702  case 'K':
703  if (B != 0)
704  return CAB_STATUS_FAILURE;
705 
706  if (A == 720)
707  /* 720K disk */
708  Value = 730112;
709  else if (A == 360)
710  /* 360K disk */
711  Value = 362496;
712  else
713  return CAB_STATUS_FAILURE;
714  break;
715 
716  case 'M':
717  if (A == 1)
718  {
719  if (B == 44)
720  /* 1.44M disk */
721  Value = 1457664;
722  else if (B == 25)
723  /* 1.25M disk */
724  Value = 1300000; // FIXME: Value?
725  else if (B == 2)
726  /* 1.2M disk */
727  Value = 1213952;
728  else
729  return CAB_STATUS_FAILURE;
730  }
731  else if (A == 2)
732  {
733  if (B == 88)
734  /* 2.88M disk */
735  Value = 2915328;
736  else
737  return CAB_STATUS_FAILURE;
738  }
739  else
740  return CAB_STATUS_FAILURE;
741  break;
742 
743  default:
744  DPRINT(MID_TRACE, ("Bad suffix (%c)\n", CurrentString[0]));
745  return CAB_STATUS_FAILURE;
746  }
747  }
748  else
749  Value = A;
750  }
751  else
752  {
753  if ((CurrentToken != TokenString) &&
754  (strcasecmp(CurrentString, "CDROM") != 0))
755  return CAB_STATUS_FAILURE;
756  /* CDROM */
757  Value = 640*1024*1024; // FIXME: Correct size for CDROM?
758  }
759 
760  if (NumberValid)
763 
765  MaxDiskSizeAllSet = true;
766 
768 
769  return CAB_STATUS_SUCCESS;
770 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2373
bool SetDiskNumber(PDISK_NUMBER *List, ULONG Number, ULONG Value)
Definition: dfp.cxx:543
#define MID_TRACE
Definition: debug.h:15
#define strcasecmp
Definition: fake.h:9
bool MaxDiskSizeAllSet
Definition: dfp.h:137
ULONG CurrentInteger
Definition: dfp.h:112
PDISK_NUMBER MaxDiskSize
Definition: dfp.h:136
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces)
Definition: dfp.cxx:1183
#define A(row, col)
DFP_TOKEN CurrentToken
Definition: dfp.h:111
void SetMaxDiskSize(ULONG Size)
Definition: cabinet.cxx:1832
void DPRINT(...)
Definition: polytest.cpp:61
ULONG MaxDiskSizeAll
Definition: dfp.h:138
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
Definition: ttei1.cpp:12
char CurrentString[256]
Definition: dfp.h:113
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
#define B(row, col)
unsigned int ULONG
Definition: retypes.h:1

Referenced by PerformSetCommand().

◆ GetDiskName()

bool CDFParser::GetDiskName ( PCABINET_NAME List,
ULONG  Number,
char String 
)
private

Definition at line 515 of file dfp.cxx.

525 {
527 
528  CN = *List;
529  while (CN != NULL)
530  {
531  if (CN->DiskNumber == Number)
532  {
533  strcpy(String, CN->Name);
534  return true;
535  }
536  CN = CN->Next;
537  }
538 
539  return false;
540 }
static WCHAR String[]
Definition: stringtable.c:55
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY List
Definition: psmgr.c:57
#define CN(I, J, K)
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by OnCabinetName(), and OnDiskLabel().

◆ GetDiskNumber()

bool CDFParser::GetDiskNumber ( PDISK_NUMBER List,
ULONG  Number,
PULONG  Value 
)
private

Definition at line 581 of file dfp.cxx.

591 {
592  PDISK_NUMBER DN;
593 
594  DN = *List;
595  while (DN != NULL)
596  {
597  if (DN->DiskNumber == Number)
598  {
599  *Value = DN->Number;
600  return true;
601  }
602  DN = DN->Next;
603  }
604 
605  return false;
606 }
ULONG DiskNumber
Definition: dfp.h:22
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2373
smooth NULL
Definition: ftsmooth.c:416
ULONG Number
Definition: dfp.h:23
LIST_ENTRY List
Definition: psmgr.c:57
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
struct _DISK_NUMBER * Next
Definition: dfp.h:21

Referenced by SetupNewDisk().

◆ IsNextToken()

bool CDFParser::IsNextToken ( DFP_TOKEN  Token,
bool  NoSpaces 
)
private

Definition at line 1183 of file dfp.cxx.

1192 {
1193  if (NoSpaces)
1194  SkipSpaces();
1195  else
1196  NextToken();
1197  return (CurrentToken == Token);
1198 }
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
DFP_TOKEN CurrentToken
Definition: dfp.h:111
void NextToken()
Definition: dfp.cxx:1240
void SkipSpaces()
Definition: dfp.cxx:1172

Referenced by DoMaxDiskSize(), PerformNewCommand(), and PerformSetCommand().

◆ Load()

ULONG CDFParser::Load ( char FileName)

Definition at line 140 of file dfp.cxx.

148 {
149  LONG FileSize;
150 
151  if (FileLoaded)
152  return CAB_STATUS_SUCCESS;
153 
154  /* Open the directive file */
155  FileHandle = fopen(FileName, "rb");
156  if (FileHandle == NULL)
157  {
158  return CAB_STATUS_CANNOT_OPEN;
159  }
160 
162  if (FileSize == -1)
163  {
165  return CAB_STATUS_CANNOT_OPEN;
166  }
167 
169 
170  FileBuffer = (char*)malloc(FileBufferSize);
171  if (!FileBuffer)
172  {
174  return CAB_STATUS_NOMEMORY;
175  }
176 
177  if ( fread(FileBuffer, FileBufferSize, 1, FileHandle) < 1 )
178  {
180  free(FileBuffer);
181  FileBuffer = NULL;
182  return CAB_STATUS_CANNOT_READ;
183  }
184 
186 
187  FileLoaded = true;
188 
189  DPRINT(MAX_TRACE, ("File (%u bytes)\n", (UINT)FileBufferSize));
190 
191  return CAB_STATUS_SUCCESS;
192 }
#define CAB_STATUS_CANNOT_READ
Definition: cabinet.h:28
#define free
Definition: debug_ros.c:5
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
long LONG
Definition: pedump.c:60
ULONG FileBufferSize
Definition: dfp.h:104
#define CAB_STATUS_NOMEMORY
Definition: cabinet.h:25
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
FILE * FileHandle
Definition: dfp.h:102
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
bool FileLoaded
Definition: dfp.h:101
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
char * FileBuffer
Definition: dfp.h:103
#define MAX_TRACE
Definition: debug.h:16
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1
#define CAB_STATUS_CANNOT_OPEN
Definition: cabinet.h:26
#define malloc
Definition: debug_ros.c:4
LONG GetSizeOfFile(FILE *handle)
Definition: cabinet.h:44

Referenced by CCABManager::CreateCabinet().

◆ NextToken()

void CDFParser::NextToken ( )
private

Definition at line 1240 of file dfp.cxx.

1244 {
1245  ULONG i;
1246  char ch = ' ';
1247 
1248  if (CurrentChar >= LineLength)
1249  {
1251  return;
1252  }
1253 
1254  switch (Line[CurrentChar])
1255  {
1256  case ' ':
1257  case 0x09:
1259  break;
1260 
1261  case ';':
1263  break;
1264 
1265  case '=':
1267  break;
1268 
1269  case '.':
1271  break;
1272 
1273  case '\\':
1275  break;
1276 
1277  case '"':
1278  i = 0;
1279  while ((CurrentChar + i + 1 < LineLength) &&
1280  ((ch = Line[CurrentChar + i + 1]) != '"'))
1281  {
1282  CurrentString[i] = ch;
1283  i++;
1284  }
1285  CurrentString[i] = '\0';
1287  CurrentChar += i + 2;
1288  return;
1289 
1290  default:
1291  i = 0;
1292  while ((CurrentChar + i < LineLength) &&
1293  ((ch = Line[CurrentChar + i]) >= '0') && (ch <= '9'))
1294  {
1295  CurrentString[i] = ch;
1296  i++;
1297  }
1298  if (i > 0)
1299  {
1300  CurrentString[i] = '\0';
1303  CurrentChar += i;
1304  return;
1305  }
1306  i = 0;
1307  while (((CurrentChar + i < LineLength) &&
1308  (((ch = Line[CurrentChar + i]) >= 'a') && (ch <= 'z'))) ||
1309  ((ch >= 'A') && (ch <= 'Z')) || (ch == '_'))
1310  {
1311  CurrentString[i] = ch;
1312  i++;
1313  }
1314  if (i > 0)
1315  {
1316  CurrentString[i] = '\0';
1318  CurrentChar += i;
1319  return;
1320  }
1322  }
1323  CurrentChar++;
1324 }
ULONG CurrentInteger
Definition: dfp.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DFP_TOKEN CurrentToken
Definition: dfp.h:111
Definition: dfp.h:34
ULONG CurrentChar
Definition: dfp.h:109
Definition: ncftp.h:79
Definition: dfp.h:37
char CurrentString[256]
Definition: dfp.h:113
Definition: dfp.h:32
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
unsigned int ULONG
Definition: retypes.h:1
Definition: dfp.h:33
ULONG LineLength
Definition: dfp.h:107

Referenced by IsNextToken(), Parse(), PerformSetCommand(), ReadLine(), and SkipSpaces().

◆ OnCabinetName()

bool CDFParser::OnCabinetName ( ULONG  Number,
char Name 
)
privatevirtual

Reimplemented from CCabinet.

Definition at line 422 of file dfp.cxx.

431 {
432  char Buffer[PATH_MAX];
433  ULONG i;
434  int j;
435  char ch;
436 
437  Number += 1;
438 
439  DPRINT(MID_TRACE, ("Giving cabinet (%u) a name...\n", (UINT)Number));
440 
442  {
444  strcat(Name, Buffer);
445  return true;
446  }
447 
449  {
451  j = (LONG)strlen(Name);
452  for (i = 0; i < strlen(CabinetNameTemplate); i++)
453  {
454  ch = CabinetNameTemplate[i];
455  if (ch == '*')
456  {
457  sprintf(Buffer, "%u", (UINT)Number);
458  strcat(Name, Buffer);
459  j += (LONG)strlen(Buffer);
460  }
461  else
462  {
463  Name[j] = ch;
464  j++;
465  }
466  Name[j] = '\0';
467  }
468 
469  DPRINT(MID_TRACE, ("Giving cabinet (%s) as a name...\n", Name));
470  return true;
471  }
472  else
473  return false;
474 }
PCABINET_NAME CabinetName
Definition: dfp.h:122
#define MID_TRACE
Definition: debug.h:15
bool GetDiskName(PCABINET_NAME *List, ULONG Number, char *String)
Definition: dfp.cxx:515
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
bool CabinetNameTemplateSet
Definition: dfp.h:123
long LONG
Definition: pedump.c:60
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
char CabinetNameTemplate[128]
Definition: dfp.h:124
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define PATH_MAX
Definition: types.h:280
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
char * GetDestinationPath()
Definition: cabinet.cxx:381
unsigned int UINT
Definition: ndis.h:50
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1

◆ OnDiskLabel()

bool CDFParser::OnDiskLabel ( ULONG  Number,
char Label 
)
privatevirtual

Reimplemented from CCabinet.

Definition at line 370 of file dfp.cxx.

379 {
380  char Buffer[20];
381  ULONG i;
382  int j;
383  char ch;
384 
385  Number += 1;
386 
387  DPRINT(MID_TRACE, ("Giving disk (%u) a label...\n", (UINT)Number));
388 
390  return true;
391 
393  {
394  j = 0;
395  strcpy(Label, "");
396  for (i = 0; i < strlen(DiskLabelTemplate); i++)
397  {
398  ch = DiskLabelTemplate[i];
399  if (ch == '*')
400  {
401  sprintf(Buffer, "%u", (UINT)Number);
402  strcat(Label, Buffer);
403  j += (LONG)strlen(Buffer);
404  }
405  else
406  {
407  Label[j] = ch;
408  j++;
409  }
410  Label[j] = '\0';
411  }
412 
413  DPRINT(MID_TRACE, ("Giving disk (%s) as a label...\n", Label));
414 
415  return true;
416  }
417  else
418  return false;
419 }
#define MID_TRACE
Definition: debug.h:15
bool GetDiskName(PCABINET_NAME *List, ULONG Number, char *String)
Definition: dfp.cxx:515
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
bool DiskLabelTemplateSet
Definition: dfp.h:130
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
char DiskLabelTemplate[128]
Definition: dfp.h:131
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
unsigned int UINT
Definition: ndis.h:50
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
PWCHAR Label
Definition: format.c:70
PCABINET_NAME DiskLabel
Definition: dfp.h:129

◆ Parse()

ULONG CDFParser::Parse ( )

Definition at line 195 of file dfp.cxx.

201 {
202  bool Command;
203  ULONG Status;
204 
205  if (!FileLoaded)
206  return CAB_STATUS_NOFILE;
207 
208  while (ReadLine())
209  {
210  Command = false;
211 
212  if (InfModeEnabled)
213  {
214  bool WriteLine = true;
215  while (CurrentToken != TokenEnd)
216  {
217  switch (CurrentToken)
218  {
219  case TokenIdentifier:
220  if (Command)
221  {
222  /* Command */
224  if (Status == CAB_STATUS_FAILURE)
225  WriteLine = true;
226  else
227  if (!InfModeEnabled)
228  WriteLine = false;
229 
231  continue;
232  }
233  else
234  {
235  WriteLine = true;
237  continue;
238  }
239  break;
240 
241  case TokenSpace:
242  break;
243 
244  case TokenPeriod:
245  Command = true;
246  break;
247 
248  default:
249  WriteLine = true;
251  continue;
252  }
253  NextToken();
254  }
255  if (WriteLine)
257  }
258  else
259  {
260  while (CurrentToken != TokenEnd)
261  {
262  switch (CurrentToken)
263  {
264  case TokenInteger:
266  case TokenIdentifier:
267  case TokenString:
268  if (Command)
269  {
270  /* Command */
272 
273  if (Status == CAB_STATUS_FAILURE)
274  {
275  printf("ERROR: Directive file contains errors at line %u.\n", (UINT)CurrentLine);
276  DPRINT(MID_TRACE, ("Error while executing command.\n"));
277  }
278 
279  if (Status != CAB_STATUS_SUCCESS)
280  return Status;
281  }
282  else
283  {
284  /* File copy */
286 
287  if (Status != CAB_STATUS_SUCCESS)
288  {
289  printf("ERROR: Directive file contains errors at line %u.\n", (UINT)CurrentLine);
290  DPRINT(MID_TRACE, ("Error while copying file.\n"));
291  return Status;
292  }
293  }
294  break;
295 
296  case TokenSpace:
297  break;
298 
299  case TokenSemi:
301  continue;
302 
303  case TokenPeriod:
304  Command = true;
305  break;
306 
307  default:
308  printf("ERROR: Directive file contains errors at line %u.\n", (UINT)CurrentLine);
309  DPRINT(MID_TRACE, ("Token is (%u).\n", (UINT)CurrentToken));
310  return CAB_STATUS_SUCCESS;
311  }
312  NextToken();
313  }
314  }
315  }
316 
317  if (!InfFileOnly)
318  {
319  if (CABMgr.IsVerbose())
320  {
321  printf("Writing cabinet. This may take a while...\n");
322  }
323 
324  if (DiskCreated)
325  {
326  Status = WriteDisk(false);
327  if (Status == CAB_STATUS_SUCCESS)
328  Status = CloseDisk();
329  if (Status != CAB_STATUS_SUCCESS)
330  {
331  DPRINT(MIN_TRACE, ("Cannot write disk (%u).\n", (UINT)Status));
332  return Status;
333  }
334  }
335 
336  if (CabinetCreated)
337  {
338  Status = CloseCabinet();
339  if (Status != CAB_STATUS_SUCCESS)
340  {
341  DPRINT(MIN_TRACE, ("Cannot close cabinet (%u).\n", (UINT)Status));
342  return Status;
343  }
344  }
345 
346  if (CABMgr.IsVerbose())
347  {
348  printf("Done.\n");
349  }
350  }
351 
352  return CAB_STATUS_SUCCESS;
353 }
ULONG PerformCommand()
Definition: dfp.cxx:1011
#define MID_TRACE
Definition: debug.h:15
ULONG CloseCabinet()
Definition: cabinet.cxx:1575
ULONG CurrentInteger
Definition: dfp.h:112
CCABManager CABMgr
Definition: main.cxx:658
bool IsVerbose()
Definition: cabman.h:28
Definition: shell.h:41
void WriteLine(char *pchLine, FILE *fileOut)
Definition: hpp.c:194
#define sprintf(buf, format,...)
Definition: sprintf.c:55
ULONG CurrentLine
Definition: dfp.h:108
void WriteInfLine(char *InfLine)
Definition: dfp.cxx:90
DFP_TOKEN CurrentToken
Definition: dfp.h:111
bool CabinetCreated
Definition: dfp.h:116
void DPRINT(...)
Definition: polytest.cpp:61
bool InfFileOnly
Definition: dfp.h:70
struct Command Command
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
void NextToken()
Definition: dfp.cxx:1240
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
ULONG PerformFileCopy()
Definition: dfp.cxx:1031
Definition: ncftp.h:79
Definition: dfp.h:37
char CurrentString[256]
Definition: dfp.h:113
bool FileLoaded
Definition: dfp.h:101
bool ReadLine()
Definition: dfp.cxx:1201
Status
Definition: gdiplustypes.h:24
bool InfModeEnabled
Definition: dfp.h:144
Definition: dfp.h:32
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
Definition: dfp.h:33
bool DiskCreated
Definition: dfp.h:117
ULONG CloseDisk()
Definition: cabinet.cxx:1557
#define CAB_STATUS_NOFILE
Definition: cabinet.h:32
ULONG WriteDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1402
#define printf
Definition: config.h:203

Referenced by CCABManager::CreateCabinet().

◆ PerformCommand()

ULONG CDFParser::PerformCommand ( )
private

Definition at line 1011 of file dfp.cxx.

1017 {
1018  if (strcasecmp(CurrentString, "Set") == 0)
1019  return PerformSetCommand();
1020  if (strcasecmp(CurrentString, "New") == 0)
1021  return PerformNewCommand();
1022  if (strcasecmp(CurrentString, "InfBegin") == 0)
1023  return PerformInfBeginCommand();
1024  if (strcasecmp(CurrentString, "InfEnd") == 0)
1025  return PerformInfEndCommand();
1026 
1027  return CAB_STATUS_FAILURE;
1028 }
ULONG PerformNewCommand()
Definition: dfp.cxx:904
#define strcasecmp
Definition: fake.h:9
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
ULONG PerformInfBeginCommand()
Definition: dfp.cxx:987
char CurrentString[256]
Definition: dfp.h:113
ULONG PerformInfEndCommand()
Definition: dfp.cxx:999
ULONG PerformSetCommand()
Definition: dfp.cxx:808

Referenced by Parse().

◆ PerformFileCopy()

ULONG CDFParser::PerformFileCopy ( )
private

Definition at line 1031 of file dfp.cxx.

1037 {
1038  ULONG Status;
1039  ULONG i, j;
1040  char ch;
1041  char SrcName[PATH_MAX];
1042  char DstName[PATH_MAX];
1043  char InfLine[PATH_MAX];
1044  char Options[128];
1045  char BaseFilename[PATH_MAX];
1046 
1047  *SrcName = '\0';
1048  *DstName = '\0';
1049  *Options = '\0';
1050 
1051  // source file
1052  i = CurrentChar;
1053  while ((i < LineLength) &&
1054  ((ch = Line[i]) != ' ') &&
1055  (ch != 0x09) &&
1056  (ch != ';'))
1057  {
1058  CurrentString[i] = ch;
1059  i++;
1060  }
1061  CurrentString[i] = '\0';
1063  CurrentChar = i + 1;
1064  strcpy(BaseFilename, CurrentString);
1065  strcat(SrcName, BaseFilename);
1066 
1067  // destination
1068  SkipSpaces();
1069 
1070  if (CurrentToken != TokenEnd)
1071  {
1072  j = (ULONG)strlen(CurrentString); i = 0;
1073  while ((CurrentChar + i < LineLength) &&
1074  ((ch = Line[CurrentChar + i]) != ' ') &&
1075  (ch != 0x09) &&
1076  (ch != ';'))
1077  {
1078  CurrentString[j + i] = ch;
1079  i++;
1080  }
1081  CurrentString[j + i] = '\0';
1083  CurrentChar += i + 1;
1084  strcpy(DstName, CurrentString);
1085  }
1086 
1087  // options (it may be empty)
1088  SkipSpaces ();
1089 
1090  if (CurrentToken != TokenEnd)
1091  {
1092  j = (ULONG)strlen(CurrentString); i = 0;
1093  while ((CurrentChar + i < LineLength) &&
1094  ((ch = Line[CurrentChar + i]) != ' ') &&
1095  (ch != 0x09) &&
1096  (ch != ';'))
1097  {
1098  CurrentString[j + i] = ch;
1099  i++;
1100  }
1101  CurrentString[j + i] = '\0';
1103  CurrentChar += i + 1;
1105  }
1106 
1107  if (!CabinetCreated)
1108  {
1109  DPRINT(MID_TRACE, ("Creating cabinet.\n"));
1110 
1111  Status = NewCabinet();
1112  if (Status != CAB_STATUS_SUCCESS)
1113  {
1114  DPRINT(MIN_TRACE, ("Cannot create cabinet (%u).\n", (UINT)Status));
1115  printf("ERROR: Cannot create cabinet.\n");
1116  return CAB_STATUS_FAILURE;
1117  }
1118  CabinetCreated = true;
1119 
1120  DPRINT(MID_TRACE, ("Creating disk.\n"));
1121 
1122  Status = NewDisk();
1123  if (Status != CAB_STATUS_SUCCESS)
1124  {
1125  DPRINT(MIN_TRACE, ("Cannot create disk (%u).\n", (UINT)Status));
1126  printf("ERROR: Cannot create disk.\n");
1127  return CAB_STATUS_FAILURE;
1128  }
1129  DiskCreated = true;
1130  SetupNewDisk();
1131  }
1132 
1133  DPRINT(MID_TRACE, ("Adding file: '%s' destination: '%s'.\n", SrcName, DstName));
1134 
1135  Status = AddFile(SrcName);
1137  {
1138  strcpy(SrcName, FileRelativePath);
1139  strcat(SrcName, BaseFilename);
1140  Status = AddFile(SrcName);
1141  }
1142  switch (Status)
1143  {
1144  case CAB_STATUS_SUCCESS:
1145  sprintf(InfLine, "%s=%s", GetFileName(SrcName), DstName);
1146  WriteInfLine(InfLine);
1147  break;
1148 
1150  if (strstr(Options,"optional"))
1151  {
1153  printf("Optional file skipped (does not exist): %s.\n", SrcName);
1154  }
1155  else
1156  printf("ERROR: File not found: %s.\n", SrcName);
1157 
1158  break;
1159 
1160  case CAB_STATUS_NOMEMORY:
1161  printf("ERROR: Insufficient memory to add file: %s.\n", SrcName);
1162  break;
1163 
1164  default:
1165  printf("ERROR: Cannot add file: %s (%u).\n", SrcName, (UINT)Status);
1166  break;
1167  }
1168  return Status;
1169 }
#define MID_TRACE
Definition: debug.h:15
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ULONG AddFile(char *FileName)
Definition: cabinet.cxx:1613
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ULONG NewCabinet()
Definition: cabinet.cxx:1148
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
enum OPTION_FLAGS Options
Definition: stats.c:44
ULONG SetupNewDisk()
Definition: dfp.cxx:786
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void WriteInfLine(char *InfLine)
Definition: dfp.cxx:90
DFP_TOKEN CurrentToken
Definition: dfp.h:111
bool CabinetCreated
Definition: dfp.h:116
char * GetFileName(char *Path)
Definition: cabinet.cxx:183
#define CAB_STATUS_NOMEMORY
Definition: cabinet.h:25
void DPRINT(...)
Definition: polytest.cpp:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
ULONG CurrentChar
Definition: dfp.h:109
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
#define PATH_MAX
Definition: types.h:280
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
Definition: ncftp.h:79
Definition: dfp.h:37
char FileRelativePath[300]
Definition: dfp.h:72
char CurrentString[256]
Definition: dfp.h:113
Status
Definition: gdiplustypes.h:24
unsigned int UINT
Definition: ndis.h:50
ULONG NewDisk()
Definition: cabinet.cxx:1219
void SkipSpaces()
Definition: dfp.cxx:1172
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define CAB_STATUS_CANNOT_OPEN
Definition: cabinet.h:26
ULONG LineLength
Definition: dfp.h:107
bool DiskCreated
Definition: dfp.h:117
#define printf
Definition: config.h:203

Referenced by Parse().

◆ PerformInfBeginCommand()

ULONG CDFParser::PerformInfBeginCommand ( )
private

Definition at line 987 of file dfp.cxx.

993 {
994  InfModeEnabled = true;
995  return CAB_STATUS_SUCCESS;
996 }
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
bool InfModeEnabled
Definition: dfp.h:144

Referenced by PerformCommand().

◆ PerformInfEndCommand()

ULONG CDFParser::PerformInfEndCommand ( )
private

Definition at line 999 of file dfp.cxx.

1005 {
1006  InfModeEnabled = false;
1007  return CAB_STATUS_SUCCESS;
1008 }
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
bool InfModeEnabled
Definition: dfp.h:144

Referenced by PerformCommand().

◆ PerformNewCommand()

ULONG CDFParser::PerformNewCommand ( )
private

Definition at line 904 of file dfp.cxx.

910 {
911  NEWTYPE NewType;
912  ULONG Status;
913 
914  if (!IsNextToken(TokenIdentifier, true))
915  return CAB_STATUS_FAILURE;
916 
917  if (strcasecmp(CurrentString, "Disk") == 0)
918  NewType = ntDisk;
919  else if (strcasecmp(CurrentString, "Cabinet") == 0)
920  NewType = ntCabinet;
921  else if (strcasecmp(CurrentString, "Folder") == 0)
922  NewType = ntFolder;
923  else
924  return CAB_STATUS_FAILURE;
925 
926  switch (NewType)
927  {
928  case ntDisk:
929  if (DiskCreated)
930  {
931  Status = WriteDisk(true);
932  if (Status == CAB_STATUS_SUCCESS)
933  Status = CloseDisk();
934  if (Status != CAB_STATUS_SUCCESS)
935  {
936  DPRINT(MIN_TRACE, ("Cannot write disk (%u).\n", (UINT)Status));
937  return CAB_STATUS_SUCCESS;
938  }
939  DiskCreated = false;
940  }
941 
942  Status = NewDisk();
943  if (Status != CAB_STATUS_SUCCESS)
944  {
945  DPRINT(MIN_TRACE, ("Cannot create disk (%u).\n", (UINT)Status));
946  return CAB_STATUS_SUCCESS;
947  }
948  DiskCreated = true;
949  SetupNewDisk();
950  return CAB_STATUS_SUCCESS;
951 
952  case ntCabinet:
953  if (DiskCreated)
954  {
955  Status = WriteDisk(true);
956  if (Status == CAB_STATUS_SUCCESS)
957  Status = CloseDisk();
958  if (Status != CAB_STATUS_SUCCESS)
959  {
960  DPRINT(MIN_TRACE, ("Cannot write disk (%u).\n", (UINT)Status));
961  return CAB_STATUS_SUCCESS;
962  }
963  DiskCreated = false;
964  }
965 
966  Status = NewCabinet();
967  if (Status != CAB_STATUS_SUCCESS)
968  {
969  DPRINT(MIN_TRACE, ("Cannot create cabinet (%u).\n", (UINT)Status));
970  return CAB_STATUS_SUCCESS;
971  }
972  DiskCreated = true;
973  SetupNewDisk();
974  return CAB_STATUS_SUCCESS;
975 
976  case ntFolder:
977  Status = NewFolder();
979  return CAB_STATUS_SUCCESS;
980 
981  default:
982  return CAB_STATUS_FAILURE;
983  }
984 }
Definition: dfp.h:56
#define strcasecmp
Definition: fake.h:9
ULONG NewCabinet()
Definition: cabinet.cxx:1148
Definition: dfp.h:55
ULONG SetupNewDisk()
Definition: dfp.cxx:786
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces)
Definition: dfp.cxx:1183
void DPRINT(...)
Definition: polytest.cpp:61
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
ULONG NewFolder()
Definition: cabinet.cxx:1243
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
char CurrentString[256]
Definition: dfp.h:113
Status
Definition: gdiplustypes.h:24
NEWTYPE
Definition: dfp.h:52
unsigned int UINT
Definition: ndis.h:50
ULONG NewDisk()
Definition: cabinet.cxx:1219
Definition: dfp.h:54
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
bool DiskCreated
Definition: dfp.h:117
ULONG CloseDisk()
Definition: cabinet.cxx:1557
ULONG WriteDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1402

Referenced by PerformCommand().

◆ PerformSetCommand()

ULONG CDFParser::PerformSetCommand ( )
private

Definition at line 808 of file dfp.cxx.

814 {
815  SETTYPE SetType;
816  bool NumberValid = false;
817  ULONG Number = 0;
818 
819  if (!IsNextToken(TokenIdentifier, true))
820  return CAB_STATUS_FAILURE;
821 
822  if (strcasecmp(CurrentString, "DiskLabel") == 0)
823  SetType = stDiskLabel;
824  else if (strcasecmp(CurrentString, "DiskLabelTemplate") == 0)
825  SetType = stDiskLabelTemplate;
826  else if (strcasecmp(CurrentString, "CabinetName") == 0)
827  SetType = stCabinetName;
828  else if (strcasecmp(CurrentString, "CabinetNameTemplate") == 0)
829  SetType = stCabinetNameTemplate;
830  else if (strcasecmp(CurrentString, "MaxDiskSize") == 0)
831  SetType = stMaxDiskSize;
832  else if (strcasecmp(CurrentString, "InfFileName") == 0)
833  SetType = stInfFileName;
834  else
835  return CAB_STATUS_FAILURE;
836 
837  if ((SetType == stDiskLabel) || (SetType == stCabinetName))
838  {
839  if (!IsNextToken(TokenInteger, false))
840  return CAB_STATUS_FAILURE;
842 
843  if (!IsNextToken(TokenEqual, true))
844  return CAB_STATUS_FAILURE;
845  }
846  else if (SetType == stMaxDiskSize)
847  {
848  if (IsNextToken(TokenInteger, false))
849  {
850  NumberValid = true;
852  }
853  else
854  {
855  NumberValid = false;
856  while (CurrentToken == TokenSpace)
857  NextToken();
858  if (CurrentToken != TokenEqual)
859  return CAB_STATUS_FAILURE;
860  }
861  }
862  else if (!IsNextToken(TokenEqual, true))
863  return CAB_STATUS_FAILURE;
864 
865  if (SetType != stMaxDiskSize)
866  {
867  if (!IsNextToken(TokenString, true))
868  return CAB_STATUS_FAILURE;
869  }
870 
871  switch (SetType)
872  {
873  case stDiskLabel:
875  DPRINT(MIN_TRACE, ("Not enough available free memory.\n"));
876  return CAB_STATUS_SUCCESS;
877 
878  case stCabinetName:
880  DPRINT(MIN_TRACE, ("Not enough available free memory.\n"));
881  return CAB_STATUS_SUCCESS;
882 
883  case stDiskLabelTemplate:
885  return CAB_STATUS_SUCCESS;
886 
889  return CAB_STATUS_SUCCESS;
890 
891  case stMaxDiskSize:
892  return DoMaxDiskSize(NumberValid, Number);
893 
894  case stInfFileName:
896  return CAB_STATUS_SUCCESS;
897 
898  default:
899  return CAB_STATUS_FAILURE;
900  }
901 }
void DoCabinetNameTemplate(char *Template)
Definition: dfp.cxx:655
#define strcasecmp
Definition: fake.h:9
ULONG CurrentInteger
Definition: dfp.h:112
bool DoCabinetName(ULONG Number, char *Name)
Definition: dfp.cxx:639
void DoDiskLabelTemplate(char *Template)
Definition: dfp.cxx:625
bool IsNextToken(DFP_TOKEN Token, bool NoSpaces)
Definition: dfp.cxx:1183
DFP_TOKEN CurrentToken
Definition: dfp.h:111
SETTYPE
Definition: dfp.h:41
void DPRINT(...)
Definition: polytest.cpp:61
Definition: dfp.h:34
ULONG DoMaxDiskSize(bool NumberValid, ULONG Number)
Definition: dfp.cxx:669
#define CAB_STATUS_FAILURE
Definition: cabinet.h:24
void NextToken()
Definition: dfp.cxx:1240
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
char CurrentString[256]
Definition: dfp.h:113
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
Definition: dfp.h:32
bool DoDiskLabel(ULONG Number, char *Label)
Definition: dfp.cxx:609
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
void DoInfFileName(char *InfFileName)
Definition: dfp.cxx:773

Referenced by PerformCommand().

◆ ReadLine()

bool CDFParser::ReadLine ( )
private

Definition at line 1201 of file dfp.cxx.

1207 {
1208  ULONG i, j;
1209  char ch;
1210 
1212  return false;
1213 
1214  i = 0;
1215  while (((j = CurrentOffset + i) < FileBufferSize) && (i < sizeof(Line) - 1) &&
1216  ((ch = FileBuffer[j]) != 0x0D && (ch = FileBuffer[j]) != 0x0A))
1217  {
1218  Line[i] = ch;
1219  i++;
1220  }
1221 
1222  Line[i] = '\0';
1223  LineLength = i;
1224 
1225  if ((FileBuffer[CurrentOffset + i] == 0x0D) && (FileBuffer[CurrentOffset + i + 1] == 0x0A))
1226  CurrentOffset++;
1227 
1228  CurrentOffset += i + 1;
1229 
1230  CurrentChar = 0;
1231 
1232  CurrentLine++;
1233 
1234  NextToken();
1235 
1236  return true;
1237 }
ULONG CurrentOffset
Definition: dfp.h:105
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG CurrentLine
Definition: dfp.h:108
ULONG FileBufferSize
Definition: dfp.h:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
ULONG CurrentChar
Definition: dfp.h:109
void NextToken()
Definition: dfp.cxx:1240
Definition: ncftp.h:79
char * FileBuffer
Definition: dfp.h:103
unsigned int ULONG
Definition: retypes.h:1
ULONG LineLength
Definition: dfp.h:107

Referenced by Parse().

◆ SetDiskName()

bool CDFParser::SetDiskName ( PCABINET_NAME List,
ULONG  Number,
char String 
)
private

Definition at line 477 of file dfp.cxx.

487 {
489 
490  CN = *List;
491  while (CN != NULL)
492  {
493  if (CN->DiskNumber == Number)
494  {
495  strcpy(CN->Name, String);
496  return true;
497  }
498  CN = CN->Next;
499  }
500 
501  CN = (PCABINET_NAME)malloc(sizeof(CABINET_NAME));
502  if (!CN)
503  return false;
504 
505  CN->DiskNumber = Number;
506  strcpy(CN->Name, String);
507 
508  CN->Next = *List;
509  *List = CN;
510 
511  return true;
512 }
static WCHAR String[]
Definition: stringtable.c:55
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY List
Definition: psmgr.c:57
#define CN(I, J, K)
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
struct _CABINET_NAME * PCABINET_NAME
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define malloc
Definition: debug_ros.c:4

Referenced by DoCabinetName(), and DoDiskLabel().

◆ SetDiskNumber()

bool CDFParser::SetDiskNumber ( PDISK_NUMBER List,
ULONG  Number,
ULONG  Value 
)
private

Definition at line 543 of file dfp.cxx.

553 {
554  PDISK_NUMBER DN;
555 
556  DN = *List;
557  while (DN != NULL)
558  {
559  if (DN->DiskNumber == Number)
560  {
561  DN->Number = Value;
562  return true;
563  }
564  DN = DN->Next;
565  }
566 
567  DN = (PDISK_NUMBER)malloc(sizeof(DISK_NUMBER));
568  if (!DN)
569  return false;
570 
571  DN->DiskNumber = Number;
572  DN->Number = Value;
573 
574  DN->Next = *List;
575  *List = DN;
576 
577  return true;
578 }
ULONG DiskNumber
Definition: dfp.h:22
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2373
struct _DISK_NUMBER * PDISK_NUMBER
smooth NULL
Definition: ftsmooth.c:416
ULONG Number
Definition: dfp.h:23
LIST_ENTRY List
Definition: psmgr.c:57
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
#define malloc
Definition: debug_ros.c:4
struct _DISK_NUMBER * Next
Definition: dfp.h:21

Referenced by DoMaxDiskSize().

◆ SetFileRelativePath()

void CDFParser::SetFileRelativePath ( char Path)

Definition at line 356 of file dfp.cxx.

362 {
365  if (strlen(FileRelativePath) > 0)
367 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define PATH_MAX
Definition: types.h:280
char FileRelativePath[300]
Definition: dfp.h:72
PRTL_UNICODE_STRING_BUFFER Path
bool NormalizePath(char *Path, ULONG Length)
Definition: cabinet.cxx:225
char * ConvertPath(char *Path, bool Allocate)
Definition: cabinet.cxx:142
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by CCABManager::ParseCmdline().

◆ SetupNewDisk()

ULONG CDFParser::SetupNewDisk ( )
private

Definition at line 786 of file dfp.cxx.

792 {
793  ULONG Value;
794 
796  {
797  if (MaxDiskSizeAllSet)
799  else
800  Value = 0;
801  }
803 
804  return CAB_STATUS_SUCCESS;
805 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2373
bool MaxDiskSizeAllSet
Definition: dfp.h:137
PDISK_NUMBER MaxDiskSize
Definition: dfp.h:136
void SetMaxDiskSize(ULONG Size)
Definition: cabinet.cxx:1832
ULONG MaxDiskSizeAll
Definition: dfp.h:138
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
bool GetDiskNumber(PDISK_NUMBER *List, ULONG Number, PULONG Value)
Definition: dfp.cxx:581
unsigned int ULONG
Definition: retypes.h:1
ULONG GetCurrentDiskNumber()
Definition: cabinet.cxx:460

Referenced by PerformFileCopy(), and PerformNewCommand().

◆ SkipSpaces()

void CDFParser::SkipSpaces ( )
private

Definition at line 1172 of file dfp.cxx.

1176 {
1177  NextToken();
1178  while (CurrentToken == TokenSpace)
1179  NextToken();
1180 }
DFP_TOKEN CurrentToken
Definition: dfp.h:111
void NextToken()
Definition: dfp.cxx:1240
Definition: dfp.h:32

Referenced by IsNextToken(), and PerformFileCopy().

◆ WriteInfLine()

void CDFParser::WriteInfLine ( char InfLine)
private

Definition at line 90 of file dfp.cxx.

91 {
92  char buf[PATH_MAX];
93  char eolbuf[2];
94  char* destpath;
95 
96  if (DontGenerateInf)
97  return;
98 
99  if (InfFileHandle == NULL)
100  {
101  if (!InfFileNameSet)
102  /* FIXME: Use cabinet name with extension .inf */
103  return;
104 
105  destpath = GetDestinationPath();
106  if (strlen(destpath) > 0)
107  {
108  strcpy(buf, destpath);
110  }
111  else
113 
114  /* Create .inf file, overwrite if it already exists */
115  InfFileHandle = fopen(buf, "wb");
116  if (InfFileHandle == NULL)
117  {
118  DPRINT(MID_TRACE, ("Error creating INF file.\n"));
119  return;
120  }
121  }
122 
123  if (fwrite(InfLine, strlen(InfLine), 1, InfFileHandle) < 1)
124  {
125  DPRINT(MID_TRACE, ("Error writing INF file.\n"));
126  return;
127  }
128 
129  eolbuf[0] = 0x0d;
130  eolbuf[1] = 0x0a;
131 
132  if (fwrite(eolbuf, sizeof(eolbuf), 1, InfFileHandle) < 1)
133  {
134  DPRINT(MID_TRACE, ("Error writing INF file.\n"));
135  return;
136  }
137 }
char InfFileName[256]
Definition: dfp.h:126
#define MID_TRACE
Definition: debug.h:15
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
bool DontGenerateInf
Definition: dfp.h:71
bool InfFileNameSet
Definition: dfp.h:125
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define PATH_MAX
Definition: types.h:280
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
char * GetDestinationPath()
Definition: cabinet.cxx:381
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
FILE * InfFileHandle
Definition: dfp.h:143

Referenced by Parse(), and PerformFileCopy().

Member Data Documentation

◆ Cabinet

bool CDFParser::Cabinet
private

Definition at line 120 of file dfp.h.

◆ CabinetCreated

bool CDFParser::CabinetCreated
private

Definition at line 116 of file dfp.h.

Referenced by CDFParser(), Parse(), and PerformFileCopy().

◆ CabinetFileCountThreshold

ULONG CDFParser::CabinetFileCountThreshold
private

Definition at line 121 of file dfp.h.

◆ CabinetName

PCABINET_NAME CDFParser::CabinetName
private

Definition at line 122 of file dfp.h.

Referenced by CDFParser(), DoCabinetName(), OnCabinetName(), CCABManager::OnDiskChange(), and ~CDFParser().

◆ CabinetNameTemplate

char CDFParser::CabinetNameTemplate[128]
private

Definition at line 124 of file dfp.h.

Referenced by DoCabinetNameTemplate(), and OnCabinetName().

◆ CabinetNameTemplateSet

bool CDFParser::CabinetNameTemplateSet
private

Definition at line 123 of file dfp.h.

Referenced by CDFParser(), DoCabinetNameTemplate(), and OnCabinetName().

◆ Compress

bool CDFParser::Compress
private

Definition at line 127 of file dfp.h.

◆ CompressionType

ULONG CDFParser::CompressionType
private

Definition at line 128 of file dfp.h.

◆ CurrentChar

ULONG CDFParser::CurrentChar
private

Definition at line 109 of file dfp.h.

Referenced by NextToken(), PerformFileCopy(), and ReadLine().

◆ CurrentInteger

ULONG CDFParser::CurrentInteger
private

Definition at line 112 of file dfp.h.

Referenced by DoMaxDiskSize(), NextToken(), Parse(), and PerformSetCommand().

◆ CurrentLine

ULONG CDFParser::CurrentLine
private

Definition at line 108 of file dfp.h.

Referenced by CDFParser(), Parse(), and ReadLine().

◆ CurrentOffset

ULONG CDFParser::CurrentOffset
private

Definition at line 105 of file dfp.h.

Referenced by CDFParser(), and ReadLine().

◆ CurrentString

char CDFParser::CurrentString[256]
private

◆ CurrentToken

DFP_TOKEN CDFParser::CurrentToken
private

◆ DiskCreated

bool CDFParser::DiskCreated
private

Definition at line 117 of file dfp.h.

Referenced by CDFParser(), Parse(), PerformFileCopy(), and PerformNewCommand().

◆ DiskLabel

PCABINET_NAME CDFParser::DiskLabel
private

Definition at line 129 of file dfp.h.

Referenced by CDFParser(), DoDiskLabel(), CCABManager::OnDiskChange(), OnDiskLabel(), and ~CDFParser().

◆ DiskLabelTemplate

char CDFParser::DiskLabelTemplate[128]
private

Definition at line 131 of file dfp.h.

Referenced by DoDiskLabelTemplate(), and OnDiskLabel().

◆ DiskLabelTemplateSet

bool CDFParser::DiskLabelTemplateSet
private

Definition at line 130 of file dfp.h.

Referenced by CDFParser(), DoDiskLabelTemplate(), and OnDiskLabel().

◆ DontGenerateInf

bool CDFParser::DontGenerateInf

Definition at line 71 of file dfp.h.

Referenced by CDFParser(), CCABManager::ParseCmdline(), and WriteInfLine().

◆ FileBuffer

char* CDFParser::FileBuffer
private

Definition at line 103 of file dfp.h.

Referenced by CDFParser(), Load(), ReadLine(), and ~CDFParser().

◆ FileBufferSize

ULONG CDFParser::FileBufferSize
private

Definition at line 104 of file dfp.h.

Referenced by Load(), and ReadLine().

◆ FileHandle

FILE* CDFParser::FileHandle
private

Definition at line 102 of file dfp.h.

Referenced by Load().

◆ FileLoaded

bool CDFParser::FileLoaded
private

Definition at line 101 of file dfp.h.

Referenced by CDFParser(), Load(), and Parse().

◆ FileRelativePath

char CDFParser::FileRelativePath[300]

Definition at line 72 of file dfp.h.

Referenced by CDFParser(), PerformFileCopy(), and SetFileRelativePath().

◆ FolderCreated

bool CDFParser::FolderCreated
private

Definition at line 118 of file dfp.h.

Referenced by CDFParser().

◆ FolderFileCountThreshold

ULONG CDFParser::FolderFileCountThreshold
private

Definition at line 132 of file dfp.h.

◆ FolderSizeThreshold

ULONG CDFParser::FolderSizeThreshold
private

Definition at line 133 of file dfp.h.

◆ InfFileHandle

FILE* CDFParser::InfFileHandle
private

Definition at line 143 of file dfp.h.

Referenced by CDFParser(), WriteInfLine(), and ~CDFParser().

◆ InfFileName

char CDFParser::InfFileName[256]
private

Definition at line 126 of file dfp.h.

Referenced by DoInfFileName(), and WriteInfLine().

◆ InfFileNameSet

bool CDFParser::InfFileNameSet
private

Definition at line 125 of file dfp.h.

Referenced by CDFParser(), DoInfFileName(), and WriteInfLine().

◆ InfFileOnly

bool CDFParser::InfFileOnly

Definition at line 70 of file dfp.h.

Referenced by CCABManager::CCABManager(), CDFParser(), Parse(), and CCABManager::ParseCmdline().

◆ InfModeEnabled

bool CDFParser::InfModeEnabled
private

Definition at line 144 of file dfp.h.

Referenced by CDFParser(), Parse(), PerformInfBeginCommand(), and PerformInfEndCommand().

◆ Line

char CDFParser::Line[PATH_MAX+6]
private

Definition at line 106 of file dfp.h.

◆ LineLength

ULONG CDFParser::LineLength
private

Definition at line 107 of file dfp.h.

Referenced by NextToken(), PerformFileCopy(), and ReadLine().

◆ MaxCabinetSize

ULONG CDFParser::MaxCabinetSize
private

Definition at line 134 of file dfp.h.

◆ MaxDiskFileCount

ULONG CDFParser::MaxDiskFileCount
private

Definition at line 135 of file dfp.h.

◆ MaxDiskSize

PDISK_NUMBER CDFParser::MaxDiskSize
private

Definition at line 136 of file dfp.h.

Referenced by CDFParser(), DoMaxDiskSize(), SetupNewDisk(), and ~CDFParser().

◆ MaxDiskSizeAll

ULONG CDFParser::MaxDiskSizeAll
private

Definition at line 138 of file dfp.h.

Referenced by DoMaxDiskSize(), and SetupNewDisk().

◆ MaxDiskSizeAllSet

bool CDFParser::MaxDiskSizeAllSet
private

Definition at line 137 of file dfp.h.

Referenced by CDFParser(), DoMaxDiskSize(), and SetupNewDisk().

◆ ReservePerCabinetSize

ULONG CDFParser::ReservePerCabinetSize
private

Definition at line 139 of file dfp.h.

◆ ReservePerDataBlockSize

ULONG CDFParser::ReservePerDataBlockSize
private

Definition at line 140 of file dfp.h.

◆ ReservePerFolderSize

ULONG CDFParser::ReservePerFolderSize
private

Definition at line 141 of file dfp.h.

◆ SourceDir

char CDFParser::SourceDir[256]
private

Definition at line 142 of file dfp.h.


The documentation for this class was generated from the following files: