1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/*** command.h - Definitions for Commands derived from a directives file
*
* Microsoft Confidential
* Copyright (C) Microsoft Corporation 1993-1994
* All Rights Reserved.
*
* Author:
* Benjamin W. Slivka
*
* History:
* 14-Aug-1993 bens Initial version
* 20-Aug-1993 bens Added new commands
* 22-Aug-1993 bens Added ctCOMMENT, fleshed out COMMAND structure
* 08-Feb-1994 bens Add details to COMMAND structure
* 10-Feb-1994 bens Added COMMAND asserts, more complete union
* 12-Mar-1994 bens Add .Dump and .Define directives
* 22-Apr-1994 bens Add list of parameters to cmd.file
* 25-Apr-1994 bens Add customizable INF stuff
* 02-May-1994 bens Removed commands we won't implement
* 03-Jun-1994 bens Add .Option command
*/
#ifndef INCLUDED_COMMAND
#define INCLUDED_COMMAND 1
#include "fileutil.h" // get cbFILE_NAME_MAX
#include "glist.h" // get generic list support
#include "variable.h" // get variable limits
//BUGBUG 25-Apr-1994 bens Copy definition to avoid nested include hell
//#include "inf.h" // Get cbINF_LINE_MAX
#define cbINF_LINE_MAX 512 // Maximum INF line length
/*** COMMANDTYPE - enumeration of parsed DDF commands
*
*/
typedef enum {
ctBAD, // bad command
ctCOMMENT, // a comment line
ctDEFINE, // Define
ctDELETE, // Delete
ctDUMP, // Dump
ctFILE, // a file specification
ctINF_BEGIN, // Begin INF lines
ctINF_END, // End INF lines
ctINF_WRITE, // Write a line to an area of the INF file
ctINF_WRITE_CAB, // InfWriteCabinet
ctINF_WRITE_DISK, // InfWriteDisk
ctOPTION, // Option
ctNEW, // New
ctREFERENCE, // an INF file reference
ctSET, // Set
} COMMANDTYPE; /* ct */
/*** NEWTYPE - modifier for ctNEW (.New command)
*
*/
typedef enum {
newBAD, // bad object
newFOLDER, // make a new folder
newCABINET, // make a new cabinet
newDISK, // make a new disk
} NEWTYPE; /* nt */
/*** OPTFLAGS - modifier for ctOPTION (.Option command)
*
*/
typedef unsigned short OPTFLAGS; /* of */
#define optEXPLICIT 0x0001 // .Option [No]Explicit
/*** INFAREA - modifier for ctINF_WRITE
*
*/
typedef enum {
infBAD, // bad INF area
infDISK, // Write to disk area of INF file
infCABINET, // Write to cabinet area of INF file
infFILE, // Write to file area of INF file
} INFAREA; /* inf */
#ifdef ASSERT
#define sigCOMMAND MAKESIG('C','M','D','$') // COMMAND signature
#define AssertCmd(pcmd) AssertStructure(pcmd,sigCOMMAND);
#else // !ASSERT
#define AssertCmd(pcmd)
#endif // !ASSERT
typedef struct {
#ifdef ASSERT
SIGNATURE sig; // structure signature sigCOMMAND
#endif
COMMANDTYPE ct; // Command to perform
union {
struct cmdDiskLabel { // .DiskLabel
int nDisk; // Disk number (0 if not specified)
char *pszLabel; // Name printed on sticky disk label
} label;
struct cmdDelete { // .Delete
char achVarName[cbVAR_NAME_MAX]; // Variable name
} delete;
struct cmdFile { // {Copy File Command}
char achSrc[cbFILE_NAME_MAX]; // Source file name
char achDst[cbFILE_NAME_MAX]; // Destination (or NULL)
HGENLIST hglist; // List of /X=Y parameters
BOOL fRunFlag; // Run upon extraction
} file;
struct cmdInfWrite {
INFAREA inf; // Area of INF to write to
char achLine[cbINF_LINE_MAX]; // Line to write to INF
} inf;
struct cmdNew {
NEWTYPE nt; // Type of object boundary
} new;
struct cmdOption {
OPTFLAGS of; // Option flags
OPTFLAGS ofMask; // Mask for *of* to indicate changed bits
} opt;
struct cmdReference { // {INF File Reference}
char achDst[cbFILE_NAME_MAX]; // Destination
HGENLIST hglist; // List of /X=Y parameters
} ref;
struct cmdSet { // .Set and .Define
char achVarName[cbVAR_NAME_MAX]; // Variable name
char achValue[cbVAR_VALUE_MAX]; // New value
} set;
struct cmdOther { // Used by all other commands
char *psz;
} other;
};
//BUGBUG 14-Aug-1993 bens COMMAND is incomplete
} COMMAND; /* cmd */
typedef COMMAND *PCOMMAND; /* pcmd */
#ifdef ASSERT
#define sigFILEPARM MAKESIG('F','P','A','R') // FILEPARM signature
#define AssertFparm(p) AssertStructure(p,sigFILEPARM);
#else // !ASSERT
#define AssertFparm(p)
#endif // !ASSERT
/*** FILEPARM - Value (Y) of "/X=Y" parameter from a file copy line
*
*/
typedef struct {
#ifdef ASSERT
SIGNATURE sig; // structure signature sigFILEPARM
#endif
char *pszValue; // Parameter value
} FILEPARM; /* fparm */
typedef FILEPARM *PFILEPARM; /* pfparm */
/*** DestroyFileParm - Function to destroy a file parameter
*
* Entry:
* pv - pointer to a FILEPARM (may be NULL, which is a NOP)
*
* Exit:
* FILEPARM destroyed;
*/
FNGLDESTROYVALUE(DestroyFileParm);
/*** DuplicateFileParm - Function to duplicate a file parameter
*
* Entry:
* pv - pointer to a FILEPARM
*
* Exit-Success:
* Returns pointer to duplicated FILEPARM
*
* Exit-Failure:
* Returns NULL;
*/
FNGLDUPLICATEVALUE(DuplicateFileParm);
#endif // !INCLUDED_COMMAND
|