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.

149 lines
6.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Helper Function Declarations for res32/win32 r/w
  3. /////////////////////////////////////////////////////////////////////////////
  4. /////////////////////////////////////////////////////////////////////////////
  5. // General Declarations
  6. #define Pad4(x) ((((x+3)>>2)<<2)-x)
  7. #define PadPtr(x) ((((x+(sizeof(PVOID)-1))/sizeof(PVOID))*sizeof(PVOID))-x)
  8. #define Pad16(x) ((((x+15)>>4)<<4)-x)
  9. #define MAXSTR 8192
  10. #define LPNULL 0L
  11. #define MAXLEVELS 3
  12. #define MFR_POPUP (MF_POPUP > 1) // Chicago file specific
  13. /////////////////////////////////////////////////////////////////////////////
  14. // General type Declarations
  15. typedef unsigned char UCHAR;
  16. typedef UCHAR * PUCHAR;
  17. typedef BYTE far * far * LPLPBYTE;
  18. typedef struct tagResSectData
  19. {
  20. ULONG ulOffsetToResources; // File offset to the .rsrc
  21. ULONG ulVirtualAddress; //... Virtual address of section .rsrc
  22. ULONG ulSizeOfResources; //... Size of resources in section .rsrc
  23. ULONG ulOffsetToResources1; // File offset to the .rsrc1
  24. ULONG ulVirtualAddress1; //... Virtual address of section .rsrc1
  25. ULONG ulSizeOfResources1; //... Size of resources in section .rsrc1
  26. } RESSECTDATA, *PRESSECTDATA;
  27. typedef struct ver_block {
  28. WORD wBlockLen;
  29. WORD wValueLen;
  30. WORD wType;
  31. WORD wHead;
  32. BYTE far * pValue;
  33. char szKey[100];
  34. char szValue[256];
  35. } VER_BLOCK;
  36. VOID InitGlobals();
  37. UINT GetNameOrOrdU( PUCHAR pRes,
  38. ULONG ulId,
  39. LPWSTR lpwszStrId,
  40. DWORD* pdwId );
  41. UINT GetStringW( BYTE far * far* lplpBuf, LPSTR lpszText, LONG* pdwSize, WORD cLen );
  42. UINT GetStringA( BYTE far * far* lplpBuf, LPSTR lpszText, LONG* pdwSize );
  43. UINT GetPascalString( BYTE far * far* lplpBuf,
  44. LPSTR lpszText,
  45. WORD wMaxLen,
  46. LONG* pdwSize );
  47. UINT GetMsgStr( BYTE far * far* lplpBuf,
  48. LPSTR lpszText,
  49. WORD wMaxLen,
  50. WORD* pwLen,
  51. WORD* pwFlags,
  52. LONG* pdwSize );
  53. UINT PutMsgStr( BYTE far * far* lplpBuf, LPSTR lpszText, WORD wFlags, LONG* pdwSize );
  54. // Simulate the WideChar to multibyte
  55. extern UINT g_cp/* = CP_ACP*/; // Default to CP_ACP
  56. extern BOOL g_bAppend/* = FALSE*/; //Default to FALSE
  57. extern BOOL g_bUpdOtherResLang; /* = FALSE*/; //Default to FALSE
  58. extern char g_char[2]/* = FALSE*/; //Default to FALSE
  59. UINT _MBSTOWCS( WCHAR * pwszOut, CHAR * pszIn, UINT nLength);
  60. UINT _WCSTOMBS( CHAR * pszOut, WCHAR * wszIn, UINT nLength);
  61. UINT _WCSLEN( WCHAR * pwszIn );
  62. BYTE PutDWord( BYTE far * far* lplpBuf, DWORD dwValue, LONG* pdwSize );
  63. BYTE PutDWordPrt( BYTE far * far* lplpBuf, DWORD_PTR dwValue, LONG* pdwSize );
  64. BYTE PutWord( BYTE far * far* lplpBuf, WORD wValue, LONG* pdwSize );
  65. BYTE PutByte( BYTE far * far* lplpBuf, BYTE bValue, LONG* pdwSize );
  66. UINT PutStringA( BYTE far * far* lplpBuf, LPSTR lpszText, LONG* pdwSize );
  67. UINT PutStringW( BYTE far * far* lplpBuf, LPSTR lpszText, LONG* pdwSize );
  68. UINT PutNameOrOrd( BYTE far * far* lplpBuf, WORD wOrd, LPSTR lpszText, LONG* pdwSize );
  69. UINT PutCaptionOrOrd( BYTE far * far* lplpBuf, WORD wOrd, LPSTR lpszText, LONG* pdwSize,
  70. WORD wClass, DWORD dwStyle );
  71. UINT PutClassName( BYTE far * far* lplpBuf, WORD bClass, LPSTR lpszText, LONG* pdwSize );
  72. UINT PutPascalStringW( BYTE far * far* lplpBuf, LPSTR lpszText, WORD wLen, LONG* pdwSize );
  73. UINT SkipByte( BYTE far * far * lplpBuf, UINT uiSkip, LONG* pdwRead );
  74. BYTE GetDWord( BYTE far * far* lplpBuf, DWORD* dwValue, LONG* pdwSize );
  75. BYTE GetWord( BYTE far * far* lplpBuf, WORD* wValue, LONG* pdwSize );
  76. BYTE GetByte( BYTE far * far* lplpBuf, BYTE* bValue, LONG* pdwSize );
  77. UINT GetNameOrOrd( BYTE far * far* lplpBuf, WORD* wOrd, LPSTR lpszText, LONG* pdwSize );
  78. UINT GetCaptionOrOrd( BYTE far * far* lplpBuf, WORD* wOrd, LPSTR lpszText, LONG* pdwSize,
  79. WORD wClass, DWORD dwStyle );
  80. UINT GetClassName( BYTE far * far* lplpBuf, WORD* bClass, LPSTR lpszText, LONG* pdwSize );
  81. UINT GetVSBlock( BYTE far * far* lplpBuf, LONG* pdwSize, VER_BLOCK* pBlock );
  82. UINT PutVSBlock( BYTE far * far * lplpImage, LONG* pdwSize, VER_BLOCK verBlock,
  83. LPSTR lpStr, BYTE far * far * lplpBlockSize, WORD wPad);
  84. UINT ParseMenu( LPVOID lpImageBuf, DWORD dwImageSize, LPVOID lpBuffer, DWORD dwSize );
  85. UINT ParseString( LPVOID lpImageBuf, DWORD dwImageSize, LPVOID lpBuffer, DWORD dwSize );
  86. UINT ParseDialog( LPVOID lpImageBuf, DWORD dwISize, LPVOID lpBuffer, DWORD dwSize );
  87. UINT ParseMsgTbl( LPVOID lpImageBuf, DWORD dwISize, LPVOID lpBuffer, DWORD dwSize );
  88. UINT ParseAccel( LPVOID lpImageBuf, DWORD dwImageSize, LPVOID lpBuffer, DWORD dwSize );
  89. UINT ParseVerst( LPVOID lpImageBuf, DWORD dwImageSize, LPVOID lpBuffer, DWORD dwSize );
  90. // These functions will take the image as is and will return just one item
  91. // In this way the IODLL will assume there are items in the immage and will
  92. // procede with the normal function.
  93. UINT ParseEmbeddedFile( LPVOID lpImageBuf, DWORD dwImageSize, LPVOID lpBuffer, DWORD dwSize );
  94. UINT UpdateMenu( LPVOID lpNewBuf, LONG dwNewSize,
  95. LPVOID lpOldImage, LONG dwOldImageSize,
  96. LPVOID lpNewImage, DWORD* pdwNewImageSize );
  97. UINT UpdateMsgTbl( LPVOID lpNewBuf, LONG dwNewSize,
  98. LPVOID lpOldImage, LONG dwOldImageSize,
  99. LPVOID lpNewImage, DWORD* pdwNewImageSize );
  100. UINT UpdateAccel( LPVOID lpNewBuf, LONG dwNewSize,
  101. LPVOID lpOldImage, LONG dwOldImageSize,
  102. LPVOID lpNewImage, DWORD* pdwNewImageSize );
  103. UINT UpdateDialog( LPVOID lpNewBuf, LONG dwNewSize,
  104. LPVOID lpOldI, LONG dwOldImageSize,
  105. LPVOID lpNewI, DWORD* pdwNewImageSize );
  106. UINT UpdateString( LPVOID lpNewBuf, LONG dwNewSize,
  107. LPVOID lpOldI, LONG dwOldImageSize,
  108. LPVOID lpNewI, DWORD* pdwNewImageSize );
  109. UINT UpdateVerst( LPVOID lpNewBuf, LONG dwNewSize,
  110. LPVOID lpOldI, LONG dwOldImageSize,
  111. LPVOID lpNewI, DWORD* pdwNewImageSize );
  112. UINT GenerateMenu( LPVOID lpNewBuf, LONG dwNewSize,
  113. LPVOID lpNewI, DWORD* pdwNewImageSize );
  114. UINT GenerateDialog( LPVOID lpNewBuf, LONG dwNewSize,
  115. LPVOID lpNewI, DWORD* pdwNewImageSize );
  116. UINT GenerateString( LPVOID lpNewBuf, LONG dwNewSize,
  117. LPVOID lpNewI, DWORD* pdwNewImageSize );
  118. UINT GenerateAccel( LPVOID lpNewBuf, LONG dwNewSize,
  119. LPVOID lpNewI, DWORD* pdwNewImageSize );
  120. UINT CopyFile( CFile* filein, CFile* fileout );
  121. DWORD FixCheckSum( LPCSTR ImageName);
  122. DWORD GenerateTransField( WORD wLang, BOOL bMode );
  123. void GenerateTransField( WORD wLang, VER_BLOCK * pVer );
  124. LONG Allign( LPLPBYTE lplpBuf, LONG* plBufSize, LONG lSize );