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.

788 lines
22 KiB

  1. #include <windows.h>
  2. #include <ntverp.h>
  3. #include <stdio.h>
  4. #include <windef.h>
  5. #include <wchar.h>
  6. typedef FILE *PFILE;
  7. typedef WCHAR *PWCHAR;
  8. typedef USHORT *PUSHORT;
  9. typedef SHORT *PSHORT;
  10. typedef UINT *PUINT;
  11. typedef UCHAR *PUCHAR;
  12. #include <ctype.h>
  13. #include <errno.h>
  14. #include <io.h>
  15. #include <limits.h>
  16. #include <malloc.h>
  17. #include <memory.h>
  18. #include <process.h>
  19. #include <signal.h>
  20. #include <stdarg.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24. #include <time.h>
  25. #include <mmsystem.h>
  26. #include "charmap.h"
  27. #include "fcntl.h"
  28. #include "getflags.h"
  29. #include "grammar.h"
  30. #include "rcpptype.h"
  31. #include "rcppdecl.h"
  32. #include "rcppext.h"
  33. #include "p0defs.h"
  34. #include "newexe.h"
  35. #include "p1types.h"
  36. #include "rcdefs.h"
  37. #include "rcnewres.h"
  38. #include "rcppx.h"
  39. #include "rcunicod.h"
  40. #include "resfile.h"
  41. #include "strings.h"
  42. #include "trees.h"
  43. #define NULL_FILE ((PFILE) NULL)
  44. /* ----- General symbols ----- */
  45. #define VERSION_DUAL 0x202
  46. #define BUFSIZE 16384
  47. #define EOF (-1)
  48. #define TRUE 1
  49. #define FALSE 0
  50. /* The ResType field of NewHeader identifies the cursor/icon type */
  51. #define ICONTYPE 1
  52. #define CURSORTYPE 2
  53. /* Identifies the menu item template version number */
  54. #define OLDMENUITEMTEMPLATEVERSIONNUMBER 0
  55. #define OLDMENUITEMTEMPLATEBYTESINHEADER 0
  56. #define MENUITEMTEMPLATEVERSIONNUMBER 1
  57. #define MENUITEMTEMPLATEBYTESINHEADER sizeof(DWORD) //dwHelpID in hdr
  58. #define DIFFERENCE 11
  59. /* Predefined resource types */
  60. #define RT_NEWRESOURCE 0x2000
  61. #define RT_ERROR 0x7fff
  62. #define RT_NEWBITMAP MAKEINTRESOURCE((DWORD)RT_BITMAP+DIFFERENCE)
  63. // These are 'hidden' resources that users never see/use directly.
  64. #define RT_MENUEX MAKEINTRESOURCE(15)
  65. #define RT_DIALOGEX MAKEINTRESOURCE(18)
  66. // These are here only temporary here they should in winuser.w
  67. #define RT_ANICURSOR MAKEINTRESOURCE(21)
  68. #define RT_ANIICON MAKEINTRESOURCE(22)
  69. #define RT_LAST MAKEINTRESOURCE(22)
  70. // AFX resource types (Should these be in winuser.h?)
  71. #define RT_DLGINIT MAKEINTRESOURCE(240)
  72. #define RT_TOOLBAR MAKEINTRESOURCE(241)
  73. #define GFE_ZEROINIT 0x0001
  74. #define GFE_SHORT 0x0002
  75. #ifdef MFR_POPUP
  76. #if (MFR_POPUP != 0x01) && (MFR_END != 0x80)
  77. #error MFR_POPUP or MFR_END definition(s) invalid
  78. #endif
  79. #else
  80. #define MFR_POPUP 0x01
  81. #define MFR_END 0x80
  82. #endif
  83. /* Single-byte control class IDs */
  84. #define BUTTONCODE 0x80
  85. #define EDITCODE 0x81
  86. #define STATICCODE 0x82
  87. #define LISTBOXCODE 0x83
  88. #define SCROLLBARCODE 0x84
  89. #define COMBOBOXCODE 0x85
  90. /* Translator flag bits */
  91. #define fVIRTKEY 1
  92. #define fNOINVERT 2
  93. #define fSHIFT 4
  94. #define fCONTROL 8
  95. #define fALT 16
  96. /* Menu flag bits */
  97. #define OPGRAYED 0x0001
  98. #define OPINACTIVE 0x0002 // INACTIVE | GRAYED
  99. #define OPBITMAP 0x0004
  100. #define OPOWNERDRAW 0x0100
  101. #define OPUSECHECKBITMAPS 0x0200
  102. #define OPCHECKED 0x0008
  103. #define OPPOPUP 0x0010
  104. #define OPBREAKWBAR 0x0020
  105. #define OPBREAK 0x0040
  106. #define OPENDMENU 0x0080
  107. #define OPHELP 0x4000
  108. #define OPSEPARATOR 0x0800
  109. /*#define OPPOPHELP 0x0004*/
  110. #define wcsdigit(w) (w >= 0x0030 && w <= 0x0039)
  111. /*
  112. ** dialog & menu template tokens (these start at 40)
  113. */
  114. /* buttons */
  115. #define TKRADIOBUTTON 40
  116. #define TKCHECKBOX 41
  117. #define TKPUSHBUTTON 42
  118. #define TKDEFPUSHBUTTON 43
  119. #define TKAUTOCHECK 44
  120. #define TK3STATE 45
  121. #define TKAUTO3 46
  122. #define TKUSERBUTTON 47
  123. #define TKAUTORADIO 48
  124. #define TKOWNERDRAW 50
  125. #define TKGROUPBOX 51
  126. #define TKPUSHBOX 52
  127. /* static/edit */
  128. #define TKBEDIT 57
  129. #define TKHEDIT 58
  130. #define TKIEDIT 59
  131. #define TKEDITTEXT 60
  132. #define TKLTEXT 61
  133. #define TKRTEXT 62
  134. #define TKCTEXT 63
  135. #define TKEDIT 64
  136. #define TKSTATIC 65
  137. #define TKICON 66
  138. #define TKBITMAP 67
  139. /* menu stuff */
  140. #define TKMENU 70
  141. #define TKMENUITEM 71
  142. #define TKSEPARATOR 72
  143. #define TKCHECKED 73
  144. #define TKGRAYED 74
  145. #define TKINACTIVE 75
  146. #define TKBREAKWBAR 76
  147. #define TKBREAK 77
  148. #define TKPOPUP 78
  149. #define TKHELP 79
  150. /* other controls */
  151. #define TKLISTBOX 90
  152. #define TKCOMBOBOX 91
  153. #define TKRCDATA 92
  154. #define TKSCROLLBAR 93
  155. #define TKFONT 94
  156. #define TKBUTTON 95
  157. #define TKMESSAGETABLE 96
  158. /* math expression tokens */
  159. #define TKCLASS 100
  160. #define TKPLUS 101
  161. #define TKMINUS 102
  162. #define TKNOINVERT 103
  163. #define TKNOT 104
  164. #define TKKANJI 105
  165. #define TKSHIFT 106
  166. /* Accel table */
  167. #define TKALT 110
  168. #define TKASCII 111
  169. #define TKVIRTKEY 112
  170. #define TKVALUE 113
  171. #define TKBLOCK 114
  172. /* verison */
  173. #define TKFILEVERSION 120
  174. #define TKPRODUCTVERSION 121
  175. #define TKFILEFLAGSMASK 122
  176. #define TKFILEFLAGS 123
  177. #define TKFILEOS 124
  178. #define TKFILETYPE 125
  179. #define TKFILESUBTYPE 126
  180. /* misc */
  181. #define TKCHARACTERISTICS 130
  182. #define TKLANGUAGE 131
  183. #define TKVERSION 132
  184. #define TKSTYLE 133
  185. #define TKCONTROL 134
  186. #define TKCAPTION 135
  187. #define TKDLGINCLUDE 136
  188. #define TKLSTR 137
  189. #define TKDLGINIT 138
  190. #define TKEXSTYLE 0xf7 /* so as not to conflict with x-coordinate */
  191. /* memory and load flags */
  192. #define TKFIXED 0xfff0
  193. #define TKMOVEABLE 0xfff1
  194. #define TKDISCARD 0xfff2
  195. #define TKLOADONCALL 0xfff3
  196. #define TKPRELOAD 0xfff4
  197. #define TKPURE 0xfff5
  198. #define TKIMPURE 0xfff6
  199. /* special tokens */
  200. #define CHCARRIAGE L'\r'
  201. #define CHSPACE L' '
  202. #define CHNEWLINE L'\n'
  203. //??#define CHTAB 9
  204. #define CHTAB L'\t'
  205. #define CHDIRECTIVE L'#'
  206. #define CHQUOTE L'"'
  207. #define CHEXTENSION L'.'
  208. #define CHCSOURCE L'c'
  209. #define CHCHEADER L'h'
  210. #define CHCOMMENT L';'
  211. #define DEBUGLEX 1
  212. #define DEBUGPAR 2
  213. #define DEBUGGEN 4
  214. /* End of file character/token */
  215. #define EOFMARK 127
  216. /* Single character keywords that we ignore */
  217. #define LPAREN 1 /* ( */
  218. #define RPAREN 2 /* ) */
  219. /* multiple character keywords */
  220. #define FIRSTKWD 11 /* for adding to table indices */
  221. #define OR FIRSTKWD+1
  222. #define BEGIN FIRSTKWD+2
  223. #define END FIRSTKWD+3
  224. #define COMMA FIRSTKWD+4
  225. #define TILDE FIRSTKWD+5
  226. #define AND FIRSTKWD+6
  227. #define EQUAL FIRSTKWD+7 // AFX
  228. #define LASTKWD FIRSTKWD+8 // 19
  229. /* Token types */
  230. #define NUMLIT LASTKWD+1 // 20
  231. #define STRLIT LASTKWD+2
  232. #define CHARLIT LASTKWD+3
  233. #define LSTRLIT LASTKWD+4 // AFX
  234. /* The following switches, when defined enable various options
  235. ** #define DEBUG enables debugging output. Use one or more of the
  236. ** values defined above to enable debugging output for different modules */
  237. /* Version number. VERSION and REVISION are used to set the API number
  238. ** in an RCed file. SIGNON_* are used just to print the signon banner.
  239. ** Changing VERSION and REVISION means that applications RCed with this
  240. ** version will not run with earlier versions of Windows. */
  241. //#define VERSION 2
  242. #define REVISION 03
  243. #define SIGNON_VER 4
  244. #define SIGNON_REV 00
  245. /* GetToken() flags */
  246. #define TOKEN_NOEXPRESSION 0x8000
  247. /* Current token structure */
  248. #define MAXSTR (4096+1) // AFX defines this as 255
  249. #define MAXTOKSTR (256+1)
  250. // New Menu Template Parsing structures/definitions
  251. // New menu template format
  252. //
  253. // MenuName MENUEX
  254. // BEGIN
  255. // [MENUITEM "text" [, [id] [, [type] [, [state]]]]]
  256. // [POPUP "text" [, [id] [, [type] [, [state] [, [help id]]]]]
  257. // BEGIN
  258. // [MENUITEM "text" [, [id] [, [type] [, [state]]]]]
  259. // ...
  260. // END]
  261. // ...
  262. // END
  263. typedef struct tagMENU
  264. {
  265. DWORD dwID;
  266. DWORD dwType;
  267. DWORD dwState;
  268. DWORD dwHelpID;
  269. WORD wResInfo;
  270. WCHAR szText[MAXTOKSTR];
  271. } MENU, *PMENU;
  272. typedef enum
  273. {
  274. PT_WORD = 0,
  275. PT_DWORD,
  276. PT_TEXT
  277. } PARSETYPE;
  278. typedef enum
  279. {
  280. PTO_WORD = 0x80,
  281. PTO_DWORD,
  282. PTO_TEXT
  283. } OPARSETYPE;
  284. typedef enum
  285. {
  286. PAR_POPUP = 0,
  287. PAR_MENUITEM,
  288. PAR_MENU
  289. } PARCELTYPE;
  290. #define PT_OPTIONAL 0x80
  291. typedef struct tagPARCEL
  292. {
  293. WORD *pwEnd;
  294. BYTE *pwParms;
  295. } PARCEL;
  296. typedef struct tagKEY
  297. {
  298. PWCHAR kwd;
  299. WORD kwdval;
  300. } KEY, *PKEY;
  301. typedef struct tagSKEY
  302. {
  303. WCHAR skwd;
  304. UINT skwdval; /* changed from a char */
  305. } SKEY, *PSKEY;
  306. #pragma pack(2)
  307. typedef struct tagSYMINFO
  308. {
  309. WCHAR name[MAX_SYMBOL + 1];/* symbol for the resource if available */
  310. WCHAR file[_MAX_PATH];
  311. WORD line;
  312. WORD nID;
  313. } SYMINFO, *PSYMINFO;
  314. typedef struct tagTOKEN
  315. {
  316. LONG longval;
  317. int row; /* line number of current token */
  318. int col; /* column number of current token */
  319. BOOL flongval; /* is parsed number a long? */
  320. USHORT val;
  321. UCHAR type;
  322. UCHAR realtype;
  323. SYMINFO sym;
  324. } TOKEN, *PTOKEN;
  325. typedef struct tagFONTDIR
  326. {
  327. USHORT ordinal;
  328. USHORT nbyFont;
  329. struct tagFONTDIR *next;
  330. } FONTDIR, *PFONTDIR;
  331. typedef struct tagOBJLST
  332. {
  333. struct tagOBJLST *next;
  334. DWORD nObj; /* objecty number */
  335. DWORD cb; /* number of bytes used */
  336. DWORD cpg; /* number of pages used */
  337. DWORD flags; /* object memory flags */
  338. } OBJLST, *POBJLST;
  339. typedef struct tagCTRL
  340. {
  341. SHORT x;
  342. SHORT y;
  343. SHORT cx;
  344. SHORT cy;
  345. WCHAR fOrdinalText;
  346. WCHAR text[MAXTOKSTR];
  347. DWORD id;
  348. WCHAR Class[MAXTOKSTR];
  349. DWORD dwStyle;
  350. DWORD dwExStyle;
  351. DWORD dwHelpID;
  352. } CTRL, *PCTRL;
  353. typedef struct tagDLGHDR
  354. {
  355. SHORT x;
  356. SHORT y;
  357. SHORT cx;
  358. SHORT cy;
  359. UCHAR fOrdinalMenu;
  360. UCHAR fClassOrdinal;
  361. DWORD dwStyle;
  362. DWORD dwExStyle;
  363. WORD bNumberOfItems;
  364. WCHAR Title[MAXTOKSTR];
  365. WCHAR MenuName[MAXTOKSTR];
  366. WCHAR Class[MAXTOKSTR];
  367. WCHAR Font[MAXTOKSTR];
  368. WORD pointsize;
  369. WORD wWeight;
  370. BYTE bItalic;
  371. BYTE bCharSet;
  372. DWORD dwHelpID;
  373. } DLGHDR, *PDLGHDR;
  374. typedef struct tagMENUHDR
  375. {
  376. USHORT menuTemplateVersionNumber;
  377. USHORT menuTemplateBytesInHeader;
  378. } MENUHDR, *PMENUHDR;
  379. typedef struct tagMENUITEM
  380. {
  381. SHORT id;
  382. WCHAR szText[ MAXTOKSTR ];
  383. WORD OptFlags;
  384. WORD PopFlag;
  385. } MENUITEM, *PMENUITEM;
  386. #define BLOCKSIZE 16
  387. typedef struct tagRCSTRING
  388. {
  389. struct tagRCSTRING *next;
  390. DWORD version;
  391. DWORD characteristics;
  392. USHORT hibits;
  393. SHORT flags;
  394. WORD language;
  395. PWCHAR rgsz[ BLOCKSIZE ];
  396. PSYMINFO rgsym[ BLOCKSIZE ];
  397. } RCSTRING, *PRCSTRING;
  398. typedef struct tagRCACCEL
  399. {
  400. WORD flags;
  401. WCHAR ascii;
  402. USHORT id;
  403. USHORT unused;
  404. } RCACCEL, *PRCACCEL;
  405. typedef struct tagRESINFO
  406. {
  407. DWORD version;
  408. DWORD characteristics;
  409. LONG exstyleT;
  410. LONG BinOffset;
  411. LONG size;
  412. struct tagRESINFO *next;
  413. WORD *poffset;
  414. PWCHAR name;
  415. POBJLST pObjLst;
  416. WORD language;
  417. SHORT flags;
  418. USHORT nameord;
  419. USHORT cLang;
  420. SYMINFO sym;
  421. } RESINFO, *PRESINFO;
  422. typedef struct tagTYPEINFO
  423. {
  424. struct tagTYPEINFO *next;
  425. PRESINFO pres;
  426. PWCHAR type;
  427. USHORT typeord;
  428. USHORT cTypeStr;
  429. USHORT cNameStr;
  430. SHORT nres;
  431. } TYPEINFO, *PTYPEINFO;
  432. #pragma pack()
  433. /* ----- Global variables ----- */
  434. extern SHORT ResCount;
  435. extern PTYPEINFO pTypInfo;
  436. extern UINT uiDefaultCodePage;
  437. extern UINT uiCodePage;
  438. extern SHORT nFontsRead;
  439. extern PFONTDIR pFontList;
  440. extern PFONTDIR pFontLast;
  441. extern TOKEN token;
  442. extern int errorCount;
  443. extern WCHAR tokenbuf[MAXSTR + 1]; // +1 is to allow double sz termination
  444. extern UCHAR exename[_MAX_PATH], fullname[_MAX_PATH];
  445. extern UCHAR curFile[_MAX_PATH];
  446. extern WORD language;
  447. extern LONG version;
  448. extern LONG characteristics;
  449. extern PDLGHDR pLocDlg;
  450. extern UINT mnEndFlagLoc; /* patch location for end of a menu. */
  451. /* we set the high order bit there */
  452. extern BOOL fVerbose; /* verbose mode (-v) */
  453. extern BOOL fAFXSymbols;
  454. extern BOOL fMacRsrcs;
  455. extern BOOL fAppendNull;
  456. extern BOOL fWarnInvalidCodePage;
  457. extern BOOL fSkipDuplicateCtlIdWarning;
  458. extern long lOffIndex;
  459. extern WORD idBase;
  460. extern PCHAR szTempFileName;
  461. extern PCHAR szTempFileName2;
  462. extern CHAR inname[_MAX_PATH];
  463. extern PFILE fhBin;
  464. extern PFILE fhInput;
  465. extern PFILE fhCode;
  466. extern PCHAR pchInclude;
  467. extern SHORT k1,k2,k3,k4;
  468. extern PRESINFO pResString;
  469. extern HINSTANCE hInstance;
  470. extern HANDLE hHeap;
  471. extern int nBogusFontNames;
  472. extern WCHAR *pszBogusFontNames[16];
  473. extern WCHAR szSubstituteFontName[MAXTOKSTR];
  474. /*---------------------------------------------------------------------------*/
  475. /* */
  476. /* rcl.c */
  477. /* */
  478. /*---------------------------------------------------------------------------*/
  479. int FileChar();
  480. USHORT FindKwd(PWCHAR);
  481. WCHAR GetCharFTB();
  482. PWSTR GetWord(PWSTR);
  483. LONG GetDNum();
  484. LONG GetExpression();
  485. PWCHAR GetGenText();
  486. int GetKwd(int);
  487. int GetNameOrd();
  488. VOID GetNum();
  489. VOID GetNumFTB();
  490. VOID GetNumNoExpression();
  491. LONG GetONum();
  492. LONG GetOperand();
  493. int GetOperator(PWCHAR pOperator);
  494. VOID GetStr();
  495. int GetToken(int);
  496. LONG GetXNum();
  497. void LexError1(int iMsg);
  498. void LexError2(int iMsg, PCHAR str);
  499. int LexInit(PFILE);
  500. WCHAR LitChar();
  501. WCHAR OurGetChar();
  502. VOID SkipWhitespace();
  503. /*---------------------------------------------------------------------------*/
  504. /* */
  505. /* rcp.c */
  506. /* */
  507. /*---------------------------------------------------------------------------*/
  508. VOID AddBinEntry(PTYPEINFO, PRESINFO, PCHAR , int, LONG);
  509. VOID AddDefaultTypes();
  510. VOID AddFontDir();
  511. VOID AddResToResFile (PTYPEINFO, PRESINFO, PCHAR, int, LONG);
  512. PTYPEINFO AddResType (PWCHAR, LPWSTR);
  513. VOID AddStringToBin(USHORT, PWCHAR);
  514. int DGetMemFlags(PRESINFO);
  515. LONG GetFileName (VOID);
  516. VOID ParseError1(int);
  517. VOID ParseError2(int, PWCHAR); // AFX has 1&2 -- NT just has ParseError
  518. VOID ParseError3(int);
  519. int ReadRF(VOID);
  520. WORD GetLanguage(VOID);
  521. /*---------------------------------------------------------------------------*/
  522. /* */
  523. /* rcstring.c */
  524. /* */
  525. /*---------------------------------------------------------------------------*/
  526. VOID WriteTable (PRESINFO);
  527. int GetAccelerators (PRESINFO);
  528. PRESINFO GetTable (PRESINFO);
  529. PCHAR MyFAlloc(UINT, PCHAR);
  530. /*---------------------------------------------------------------------------*/
  531. /* */
  532. /* rctg.c */
  533. /* */
  534. /*---------------------------------------------------------------------------*/
  535. DWORD GetNewBitmap(void);
  536. BOOL AddFontRes(PRESINFO);
  537. VOID AppendString(PWCHAR, BOOL);
  538. VOID CtlAlloc();
  539. PFILE CtlFile(PFILE);
  540. VOID CtlFree();
  541. VOID CtlInit();
  542. VOID FixMenuPatch();
  543. VOID GenWarning2(int iMsg, PCHAR arg);
  544. VOID GenWarning4(int iMsg, PCHAR arg1, PCHAR arg2, PCHAR arg3);
  545. VOID GenError1(int iMsg);
  546. VOID GenError2(int iMsg, PCHAR arg);
  547. WORD GetBufferLen();
  548. void SetItemCount(int Index, USHORT wCount);
  549. USHORT GetItemCount(int Index);
  550. DWORD GetIcon(LONG);
  551. DWORD GetAniIconsAniCursors(LONG nbyFile);
  552. DWORD FileIsAnimated(LONG nbyFile);
  553. VOID GetNewIconsCursors(PTYPEINFO, PRESINFO, LPWSTR);
  554. WORD GetRCData(PRESINFO);
  555. PCHAR GetSpace(WORD cb);
  556. VOID IncItemCount();
  557. VOID SwapItemCount(VOID);
  558. void FixMenuPatch (WORD);
  559. void FixOldMenuPatch (WORD);
  560. VOID MarkAccelFlagsByte();
  561. VOID MarkMenuPatch();
  562. VOID PatchAccelEnd();
  563. LONG ResourceSize();
  564. VOID SaveResFile(PTYPEINFO, PRESINFO);
  565. void SetItemExtraCount(WORD, BOOL);
  566. void SetUpDlg (PDLGHDR, BOOL);
  567. void SetUpItem (PCTRL, BOOL);
  568. WORD SetUpMenu (PMENU);
  569. WORD SetUpOldMenu (PMENUITEM);
  570. VOID WriteAlign();
  571. VOID WriteBuffer(PCHAR, USHORT);
  572. int WriteControl(PFILE, PCHAR, int, LONG);
  573. VOID WriteString(PWCHAR, BOOL);
  574. VOID WriteMacString(PWCHAR sz, BOOL fMacCP, BOOL fPascal);
  575. int ExpandString(BYTE* pb, int cb, BYTE* pbExpand);
  576. WORD SwapWord(WORD w);
  577. DWORD SwapLong(DWORD dw);
  578. #define SwappedWord(w) (fMacRsrcs ? SwapWord(w) : (w))
  579. #define SwappedLong(dw) (fMacRsrcs ? SwapLong(dw) : (dw))
  580. #define WriteByte(b) (*GetSpace(sizeof(CHAR)) = (b))
  581. #define WriteLong(dw) (*((DWORD UNALIGNED*) GetSpace(sizeof(DWORD))) = SwappedLong(dw))
  582. #define WriteWord(w) (*((WORD UNALIGNED*) GetSpace(sizeof(WORD))) = SwappedWord(w))
  583. /*---------------------------------------------------------------------------*/
  584. /* */
  585. /* rctp.c */
  586. /* */
  587. /*---------------------------------------------------------------------------*/
  588. #define GFE_ZEROINIT 0x0001
  589. #define GFE_SHORT 0x0002
  590. void DGetClassName (PDLGHDR);
  591. void DGetFont (PDLGHDR, BOOL);
  592. void DGetMenuName (PDLGHDR);
  593. void DGetTitle (PDLGHDR);
  594. BOOL DLexOptionalArgs(PRESINFO, PDLGHDR, BOOL);
  595. void DlgIncludeParse (PRESINFO); // new for NT
  596. WORD DoMenuItem (int);
  597. void GetCoords (PSHORT, PSHORT, PSHORT, PSHORT);
  598. VOID GetCtlCoords (PCTRL);
  599. VOID GetCtlID (PCTRL, BOOL);
  600. VOID GetCtlText (PCTRL);
  601. int GetDlg (PRESINFO, PDLGHDR, BOOL);
  602. int GetDlgItems (BOOL);
  603. BOOL GetFullExpression(void *pval, WORD wFlags);
  604. USHORT GetTokenNoComma (USHORT wFlags);
  605. USHORT ICGetTok ();
  606. int IsmnOption (UINT, PMENUITEM);
  607. VOID ParseCtl (PCTRL, BOOL);
  608. int ParseMenu (int, PRESINFO);
  609. int ParseOldMenu (int, PRESINFO);
  610. int VersionBlockStruct(PWCHAR pstrKey, PCHAR pstrValue, USHORT LenValue);
  611. int VersionBlockVariable(PWCHAR pstrKey);
  612. VOID VersionGet4Words(PDWORD pdw);
  613. VOID VersionGetDWord(PDWORD pdw);
  614. int VersionParse();
  615. USHORT VersionParseBlock();
  616. int VersionParseFixed();
  617. USHORT VersionParseValue(int IndexType); // void arg list in AFX
  618. int GetToolbar (PRESINFO);
  619. /*---------------------------------------------------------------------------*/
  620. /* */
  621. /* rcutil.c */
  622. /* */
  623. /*---------------------------------------------------------------------------*/
  624. VOID ExtractFileName(PWCHAR, PWCHAR);
  625. int iswhite (WCHAR);
  626. BOOL IsSwitchChar(CHAR);
  627. UINT MyAlign(PFILE);
  628. PVOID MyAlloc(UINT);
  629. int MyCopy (PFILE, PFILE, DWORD);
  630. int MyCopyAll (PFILE, PFILE);
  631. PVOID MyFree (PVOID);
  632. PWCHAR MyMakeStr(PWCHAR);
  633. UINT MyRead (PFILE, PVOID, UINT);
  634. LONG MySeek (PFILE, LONG, int);
  635. UINT MyWrite (PFILE, PVOID, UINT);
  636. VOID PreBeginParse(PRESINFO, int);
  637. VOID quit (PSTR);
  638. VOID searchenv(PCHAR, PCHAR, PCHAR);
  639. int strpre (PWCHAR, PWCHAR);
  640. DWORD wcsatoi(PWCHAR);
  641. PWCHAR wcsitow(LONG v, PWCHAR s, DWORD r);
  642. /*---------------------------------------------------------------------------*/
  643. /* */
  644. /* rcfutil.c */
  645. /* */
  646. /*---------------------------------------------------------------------------*/
  647. int fgetl (PWCHAR, int, BOOL, PFILE);
  648. /* ----- AFX Functionality ----- */
  649. #include "rcppx.h"
  650. LONG MakeFontDir(); // AFX only
  651. void SendWarning(PSTR str);
  652. void SendError(PSTR str);
  653. extern RC_PARSE_CALLBACK lpfnParseCallback;
  654. extern RC_MESSAGE_CALLBACK lpfnMessageCallback;
  655. extern HWND hWndCaller;
  656. #define fflush(errFile)
  657. void GetSymbolDef(int fReportError, WCHAR curChar);
  658. void GetSymbol(int fReportError, WCHAR curChar);
  659. BOOL InitSymbolInfo();
  660. BOOL TermSymbolInfo(PFILE fhresFile);
  661. void WriteSymbolUse(PSYMINFO sym);
  662. void WriteSymbolDef(PWCHAR name, PWCHAR value, PWCHAR file, WORD line, char flags);
  663. void WriteFileInfo(PRESINFO pRes, PTYPEINFO pType, PWCHAR szFileName);
  664. void WriteResInfo(PRESINFO pRes, PTYPEINFO pType, BOOL bWriteMapEntry);
  665. void WriteResIndex(PRESINFO pRes, PTYPEINFO pType);
  666. void UpdateStatus(unsigned nCode, unsigned long dwStatus);
  667. // offset in a macintosh resource file of the start of the resource data
  668. #define MACDATAOFFSET 256
  669. void GetMacIcon(TYPEINFO *pType, RESINFO *pRes);
  670. void GetMacCursor(TYPEINFO *pType, RESINFO *pRes);
  671. void WriteMacMap(void);
  672. BOOL IsIcon(TYPEINFO* ptype);
  673. #define res_type(ch1,ch2,ch3,ch4) (((unsigned long)(unsigned char)(ch1)<<24)| \
  674. ((unsigned long)(unsigned char)(ch2)<<16)| \
  675. ((unsigned long)(unsigned char)(ch3)<<8)| \
  676. ((unsigned long)(unsigned char)(ch4)))