Leaked source code of windows server 2003
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.

798 lines
24 KiB

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