Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1156 lines
30 KiB

  1. /************************************************/
  2. /* Common Library Component public include file */
  3. /************************************************/
  4. #if !defined (COMSTF_INCLUDED )
  5. #define COMSTF_INCLUDED
  6. // avoid warnings on every file from including stdlib.h
  7. #if defined(min)
  8. #undef min
  9. #undef max
  10. #endif /* min */
  11. extern HANDLE MyDllModuleHandle;
  12. /*
  13. ** Global variable macro for DLL portability
  14. */
  15. #define GLOBAL(x) (x)
  16. /* standard datatypes
  17. */
  18. typedef BYTE * PB;
  19. typedef unsigned CB;
  20. typedef LONG * PLONG_STF;
  21. /* BOOLean datatype
  22. */
  23. #define fFalse ((BOOL)0)
  24. #define fTrue ((BOOL)1)
  25. /* To avoid compiler warnings for unused parameters
  26. */
  27. #define Unused(x) (x)=(x)
  28. /* If new GRCs are added, they should as well be handled
  29. in EercErrorHandler() in ERROR1.C */
  30. /*
  31. ** General Return Code datatype
  32. */
  33. typedef USHORT GRC;
  34. #define grcFirst ((GRC)0)
  35. #define grcLast ((GRC)52)
  36. #define grcOkay ((GRC)0)
  37. #define grcNotOkay ((GRC)1)
  38. #define grcOutOfMemory ((GRC)2)
  39. #define grcInvalidStruct ((GRC)3)
  40. #define grcOpenFileErr ((GRC)4)
  41. #define grcCreateFileErr ((GRC)5)
  42. #define grcReadFileErr ((GRC)6)
  43. #define grcWriteFileErr ((GRC)7)
  44. #define grcRemoveFileErr ((GRC)8)
  45. #define grcRenameFileErr ((GRC)9)
  46. #define grcReadDiskErr ((GRC)10)
  47. #define grcCreateDirErr ((GRC)11)
  48. #define grcRemoveDirErr ((GRC)12)
  49. #define grcBadINF ((GRC)13)
  50. #define grcINFBadSectionLabel ((GRC)14)
  51. #define grcINFBadLine ((GRC)15)
  52. #define grcINFBadKey ((GRC)16)
  53. #define grcCloseFileErr ((GRC)17)
  54. #define grcChangeDirErr ((GRC)18)
  55. #define grcINFSrcDescrSect ((GRC)19)
  56. #define grcTooManyINFKeys ((GRC)20)
  57. #define grcWriteInf ((GRC)21)
  58. #define grcInvalidPoer ((GRC)22)
  59. #define grcINFMissingLine ((GRC)23)
  60. #define grcINFBadFDLine ((GRC)24)
  61. #define grcINFBadRSLine ((GRC)25)
  62. #define grcInvalidPathErr ((GRC)26)
  63. #define grcWriteIniValueErr ((GRC)27)
  64. #define grcReplaceIniValueErr ((GRC)28)
  65. #define grcIniValueTooLongErr ((GRC)29)
  66. #define grcDDEInitErr ((GRC)30)
  67. #define grcDDEExecErr ((GRC)31)
  68. #define grcBadWinExeFileFormatErr ((GRC)32)
  69. #define grcResourceTooLongErr ((GRC)33)
  70. #define grcMissingSysIniSectionErr ((GRC)34)
  71. #define grcDecompGenericErr ((GRC)35)
  72. #define grcDecompUnknownAlgErr ((GRC)36)
  73. #define grcMissingResourceErr ((GRC)37)
  74. #define grcLibraryLoadErr ((GRC)38)
  75. #define grcBadLibEntry ((GRC)39)
  76. #define grcApplet ((GRC)40)
  77. #define grcExternal ((GRC)41)
  78. #define grcSpawn ((GRC)42)
  79. #define grcDiskFull ((GRC)43)
  80. #define grcDDEAddItem ((GRC)44)
  81. #define grcDDERemoveItem ((GRC)45)
  82. #define grcINFMissingSection ((GRC)46)
  83. #define grcRunTimeParseErr ((GRC)47)
  84. #define grcOpenSameFileErr ((GRC)48)
  85. #define grcGetVolInfo ((GRC)49)
  86. #define grcGetFileSecurity ((GRC)50)
  87. #define grcSetFileSecurity ((GRC)51)
  88. #define grcVerifyFileErr ((GRC)52)
  89. /**************************************/
  90. /* common library function prototypes */
  91. /**************************************/
  92. /* CHaracter Physical representation datatype
  93. */
  94. typedef BYTE CHP;
  95. typedef CHP * PCHP;
  96. typedef CB CCHP;
  97. #define CbFromCchp(cchp) ((CB)(cchp))
  98. /* CHaracter Logical representation datatype
  99. */
  100. typedef CHP CHL;
  101. typedef CHL * PCHL;
  102. typedef PCHL * PPCHL;
  103. typedef CB CCHL;
  104. typedef CB ICHL;
  105. #define cbFullPathMax ((CB)(MAX_PATH-1))
  106. #define cchlFullPathMax ((CCHL)(MAX_PATH-1))
  107. #define cchlFullDirMax cchlFullPathMax
  108. #define cchpFullPathMax ((CCHP)(MAX_PATH-1))
  109. #define cbFullPathBuf ((CB)(cbFullPathMax + 1))
  110. #define cchlFullPathBuf ((CCHL)(cchlFullPathMax + 1))
  111. #define cchpFullPathBuf ((CCHP)(cchpFullPathMax + 1))
  112. /* String Zero terminated datatype
  113. */
  114. typedef PCHL SZ;
  115. #define PSZ PPSZ
  116. typedef PPCHL PSZ;
  117. typedef PPCHL RGSZ;
  118. /* Comparison Return Code datatype
  119. */
  120. typedef INT CRC;
  121. #define crcError ((CRC)(-2))
  122. #define crcEqual ((CRC)0)
  123. #define crcFirstHigher ((CRC)1)
  124. #define crcSecondHigher ((CRC)(-1))
  125. /* String manipulation routines */
  126. extern SZ APIENTRY SzDupl(SZ);
  127. extern CRC APIENTRY CrcStringCompare(SZ, SZ);
  128. extern CRC APIENTRY CrcStringCompareI(SZ, SZ);
  129. extern SZ APIENTRY SzLastChar(SZ);
  130. /*
  131. ** Purpose:
  132. ** Advances a string pointer to the beginning of the next valid
  133. ** character. This may include skipping a double-byte character.
  134. ** Arguments:
  135. ** sz: the string pointer to advance. It can be NULL or empty, or else
  136. ** it must point at the beginning of a valid character.
  137. ** Returns:
  138. ** NULL if sz was NULL.
  139. ** sz unchanged if it was an empty string (*sz == '\0').
  140. ** sz advanced past the current character and to the beginning of the
  141. ** next valid character.
  142. */
  143. #define SzNextChar(sz) ((SZ)AnsiNext(sz))
  144. /*
  145. ** Purpose:
  146. ** Retreats a string pointer to the beginning of the previous valid
  147. ** character. This may include skipping a double-byte character.
  148. ** Arguments:
  149. ** szStart: string pointer to the beginning of a valid character that
  150. ** equals or preceeds the character szCur.
  151. ** szCur: string pointer to retreat. It can be NULL or empty, or
  152. ** can point to any byte in a valid character.
  153. ** Returns:
  154. ** NULL if szCur was NULL.
  155. ** sz unchanged if szStart was NULL or if szCur equaled szStart.
  156. ** sz retreated past the current character and to the beginning of the
  157. ** previous valid character.
  158. */
  159. #define SzPrevChar(szStart, szCur) ((SZ)AnsiPrev(szStart,szCur))
  160. /*
  161. ** Purpose:
  162. ** Appends a string from one buffer to another.
  163. ** Arguments:
  164. ** szDst: string pointer to destination buffer. This can be NULL or
  165. ** else it must contain a zero terminated string (can be empty)
  166. ** and enough storage to append szSrc with its terminating zero
  167. ** character.
  168. ** szSrc: string pointer to source buffer. This can be NULL or else
  169. ** must point to a zero terminated string (can be empty).
  170. ** Returns:
  171. ** NULL if either szDst or szSrc is NULL.
  172. ** szDst signifying the operation succeeded.
  173. */
  174. #define SzStrCat(szDst, szSrc) ((SZ)lstrcat((LPSTR)szDst,(LPSTR)szSrc))
  175. /*
  176. ** Purpose:
  177. ** Determines whether the current character is a single Physical
  178. ** Character.
  179. ** Arguments:
  180. ** sz: string pointer which can be NULL, empty, or pointing to the
  181. ** beginning of a valid character.
  182. ** Returns:
  183. ** fFalse if sz is NULL or points to the beginning of a multiple
  184. ** Physical Character character.
  185. ** fTrue if sz is empty or points to the beginning of a single
  186. ** Physical Character character.
  187. */
  188. #define FSingleByteCharSz(sz) (!IsDBCSLeadByte(*sz))
  189. /*
  190. ** Purpose:
  191. ** Determines whether a character is an End-Of-Line character.
  192. ** Arguments:
  193. ** chp: Physical Character (eg a single byte Logical Character).
  194. ** Returns:
  195. ** fFalse if chp is not either a '\n' or a '\r' character.
  196. ** fTrue if chp is either a '\n' or a '\r' character.
  197. */
  198. #define FEolChp(chp) ((BOOL)((chp) == '\n' || (chp) == '\r'))
  199. /*
  200. ** Purpose:
  201. ** Determines whether a character is whitespace.
  202. ** Arguments:
  203. ** chp: Physical Character (eg a single byte Logical Character).
  204. ** Returns:
  205. ** fFalse if chp is not either a space or a tab character.
  206. ** fTrue if chp is either a space or a tab character.
  207. */
  208. #define FWhiteSpaceChp(chp) ((BOOL)((chp) == ' ' || (chp) == '\t'))
  209. /*
  210. ** Purpose:
  211. ** Converts a zero-terminated string to upper case.
  212. ** Arguments:
  213. ** sz: the string to convert to upper case. sz must be non-NULL though
  214. ** it can be empty.
  215. ** Returns:
  216. ** A pointer to the converted string.
  217. */
  218. #define SzStrUpper(sz) (SZ)(AnsiUpper((LPSTR)(sz)))
  219. /*
  220. ** Purpose:
  221. ** Converts a zero-terminated string to lower case.
  222. ** Arguments:
  223. ** sz: the string to convert to lower case. sz must be non-NULL though
  224. ** it can be empty.
  225. ** Returns:
  226. ** A pointer to the converted string.
  227. */
  228. #define SzStrLower(sz) (SZ)(AnsiLower((LPSTR)(sz)))
  229. #define cbSymbolMax (64*1024)
  230. #define cbAllocMax (65520*5)
  231. #define cbIntStrMax 16
  232. PVOID
  233. SAlloc(
  234. IN DWORD Size
  235. );
  236. PVOID
  237. SRealloc(
  238. IN PVOID Block,
  239. IN DWORD NewSize
  240. );
  241. VOID
  242. SFree(
  243. IN PVOID Block
  244. );
  245. BOOL
  246. SInit(
  247. IN BOOL Init
  248. );
  249. /* Long File Address datatype
  250. */
  251. typedef unsigned long LFA;
  252. #define lfaSeekError ((LFA)-1)
  253. /*
  254. ** File Handle structure
  255. ** Fields:
  256. ** iDosfh: DOS file handle.
  257. ** ofstruct: OFSTRUCT used when the file was opened.
  258. */
  259. typedef struct _fh
  260. {
  261. INT iDosfh;
  262. OFSTRUCT ofstruct;
  263. } FH;
  264. /* File Handle datatype
  265. */
  266. typedef FH * PFH;
  267. /* Open File Mode datatype
  268. */
  269. typedef USHORT OFM;
  270. #define ofmExistRead ((OFM)OF_EXIST | OF_READ)
  271. #define ofmExistReadWrite ((OFM)OF_EXIST | OF_READWRITE)
  272. //#define ofmRead ((OFM)OF_READ | OF_SHARE_DENY_WRITE)
  273. #define ofmRead ((OFM)OF_READ)
  274. #define ofmWrite ((OFM)OF_WRITE | OF_SHARE_EXCLUSIVE)
  275. #define ofmReadWrite ((OFM)OF_READWRITE | OF_SHARE_EXCLUSIVE)
  276. #define ofmCreate ((OFM)OF_CREATE | OF_SHARE_EXCLUSIVE)
  277. /* Seek File Mode datatype
  278. */
  279. typedef WORD SFM;
  280. #define sfmSet ((SFM)0)
  281. #define sfmCur ((SFM)1)
  282. #define sfmEnd ((SFM)2)
  283. /* File handling routines */
  284. extern PFH APIENTRY PfhOpenFile(SZ, OFM);
  285. extern BOOL APIENTRY FCloseFile(PFH);
  286. extern CB APIENTRY CbReadFile(PFH, PB, CB);
  287. extern CB APIENTRY CbWriteFile(PFH, PB, CB);
  288. extern LFA APIENTRY LfaSeekFile(PFH, LONG, SFM);
  289. extern BOOL APIENTRY FEndOfFile(PFH);
  290. extern BOOL APIENTRY FRemoveFile(SZ);
  291. extern BOOL APIENTRY FWriteSzToFile(PFH, SZ);
  292. extern BOOL APIENTRY FFileExists(SZ);
  293. extern SZ APIENTRY szGetFileName(SZ szPath);
  294. extern VOID APIENTRY FreePfh(PFH pfh);
  295. /* Path manipulation routines */
  296. BOOL FMakeFATPathFromDirAndSubPath(SZ, SZ, SZ, CCHP);
  297. #define FValidFATDir(sz) fTrue
  298. #define FValidFATPath(sz) fTrue
  299. #define CchlValidFATSubPath(sz) strlen(sz) // no checking for WIN32
  300. #define ISUNC(sz) ((BOOL)(sz != NULL && lstrlen(sz) > 3 && *sz == '\\' && *(sz+1) == '\\'))
  301. /*
  302. ** Purpose:
  303. ** Determines if a path is a valid FAT directory.
  304. ** Arguments:
  305. ** szDir: the directory string to check.
  306. ** Returns:
  307. ** fTrue if the szDir is a valid FAT directory.
  308. ** fFalse if the szDir is an invalid FAT directory.
  309. */
  310. #define FValidDir(szDir) FValidFATDir(szDir)
  311. /*
  312. ** Purpose:
  313. ** Determines if a string is a valid FAT SubPath (eg subdirs and filename).
  314. ** Arguments:
  315. ** szSubPath: the SubPath string to check.
  316. ** Returns:
  317. ** zero if the string is an invalid FAT subPath.
  318. ** non-zero count of characters in sz if it is a valid FAT subPath.
  319. */
  320. #define CchlValidSubPath(szSubPath) CchlValidFATSubPath(szSubPath)
  321. /*
  322. ** Purpose:
  323. ** Determines if a path is a valid FAT path.
  324. ** Arguments:
  325. ** szPath: the path to check.
  326. ** Returns:
  327. ** fTrue if the szPath is a valid FAT path.
  328. ** fFalse if the szPath is an invalid FAT path.
  329. */
  330. #define FValidPath(szPath) FValidFATPath(szPath)
  331. /*
  332. ** Purpose:
  333. ** Creates a valid path from subpath, and filename arguments if possible
  334. ** and stores it in a supplied buffer.
  335. ** Arguments:
  336. ** szDir: string containing the volume and subdirs.
  337. ** szSubPath: string containing subdirs and the filename.
  338. ** szBuf: the buffer in which to store the newly created path.
  339. ** cchpBufMax: the maximum number of physical characters (including the
  340. ** terminating zero) that can be stored in the buffer.
  341. ** Returns:
  342. ** fTrue if a valid FAT path can be created and stored in szBuf.
  343. ** fFalse if szDir is NULL or invalid (first character must be in the
  344. ** 'a' to 'z' or 'A' to 'Z', the second character must be either
  345. ** a ':' or a terminating zero, and the third character must be
  346. ** a '\\' and the rest must conform to 8.3 format), if szSubPath is
  347. ** NULL, empty or invalid (first character cannot be a '\\' and it must
  348. ** conform to 8.3 format), if szBuf is NULL, or if cchpBufMax is not
  349. ** large enough to hold the resultant path.
  350. */
  351. #define FMakePathFromDirAndSubPath(szDir, szSubPath, szBuffer, cchpBufMax) \
  352. FMakeFATPathFromDirAndSubPath(szDir,szSubPath,szBuffer,cchpBufMax)
  353. #define AssertDataSeg()
  354. #if DBG
  355. #define Assert(f) \
  356. ((f) ? (void)0 : (void)AssertSzUs(__FILE__,__LINE__))
  357. #define AssertRet(f, retVal) \
  358. {if (!(f)) {AssertSzUs(__FILE__,__LINE__); return(retVal);}}
  359. #define EvalAssert(f) \
  360. ((f) ? (void)0 : (void)AssertSzUs(__FILE__,__LINE__))
  361. #define EvalAssertRet(f, retVal) \
  362. {if (!(f)) {AssertSzUs(__FILE__,__LINE__); return(retVal);}}
  363. #define PreCondition(f, retVal) \
  364. {if (!(f)) {PreCondSzUs(__FILE__,__LINE__); return(retVal);}}
  365. #define ChkArg(f, iArg, retVal) \
  366. {if (!(f)) {BadParamUs(iArg, __FILE__, __LINE__); return(retVal);}}
  367. #else
  368. #define Assert(f) ((void)0)
  369. #define AssertRet(f, retVal) ((void)0)
  370. #define EvalAssert(f) ((void)(f))
  371. #define EvalAssertRet(f, retVal) ((void)(f))
  372. #define PreCondition(f, retVal) ((void)0)
  373. #define ChkArg(f, iArg, retVal) ((void)0)
  374. #endif
  375. /*
  376. ** Purpose:
  377. ** Generates a task modal message box.
  378. ** Arguments:
  379. ** szTitle: title for message box.
  380. ** szText: text for message box.
  381. ** Returns:
  382. ** none
  383. */
  384. #define MessBoxSzSz(szTitle, szText) \
  385. MessageBox((HWND)NULL, (LPSTR)szText, (LPSTR)szTitle, \
  386. MB_TASKMODAL | MB_ICONHAND | MB_OK)
  387. extern BOOL APIENTRY AssertSzUs(SZ, USHORT);
  388. extern BOOL APIENTRY PreCondSzUs(SZ, USHORT);
  389. extern BOOL APIENTRY BadParamUs(USHORT, SZ, USHORT);
  390. /*
  391. ** Inf Data Block structure
  392. **
  393. ** Fields:
  394. ** pidbNext: next IDB in linked list.
  395. ** pchpBuffer: character buffer.
  396. ** cchpBuffer: number of useful characters in pchpBuffer.
  397. ** cchpAllocated: number of characters actually allocated with
  398. ** pchpBuffer. May be zero.
  399. */
  400. typedef struct _idb
  401. {
  402. struct _idb * pidbNext;
  403. PCHP pchpBuffer;
  404. CCHP cchpBuffer;
  405. CCHP cchpAllocated;
  406. } IDB;
  407. /* Inf Data Block datatypes
  408. */
  409. typedef IDB * PIDB;
  410. typedef PIDB * PPIDB;
  411. /*
  412. The following equate is used because of a situation like
  413. "abcd"+
  414. "efgh"
  415. When parsed, this will be "abcdefgh" -- is this two strings or
  416. one string with a double quote in the middle? If it's the latter,
  417. we'll actually store "abcd.efgh" where . is DOUBLE_QUOTE.
  418. */
  419. #define DOUBLE_QUOTE '\001'
  420. #define INFLINE_SECTION 0x01
  421. #define INFLINE_KEY 0x02
  422. /* INF File Handling routines */
  423. GRC APIENTRY GrcOpenInf(SZ IniFileName, PVOID pInfTempInfo);
  424. BOOL APIENTRY FFreeInf(void);
  425. UINT APIENTRY CKeysFromInfSection(SZ Section, BOOL IncludeAllLines);
  426. BOOL APIENTRY FKeyInInfLine(INT Line);
  427. RGSZ APIENTRY RgszFromInfLineFields(INT Line,UINT StartField,UINT NumFields);
  428. BOOL APIENTRY FFreeRgsz(RGSZ);
  429. UINT APIENTRY CFieldsInInfLine(INT Line);
  430. INT APIENTRY FindInfSectionLine(SZ Section);
  431. INT APIENTRY FindNthLineFromInfSection(SZ Section,UINT n);
  432. INT APIENTRY FindLineFromInfSectionKey(SZ Section,SZ Key);
  433. INT APIENTRY FindNextLineFromInf(INT Line);
  434. SZ APIENTRY SzGetNthFieldFromInfLine(INT Line,UINT n);
  435. SZ APIENTRY SzGetNthFieldFromInfSectionKey(SZ Section,SZ Key,UINT n);
  436. BOOL APIENTRY FUpdateInfSectionUsingSymTab(SZ);
  437. SZ APIENTRY InterpretField(SZ);
  438. #define RgszFromInfScriptLine(Line,NumFields) \
  439. RgszFromInfLineFields(Line,1,NumFields)
  440. #define FindFirstLineFromInfSection(Section) FindNthLineFromInfSection(Section,1)
  441. /*
  442. ** Option-Element Flags datatype for SFD
  443. */
  444. typedef WORD OEF;
  445. #define oefVital ((OEF)0x0001)
  446. #define oefCopy ((OEF)0x0002)
  447. #define oefUndo ((OEF)0x0004)
  448. #define oefRoot ((OEF)0x0008)
  449. #define oefDecompress ((OEF)0x0010)
  450. #define oefTimeStamp ((OEF)0x0020)
  451. #define oefReadOnly ((OEF)0x0040)
  452. #define oefBackup ((OEF)0x0080)
  453. #define oefUpgradeOnly ((OEF)0x0100)
  454. //
  455. // The following oef means that the source file should not be deleted
  456. // after it is copied, even if the source is the DOS setup local source.
  457. // (Files coming from anywhere below that directory are usually deleted
  458. // after they are copied).
  459. //
  460. #define oefNoDeleteSource ((OEF)0x0200)
  461. //
  462. // The following means that the file should not be put into the setup log
  463. // file that tracks all files copied by setup.
  464. //
  465. #define oefNoLog ((OEF)0x0400)
  466. //
  467. // The following means that the file is a third party file
  468. //
  469. #define oefThirdPartyFile ((OEF)0x0800)
  470. //
  471. // The following means that the file is from a CSD install
  472. //
  473. #define oefCsdInstall ((OEF)0x1000)
  474. #define oefNone ((OEF)0x0000)
  475. #define oefAll ((OEF)0xFFFF)
  476. /*
  477. ** Copy-Time Unit datatype for SFD
  478. */
  479. typedef WORD CTU;
  480. /*
  481. ** OverWrite Mode datatype for SFD
  482. */
  483. typedef WORD OWM;
  484. #define owmNever ((OWM)0x0001)
  485. #define owmAlways ((OWM)0x0002)
  486. #define owmUnprotected ((OWM)0x0004)
  487. #define owmOlder ((OWM)0x0008)
  488. #define owmVerifySourceOlder ((OWM)0x0010)
  489. /*
  490. ** Option-Element Record for SFD
  491. */
  492. typedef struct _oer
  493. {
  494. OEF oef;
  495. CTU ctuCopyTime;
  496. OWM owm;
  497. LONG lSize;
  498. SZ szRename;
  499. SZ szAppend;
  500. SZ szBackup;
  501. SZ szDescription;
  502. ULONG ulVerMS;
  503. ULONG ulVerLS;
  504. SZ szDate;
  505. SZ szDest;
  506. } OER;
  507. /*
  508. ** Option-Element Record datatype for SFD
  509. */
  510. typedef OER * POER;
  511. typedef POER * PPOER;
  512. #define poerNull ((POER)NULL)
  513. /*
  514. ** Disk ID datatype for SFD
  515. */
  516. typedef WORD DID;
  517. #define didMin 1
  518. #define didMost 999
  519. /*
  520. ** Section-File Description structure
  521. ** Fields:
  522. */
  523. typedef struct _sfd
  524. {
  525. DID did;
  526. UINT InfId;
  527. SZ szFile;
  528. OER oer;
  529. } SFD;
  530. /*
  531. ** Section-File Description datatype
  532. */
  533. typedef SFD * PSFD;
  534. typedef PSFD * PPSFD;
  535. #define psfdNull ((PSFD)NULL)
  536. extern POER APIENTRY PoerAlloc(VOID);
  537. extern BOOL APIENTRY FFreePoer(POER);
  538. extern BOOL APIENTRY FPrintPoer(PFH, POER);
  539. extern BOOL APIENTRY FValidPoer(POER);
  540. extern PSFD APIENTRY PsfdAlloc(VOID);
  541. extern BOOL APIENTRY FFreePsfd(PSFD);
  542. extern GRC APIENTRY GrcGetSectionFileLine(INT, PPSFD, POER);
  543. extern BOOL APIENTRY FPrintPsfd(PFH, PSFD);
  544. #if DBG
  545. extern BOOL APIENTRY FValidPsfd(PSFD);
  546. #endif
  547. extern BOOL APIENTRY FValidOerDate(SZ);
  548. extern BOOL APIENTRY FParseVersion(SZ, PULONG, PULONG);
  549. extern BOOL APIENTRY FListIncludeStatementLine(INT Line);
  550. extern GRC APIENTRY GrcGetListIncludeSectionLine(INT, PSZ, PSZ);
  551. /*
  552. ** Source Description List Element data structure
  553. */
  554. typedef struct _sdle
  555. {
  556. struct _sdle * psdleNext;
  557. DID did; // disk id as specified in the inf
  558. DID didGlobal; // a universal id across infs
  559. SZ szLabel;
  560. SZ szTagFile;
  561. SZ szNetPath;
  562. } SDLE;
  563. typedef SDLE * PSDLE;
  564. typedef PSDLE * PPSDLE;
  565. extern PSDLE APIENTRY PsdleAlloc(VOID);
  566. extern BOOL APIENTRY FFreePsdle(PSDLE);
  567. extern GRC APIENTRY GrcFillSrcDescrListFromInf(VOID);
  568. /*
  569. ** Copy List Node data structure
  570. */
  571. typedef struct _cln
  572. {
  573. SZ szSrcDir;
  574. SZ szDstDir;
  575. PSFD psfd;
  576. struct _cln * pclnNext;
  577. } CLN;
  578. typedef CLN * PCLN;
  579. typedef PCLN * PPCLN;
  580. typedef PPCLN * PPPCLN;
  581. /*
  582. ** Section Files Operation data structure
  583. ** REVIEW -- not really used
  584. */
  585. typedef WORD SFO;
  586. #define sfoCopy 1
  587. #define sfoBackup 2
  588. #define sfoRemove 3
  589. /* in LIST.C */
  590. extern PCLN pclnHead;
  591. extern PPCLN ppclnTail;
  592. extern GRC APIENTRY GrcFillPoerFromSymTab(POER);
  593. extern BOOL APIENTRY FSetPoerToEmpty(POER);
  594. extern GRC APIENTRY GrcAddSectionFilesToCopyList(SZ, SZ, SZ);
  595. extern GRC APIENTRY GrcAddSectionKeyFileToCopyList(SZ, SZ, SZ, SZ);
  596. extern GRC APIENTRY GrcAddNthSectionFileToCopyList(SZ, UINT, SZ, SZ);
  597. extern GRC APIENTRY GrcAddSectionFilesToCList(SFO, SZ, SZ, SZ, SZ, POER);
  598. extern GRC APIENTRY GrcAddLineToCList(INT, SFO, SZ, SZ, POER);
  599. extern GRC APIENTRY GrcAddPsfdToCList(SZ, SZ, PSFD);
  600. extern PCLN APIENTRY PclnAlloc(VOID);
  601. extern BOOL APIENTRY FFreePcln(PCLN);
  602. extern BOOL APIENTRY FPrintPcln(PFH, PCLN);
  603. #if DBG
  604. extern BOOL APIENTRY FValidPcln(PCLN);
  605. #endif
  606. /* Symbol Table constants */
  607. #define cchpSymMax ((CCHP)255)
  608. #define cchpSymBuf (cchpSymMax + 1)
  609. /* Symbol Table routines */
  610. extern BOOL APIENTRY FAddSymbolValueToSymTab(SZ, SZ);
  611. extern GRC APIENTRY GrcAddSymsFromInfSection(SZ);
  612. /* Message Box Routine */
  613. extern int APIENTRY ExtMessageBox(HANDLE, HWND, WORD, WORD, WORD);
  614. /*
  615. ** Purpose:
  616. ** Determines whether a symbol is defined in the symbol table.
  617. ** Arguments:
  618. ** szSymbol: symbol to search for. szSymbol must be non-NULL, non-empty,
  619. ** and start with a non-whitespace character.
  620. ** Returns:
  621. ** fTrue if szSymbol is defined in the symbol table (even if the associated
  622. ** is an empty string).
  623. ** fFalse if szSymbol is not defined in the symbol table.
  624. */
  625. #define FSymbolDefinedInSymTab(szSymbol) \
  626. ((BOOL)(SzFindSymbolValueInSymTab(szSymbol)!=(SZ)NULL))
  627. extern SZ APIENTRY SzFindSymbolValueInSymTab(SZ);
  628. extern BOOL APIENTRY FRemoveSymbolFromSymTab(SZ);
  629. extern RGSZ APIENTRY RgszFromSzListValue(SZ);
  630. extern SZ APIENTRY SzListValueFromRgsz(RGSZ);
  631. extern BOOL APIENTRY FFreeInfTempInfo(PVOID);
  632. extern BOOL APIENTRY FCheckSymTabIntegrity(VOID);
  633. extern SZ APIENTRY SzGetSubstitutedValue(SZ);
  634. extern SZ APIENTRY SzProcessSzForSyms(HWND, SZ);
  635. BOOL
  636. DumpSymbolTableToFile(
  637. IN PCSTR Filename
  638. );
  639. /* String Parse Code
  640. */
  641. typedef unsigned SPC;
  642. typedef SPC * PSPC;
  643. /*
  644. ** String-Code Pair structure
  645. ** Fields:
  646. ** sz: string.
  647. ** spc: String Parse Code to associate with string.
  648. */
  649. typedef struct _scp
  650. {
  651. SZ sz;
  652. SPC spc;
  653. } SCP;
  654. /* String-Code Pair datatype
  655. */
  656. typedef SCP * PSCP;
  657. /* String Parse Table datatypes
  658. */
  659. ///////////////////////////////////
  660. // typedef SCP SPT;
  661. ///////////////////////////////////
  662. typedef struct _pspt
  663. {
  664. PSCP pscpSorted ; // Generated for binary search
  665. long cItems ; // Number of items in table
  666. PSCP pscpBase ; // Original as given to PsptInitParsingTable()
  667. SPC spcDelim ; // Table delimiter entry
  668. } SPT ;
  669. typedef SPT * PSPT;
  670. /* Symbol Table routines */
  671. extern PSPT APIENTRY PsptInitParsingTable(PSCP);
  672. extern SPC APIENTRY SpcParseString(PSPT, SZ);
  673. extern BOOL APIENTRY FDestroyParsingTable(PSPT);
  674. /* Flow handling routines */
  675. /* external program, library */
  676. BOOL APIENTRY FParseLoadLibrary(INT Line, UINT *pcFields);
  677. BOOL APIENTRY FParseFreeLibrary(INT Line, UINT *pcFields);
  678. BOOL APIENTRY FParseLibraryProcedure(INT Line,UINT *pcFields);
  679. BOOL APIENTRY FParseRunExternalProgram(INT Line,UINT *pcFields);
  680. BOOL APIENTRY FParseInvokeApplet(INT Line, UINT *pcFields);
  681. BOOL APIENTRY FParseStartDetachedProcess(INT Line, UINT *pcFields);
  682. /* registry */
  683. BOOL APIENTRY FParseRegistrySection(INT Line, UINT *pcFields, SPC spc);
  684. BOOL APIENTRY FParseCreateRegKey(INT Line, UINT *pcFields, SZ szHandle);
  685. BOOL APIENTRY FParseOpenRegKey(INT Line, UINT *pcFields, SZ szHandle);
  686. BOOL APIENTRY FParseFlushRegKey(INT Line, UINT *pcFields, SZ szHandle);
  687. BOOL APIENTRY FParseCloseRegKey(INT Line, UINT *pcFields, SZ szHandle);
  688. BOOL APIENTRY FParseDeleteRegKey(INT Line, UINT *pcFields, SZ szHandle);
  689. BOOL APIENTRY FParseDeleteRegTree(INT Line, UINT *pcFields, SZ szHandle);
  690. BOOL APIENTRY FParseEnumRegKey(INT Line, UINT *pcFields, SZ szHandle);
  691. BOOL APIENTRY FParseSetRegValue(INT Line, UINT *pcFields, SZ szHandle);
  692. BOOL APIENTRY FParseGetRegValue(INT Line, UINT *pcFields, SZ szHandle);
  693. BOOL APIENTRY FParseDeleteRegValue(INT Line, UINT *pcFields, SZ szHandle);
  694. BOOL APIENTRY FParseEnumRegValue(INT Line, UINT *pcFields, SZ szHandle);
  695. BOOL APIENTRY FParseAddFileToDeleteList(INT Line, UINT *pcFields);
  696. BOOL APIENTRY FParseWaitOnEvent(INT Line,UINT *pcFields);
  697. BOOL APIENTRY FParseSignalEvent(INT Line,UINT *pcFields);
  698. BOOL APIENTRY FParseSleep(INT Line, UINT *pcFields);
  699. BOOL APIENTRY FParseFlushInf(INT Line, UINT *pcFields);
  700. /*
  701. ** String Parse Codes for Flow Handling
  702. */
  703. #define spcError 0
  704. #define spcUnknown 1
  705. #define spcSet 2
  706. #define spcIfStr 3
  707. #define spcIfStrI 4
  708. #define spcIfInt 5
  709. #define spcIfContains 6
  710. #define spcIfContainsI 7
  711. #define spcIfFirst spcIfStr
  712. #define spcIfLast spcIfContainsI
  713. #define spcEndIf 8
  714. #define spcElse 9
  715. #define spcElseIfStr 10
  716. #define spcElseIfStrI 11
  717. #define spcElseIfInt 12
  718. #define spcElseIfContains 13
  719. #define spcElseIfContainsI 14
  720. #define spcEQ 15
  721. #define spcNE 16
  722. #define spcLT 17
  723. #define spcLE 18
  724. #define spcGT 19
  725. #define spcGE 20
  726. #define spcIn 21
  727. #define spcNotIn 22
  728. #define spcGoTo 23
  729. #define spcForListDo 24
  730. #define spcEndForListDo 25
  731. #define spcSetSubst 26
  732. #define spcSetSubsym 27
  733. #define spcDebugMsg 28
  734. #define spcHourglass 29
  735. #define spcArrow 30
  736. #define spcSetInstructionText 31
  737. #define spcSetHelpFile 32
  738. #define spcCreateRegKey 33
  739. #define spcOpenRegKey 34
  740. #define spcFlushRegKey 35
  741. #define spcCloseRegKey 36
  742. #define spcDeleteRegKey 37
  743. #define spcDeleteRegTree 38
  744. #define spcEnumRegKey 39
  745. #define spcSetRegValue 40
  746. #define spcGetRegValue 41
  747. #define spcDeleteRegValue 42
  748. #define spcEnumRegValue 43
  749. #define spcSetAdd 50
  750. #define spcSetSub 51
  751. #define spcSetMul 52
  752. #define spcSetDiv 53
  753. #define spcGetDriveInPath 54
  754. #define spcGetDirInPath 55
  755. #define spcLoadLibrary 56
  756. #define spcFreeLibrary 57
  757. #define spcLibraryProcedure 58
  758. #define spcRunExternalProgram 59
  759. #define spcInvokeApplet 60
  760. #define spcDebugOutput 61
  761. #define spcSplitString 62
  762. #define spcQueryListSize 63
  763. #define spcSetOr 64
  764. #define spcAddFileToDeleteList 65
  765. #define spcInitRestoreDiskLog 66
  766. #define spcStartDetachedProcess 67
  767. #define spcWaitOnEvent 68
  768. #define spcSignalEvent 69
  769. #define spcSleep 70
  770. #define spcSetHexToDec 71
  771. #define spcSetDecToHex 72
  772. #define spcFlushInf 73
  773. #define spcBmpShow 74
  774. #define spcBmpHide 75
  775. #define spcTermRestoreDiskLog 76
  776. extern PSPT psptFlow;
  777. extern SCP rgscpFlow[];
  778. extern BOOL APIENTRY FHandleFlowStatements(INT *, HWND, SZ, UINT *,RGSZ *);
  779. extern BOOL APIENTRY FInitFlowPspt(VOID);
  780. extern BOOL APIENTRY FDestroyFlowPspt(VOID);
  781. /*
  782. ** Expanded Error Return Code
  783. */
  784. typedef unsigned EERC;
  785. #define eercAbort ((EERC)0)
  786. #define eercRetry ((EERC)1)
  787. #define eercIgnore ((EERC)2)
  788. EERC __cdecl EercErrorHandler(HWND, GRC, BOOL, ...);
  789. extern BOOL APIENTRY FHandleOOM(HWND);
  790. extern BOOL APIENTRY FGetSilent(VOID);
  791. extern BOOL APIENTRY FSetSilent(BOOL);
  792. VOID SetSupportLibHandle(HANDLE Handle);
  793. extern HCURSOR CurrentCursor;
  794. //
  795. // Utility functions for dealing with multisz's.
  796. //
  797. RGSZ
  798. MultiSzToRgsz(
  799. IN PVOID MultiSz
  800. );
  801. PCHAR
  802. RgszToMultiSz(
  803. IN RGSZ rgsz
  804. );
  805. BOOL AddFileToDeleteList(PCHAR Filename);
  806. // floppy operations/repair diskette stuff
  807. BOOL
  808. InitializeFloppySup(
  809. VOID
  810. );
  811. VOID
  812. TerminateFloppySup(
  813. VOID
  814. );
  815. BOOL
  816. FormatFloppyDisk(
  817. IN CHAR DriveLetter,
  818. IN HWND hwndOwner,
  819. OUT PBOOL Fatal
  820. );
  821. BOOL
  822. CopyFloppyDisk(
  823. IN CHAR DriveLetter,
  824. IN HWND hwndOwner,
  825. IN DWORD SourceDiskPromptId,
  826. IN DWORD TargetDiskPromptId
  827. );
  828. UINT
  829. xMsgBox(
  830. HWND hwnd,
  831. UINT CaptionResId,
  832. UINT MessageResId,
  833. UINT MsgBoxFlags,
  834. ...
  835. );
  836. // Bit map control variables.
  837. #define BMP_MAX 10
  838. extern HBITMAP hbmAdvertList [ BMP_MAX + 1 ] ;
  839. extern INT cAdvertIndex ;
  840. extern INT cAdvertCycleSeconds ;
  841. extern INT cyAdvert ;
  842. extern INT cxAdvert ;
  843. extern PSTR SETUP_LOG_FILE;
  844. extern PSTR SETUP_REPAIR_DIRECTORY;
  845. //
  846. // This flag tells us whether we were invoked as a standalone process
  847. // or whether we were called to interpret a legacy inf from within a process.
  848. //
  849. extern BOOL OwnProcess;
  850. //
  851. // The following two globals are only valid if 'OwnProcess' is FALSE.
  852. //
  853. extern LPSTR ServicesModified;
  854. extern DWORD ServicesModifiedSize;
  855. #endif // COMSTF_INCLUDED