summaryrefslogtreecommitdiffstats
path: root/private/windows/diamond/inf.h
blob: 95700303c63399747294086e2e8e538f58c28435 (plain) (blame)
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/***    inf.h - Diamond INF generation definitions
 *
 *      Microsoft Confidential
 *      Copyright (C) Microsoft Corporation 1994
 *      All Rights Reserved.
 *
 *  Author:
 *      Benjamin W. Slivka
 *
 *  History:
 *      23-Feb-1994 bens    Initial version
 *      24-Feb-1994 bens    Remove PSESSION dependency
 *      02-Mar-1994 bens    Add function header comments
 */

#ifndef INCLUDED_INF
#define INCLUDED_INF 1

#include "types.h"
#include "error.h"
#include "glist.h"
#include "dfparse.h"

#define cbINF_LINE_MAX      512     // Maximum INF line length

#define cbPARM_NAME_MAX     32      // Maximum parameter name length


#ifdef ASSERT
#define sigLINEINFO MAKESIG('L','I','N','E')  // LINEINFO signature
#define AssertLinfo(p) AssertStructure(p,sigLINEINFO);
#else // !ASSERT
#define AssertLinfo(p)
#endif // !ASSERT

/***    LINEINFO - Info for a line
 *
 *  This is stored in a GENLIST with a NULL key.
 */
typedef struct {
#ifdef ASSERT
    SIGNATURE          sig;         // structure signature sigLINEINFO
#endif
    INFAREA            inf;         // Area of INF to write line to
    char              *pszLine;     // Line to write to INF
} LINEINFO;    /* linfo */
typedef LINEINFO *PLINEINFO; /* plinfo */


#ifdef ASSERT
#define sigFILEINFO MAKESIG('F','I','N','F')  // FILEINFO signature
#define AssertFinfo(p) AssertStructure(p,sigFILEINFO);
#else // !ASSERT
#define AssertFinfo(p)
#endif // !ASSERT

/***    fifXXX - flags for FILEINFO.flags field
 *
 */
#define fifWRITTEN_TO_INF   0x0001  // File has been written to INF
#define fifREFERENCED       0x0002  // File has been referenced in INF section
#define fifDATE_SET         0x0004  // Explicit file date has been set in .fta
#define fifTIME_SET         0x0008  // Explicit file date has been set in .fta
#define fifATTR_SET         0x0010  // Explicit file date has been set in .fta


/***    FILEINFO - Info associated with a file
 *
 *  The destination file name is used as the key in a GENLIST, and a
 *  pointer to this structure is stored in the user pointer in the GENLIST
 *  item.
 */
typedef struct {
#ifdef ASSERT
    SIGNATURE       sig;            // structure signature sigFILEINFO
#endif
    long            cbFile;         // File size
    char           *pszDDF;         // DDF file name with file copy command
    int             ilineDDF;       // Line in DDF of file copy command
    int             iDisk;          // Disk number (1-based)
    int             iCabinet;       // Cabinet number (1-based, 0=> not in cab)
    int             iFile;          // File number (1-based)
    int             flags;          // fifXxxx flags
    FILETIMEATTR    fta;            // date/time/attributes
    HGENLIST        hglistParm;     // Parameter list
    HGENLIST        hglistInfLines; // Lines to add to INF after this file
    ULONG           checksum;       // 32-bit checksum of file contents
    ULONG           verMS;          // Most significant 32-bits of file ver
                                    //  (0 if no value).

    ULONG           verLS;          // Least significant 32-bits of file ver
                                    //  (0 if no value).

    char           *pszVersion;     // String version via VER.DLL (NULL if no
                                    //  value).
                                    //  NOTE: Can be different from verMS/LS,
                                    //        due to sloppy build procedures!

    char           *pszLang;        // Language via VER.DLL API (NULL if no
                                    //  value)
} FILEINFO;    /* finfo */
typedef FILEINFO *PFILEINFO; /* pfinfo */

#define idiskBAD    -1              // Unitialized value for finfo.iDisk
#define icabBAD     -1              // Unitialized value for finfo.iCabinet


/***    HINF - handle to INF context
 *
 */
typedef void *HINF; /* hinf */


/***    DestroyFileInfo - Destroy a file info structure
 *
 *  Entry:
 *      pv - pointer to a FILEINFO (may be NULL, which is a NOP)
 *
 *  Exit:
 *      FILEINFO destroyed;
 */
FNGLDESTROYVALUE(DestroyFileInfo);


/***    DestroyLineInfo - Destroy a line info structure
 *
 *  Entry:
 *      pv - pointer to a LINEINFO (may be NULL, which is a NOP)
 *
 *  Exit:
 *      LINEINFO destroyed;
 */
FNGLDESTROYVALUE(DestroyLineInfo);


/***    infCreate - Create INF context
 *
 *  Entry:
 *      psess - SESSION structure
 *      perr  - ERROR structure
 *
 *  Exit-Success:
 *      returns handle to INF context
 *
 *  Exit-Failure:
 *      Returns NULL; perr filled in with error.
 */
HINF infCreate(PSESSION psess, PERROR perr);


/***    infAddLine - Add a line to an INF area
 *
 *  Entry:
 *      hinf     - handle to INF context
 *      inf      - INF area
 *      pszLine  - Line to add
 *      perr     - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; line added to INF
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 */
BOOL infAddLine(HINF hinf, INFAREA inf, char *pszLine, PERROR perr);


/***    infAddCabinet - Add information for a new cabinet to the INF context
 *
 *  Entry:
 *      psess    - Session
 *      iCabinet - cabinet number being added
 *      iDisk    - disk number where cabinet resides
 *      pszCab   - cabinet file name
 *      perr     - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; cabinet info added to INF context
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 */
BOOL infAddCabinet(PSESSION  psess,
                   int       iCabinet,
                   int       iDisk,
                   char     *pszCab,
                   PERROR    perr);


/***    infAddDisk - Add information for a new disk to the INF context
 *
 *  Entry:
 *      psess    - Session
 *      iDisk    - disk number begin added
 *      pszDisk  - printed label for disk
 *      perr     - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; disk info added to INF context
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 */
BOOL infAddDisk(PSESSION psess, int iDisk, char *pszDisk, PERROR perr);


/***    infAddFile - Add information for a new file to the INF context
 *
 *  Entry:
 *      psess      - Session
 *      pszFile    - Destination file name
 *      pfinfo     - File information
 *      hglistParm - Parameter list
 *      perr       - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; cabinet info added to INF context
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 */
BOOL infAddFile(PSESSION    psess,
                char       *pszFile,
                PFILEINFO   pfinfo,
                HGENLIST    hglistParm,
                PERROR      perr);


/***    infGenerate - Generate INF file
 *
 *  NOTE: See inf.h for entry/exit conditions.
 */
BOOL infGenerate(HINF    hinf,
                 char   *pszInfFile,
                 time_t *ptime,
                 char   *pszVer,
                 PERROR  perr);


/***    infDestroy - Destroy INF context
 *
 *  Entry:
 *      hinf - handle to INF context to destroy
 *      perr - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; INF context destroyed.
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 */
BOOL infDestroy(HINF hinf, PERROR perr);


/***    ValidateParms - Validate list of file parameters
 *
 *  Entry:
 *      psess      - Session
 *      hglist     - List of FILEPARMs
 *      pfinfo     - Fileinfo structure to modify (if appropriate)
 *      perr       - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; All parameters are valid, *pfinfo modified if
 *      appropriate (for date, time, attr, size, ...)
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 *
 *  NOTE: This must be called *before* CheckForInfVarOverrides(), so that
 *        any parms specified on the file copy command have precedence
 *        over the values of InfDate, InfTime, and InfAttr variables!
 */
BOOL ValidateParms(PSESSION  psess,
                   HGENLIST  hglist,
                   PFILEINFO pfinfo,
                   PERROR    perr);


/***    CheckForInfVarOverrides - Apply any InfXxxx overrides to FILEINFO
 *
 *  Entry:
 *      psess      - Session
 *      pfinfo     - Fileinfo structure to modify (if indicated)
 *      perr       - ERROR structure
 *
 *  Exit-Success:
 *      Returns TRUE; All parameters are valid, *pfinfo modified if
 *      appropriate (for date, time, attr) *only* if pfinfo->flags
 *      indicates the values have not yet been set.
 *
 *  Exit-Failure:
 *      Returns FALSE; perr filled in with error.
 *
 *  NOTE: This must be called *after* ValidateParms(), so that
 *        it will not override parms specified on the file copy
 *        command!
 */
BOOL CheckForInfVarOverrides(PSESSION  psess,
                             PFILEINFO pfinfo,
                             PERROR    perr);


#endif // !INCLUDED_INF