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.

243 lines
5.6 KiB

  1. /*************************************************
  2. * upimeres.h *
  3. * *
  4. * Copyright (C) 1995-1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. #ifndef UPIMERES_H
  8. #define UPIMERES_H
  9. //DATA STRUCT USED IN icon resource
  10. #define ERR_RES_INVALID_BMP 0x01
  11. #define ERR_RES_INVALID_ICON 0x02
  12. #define ERR_RES_INVALID_VER 0x04
  13. #define ERR_RES_NO_BMP 0x10
  14. #define ERR_RES_NO_ICON 0x20
  15. #define ERR_RES_NO_VER 0x40
  16. #define ERR_CANNOT_UPRES 0x100
  17. #define BMPNAME TEXT("CHINESE")
  18. #define ICONNAME TEXT("IMEICO")
  19. #define DATANAME TEXT("IMECHARAC")
  20. //define in imedefs.h
  21. //these are HACK CODES, and depends on imedefs.h
  22. #define IDS_VER_INFO 0x0350
  23. #define IDS_ORG_NAME 0x0351
  24. //The block's ID is the high 12 bits of the string IDs in the block plus one
  25. #define STR_ID (IDS_VER_INFO >> 4) + 1
  26. //according to the file size check if it is a 20*20 bmp
  27. #define BMP_20_SIZE 358
  28. typedef struct tagICONDIRENTRY{
  29. BYTE bWidth;
  30. BYTE bHeight;
  31. BYTE bColorCount;
  32. BYTE bReserved;
  33. WORD wPlanes;
  34. WORD wBitCount;
  35. DWORD dwBytesInRes;
  36. DWORD dwImageOffset;
  37. }ICONDIRENTRY;
  38. typedef struct ICONDIR{
  39. WORD idReserved;
  40. WORD idType;
  41. WORD idCount;
  42. ICONDIRENTRY idEntries[1];
  43. }ICONHEADER;
  44. #define DEFAULT_CODEPAGE 1252
  45. #define MAJOR_RESOURCE_VERSION 4
  46. #define MINOR_RESOURCE_VERSION 0
  47. #define MAXSTR (256+1)
  48. //
  49. // An ID_WORD indicates the following WORD is an ordinal rather
  50. // than a string
  51. //
  52. #define ID_WORD 0xffff
  53. //typedef WCHAR *PWCHAR;
  54. typedef struct MY_STRING {
  55. ULONG discriminant; // long to make the rest of the struct aligned
  56. union u {
  57. struct {
  58. struct MY_STRING *pnext;
  59. ULONG ulOffsetToString;
  60. USHORT cbD;
  61. USHORT cb;
  62. TCHAR *sz;
  63. } ss;
  64. WORD Ordinal;
  65. } uu;
  66. } SDATA, *PSDATA, **PPSDATA;
  67. #define IS_STRING 1
  68. #define IS_ID 2
  69. // defines to make deferencing easier
  70. #define OffsetToString uu.ss.ulOffsetToString
  71. #define cbData uu.ss.cbD
  72. #define cbsz uu.ss.cb
  73. #define szStr uu.ss.sz
  74. typedef struct _RESNAME {
  75. struct _RESNAME *pnext; // The first three fields should be the
  76. PSDATA Name; // same in both res structures
  77. ULONG OffsetToData;
  78. PSDATA Type;
  79. ULONG SectionNumber;
  80. struct _RESNAME *pnextRes;
  81. ULONG DataSize;
  82. ULONG OffsetToDataEntry;
  83. USHORT ResourceNumber;
  84. USHORT NumberOfLanguages;
  85. WORD LanguageId;
  86. } RESNAME, *PRESNAME, **PPRESNAME;
  87. typedef struct _RESTYPE {
  88. struct _RESTYPE *pnext; // The first three fields should be the
  89. PSDATA Type; // same in both res structures
  90. ULONG OffsetToData;
  91. struct _RESNAME *NameHeadID;
  92. struct _RESNAME *NameHeadName;
  93. ULONG NumberOfNamesID;
  94. ULONG NumberOfNamesName;
  95. } RESTYPE, *PRESTYPE, **PPRESTYPE;
  96. typedef struct _UPDATEDATA {
  97. ULONG cbStringTable;
  98. PSDATA StringHead;
  99. PRESNAME ResHead;
  100. PRESTYPE ResTypeHeadID;
  101. PRESTYPE ResTypeHeadName;
  102. LONG Status;
  103. HANDLE hFileName;
  104. } UPDATEDATA, *PUPDATEDATA;
  105. //
  106. // Round up a byte count to a power of 2:
  107. //
  108. #define ROUNDUP(cbin, align) (((cbin) + (align) - 1) & ~((DWORD)(align) - 1))
  109. //
  110. // Return the remainder, given a byte count and a power of 2:
  111. //
  112. #define REMAINDER(cbin,align) (((align)-((cbin)&((align)-1)))&((align)-1))
  113. #define CBLONG (sizeof(LONG))
  114. #define BUFSIZE (4L * 1024L)
  115. //VERSION INFO related definitions
  116. //these are HACK CODES
  117. #define VER_ROOT 0
  118. #define VER_STR_INFO 1
  119. #define VER_LANG 2
  120. #define VER_COMP_NAME 3
  121. #define VER_FILE_DES 4
  122. #define VER_FILE_VER 5
  123. #define VER_INTL_NAME 6
  124. #define VER_LEGAL_CR 7
  125. #define VER_ORG_FILE_NAME 8
  126. #define VER_PRD_NAME 9
  127. #define VER_PRD_VER 10
  128. #define VER_VAR_FILE_INFO 11
  129. #define VER_TRANS 12
  130. #define VER_BLOCK_NUM 13
  131. #define VER_HEAD_LEN 0x98
  132. #define VER_TAIL_LEN 0x44
  133. #define VER_STR_INFO_OFF 0x5c
  134. #define VER_LANG_OFF 0x80
  135. #define VER_VAR_FILE_INFO_OFF 0x2c0
  136. typedef struct tagVERDATA{
  137. WORD cbBlock;
  138. WORD cbValue;
  139. WORD wKeyOffset;
  140. WORD wKeyNameSize;
  141. BOOL fUpdate; //need update flag
  142. }VERDATA;
  143. LONG
  144. AddResource(
  145. PSDATA Type,
  146. PSDATA Name,
  147. WORD Language,
  148. PUPDATEDATA pupd,
  149. PVOID lpData,
  150. ULONG cb
  151. );
  152. PSDATA
  153. AddStringOrID(
  154. LPCTSTR lp,
  155. PUPDATEDATA pupd
  156. );
  157. LONG
  158. WriteResFile(
  159. HANDLE hUpdate,
  160. TCHAR *pDstname);
  161. VOID
  162. FreeData(
  163. PUPDATEDATA pUpd
  164. );
  165. PRESNAME
  166. WriteResSection(
  167. PUPDATEDATA pUpdate,
  168. INT outfh,
  169. ULONG align,
  170. ULONG cbLeft,
  171. PRESNAME pResSave
  172. );
  173. BOOL
  174. EnumTypesFunc(
  175. HANDLE hModule,
  176. LPTSTR lpType,
  177. LONG lParam
  178. );
  179. BOOL
  180. EnumNamesFunc(
  181. HANDLE hModule,
  182. LPTSTR lpType,
  183. LPTSTR lpName,
  184. LONG lParam
  185. );
  186. BOOL
  187. EnumLangsFunc(
  188. HANDLE hModule,
  189. LPTSTR lpType,
  190. LPTSTR lpName,
  191. WORD language,
  192. LONG lParam
  193. );
  194. HANDLE BeginUpdateResourceEx(LPCTSTR,BOOL);
  195. BOOL UpdateResourceEx(HANDLE,LPCTSTR, LPCTSTR, WORD, LPVOID, DWORD);
  196. BOOL EndUpdateResourceEx(HANDLE, BOOL);
  197. BOOL ImeUpdateRes(LPCTSTR,LPCTSTR,LPCTSTR,LPCTSTR,LPCTSTR ,WORD);
  198. // ImeFilename, BitmapFilename, IconFilename, VersionString, OrgString, RcData
  199. // srcname: "\\c:\windows\system\Imegen.tpl"
  200. long MakeVerInfo(LPCTSTR,LPCTSTR,LPCTSTR,BYTE *);
  201. #endif //UPIMERES_H