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.

136 lines
4.1 KiB

  1. /*++
  2. (C) Copyright Microsoft Corporation 1988-2001
  3. Module Name:
  4. updres.h
  5. Author:
  6. Floyd A Rogers 2/7/92
  7. Revision History:
  8. Floyd Rogers
  9. Created
  10. v-michka Ported to Godot
  11. --*/
  12. #define DEFAULT_CODEPAGE 1252
  13. #define MAJOR_RESOURCE_VERSION 4
  14. #define MINOR_RESOURCE_VERSION 0
  15. #define BUTTONCODE 0x80
  16. #define EDITCODE 0x81
  17. #define STATICCODE 0x82
  18. #define LISTBOXCODE 0x83
  19. #define SCROLLBARCODE 0x84
  20. #define COMBOBOXCODE 0x85
  21. #define SEEK_SET 0
  22. #define SEEK_CUR 1
  23. #define SEEK_END 2
  24. #define MAXSTR (256+1)
  25. //
  26. // An ID_WORD indicates the following WORD is an ordinal rather
  27. // than a string
  28. //
  29. #define ID_WORD 0xffff
  30. typedef struct MY_STRING
  31. {
  32. ULONG discriminant; // long to make the rest of the struct aligned
  33. union u
  34. {
  35. struct
  36. {
  37. struct MY_STRING *pnext;
  38. ULONG ulOffsetToString;
  39. USHORT cbD;
  40. USHORT cb;
  41. WCHAR *sz;
  42. } ss;
  43. WORD Ordinal;
  44. } uu;
  45. } SDATA, *PSDATA, **PPSDATA;
  46. #define IS_STRING 1
  47. #define IS_ID 2
  48. // defines to make dereferencing easier
  49. #define OffsetToString uu.ss.ulOffsetToString
  50. #define cbData uu.ss.cbD
  51. #define cbsz uu.ss.cb
  52. #define szStr uu.ss.sz
  53. typedef struct _RESNAME
  54. {
  55. struct _RESNAME *pnext; // The first three fields should be the
  56. PSDATA Name; // same in both res structures
  57. ULONG OffsetToData;
  58. PSDATA Type;
  59. ULONG SectionNumber;
  60. ULONG DataSize;
  61. ULONG OffsetToDataEntry;
  62. USHORT ResourceNumber;
  63. USHORT NumberOfLanguages;
  64. WORD LanguageId;
  65. }RESNAME, *PRESNAME, **PPRESNAME;
  66. typedef struct _RESTYPE
  67. {
  68. struct _RESTYPE *pnext; // The first three fields should be the
  69. PSDATA Type; // same in both res structures
  70. ULONG OffsetToData;
  71. struct _RESNAME *NameHeadID;
  72. struct _RESNAME *NameHeadName;
  73. ULONG NumberOfNamesID;
  74. ULONG NumberOfNamesName;
  75. } RESTYPE, *PRESTYPE, **PPRESTYPE;
  76. typedef struct _UPDATEDATA
  77. {
  78. ULONG cbStringTable;
  79. PSDATA StringHead;
  80. PRESNAME ResHead;
  81. PRESTYPE ResTypeHeadID;
  82. PRESTYPE ResTypeHeadName;
  83. LONG Status;
  84. HANDLE hFileName;
  85. } UPDATEDATA, *PUPDATEDATA;
  86. //
  87. // Round up a byte count to a power of 2:
  88. //
  89. #define ROUNDUP(cbin, align) (((cbin) + (align) - 1) & ~((align) - 1))
  90. //
  91. // Return the remainder, given a byte count and a power of 2:
  92. //
  93. #define REMAINDER(cbin,align) (((align)-((cbin)&((align)-1)))&((align)-1))
  94. #define CBLONG (sizeof(LONG))
  95. #define BUFSIZE (4L * 1024L)
  96. /* functions for adding/deleting resources to update list */
  97. LONG AddResource(IN PSDATA Type, IN PSDATA Name, IN WORD Language, IN PUPDATEDATA pupd, IN PVOID lpData, IN ULONG cb);
  98. PSDATA AddStringOrID(LPCWSTR lp, PUPDATEDATA pupd);
  99. BOOL InsertResourceIntoLangList(PUPDATEDATA pUpd, PSDATA Type, PSDATA Name, PRESTYPE pType, PRESNAME pName, INT idLang, INT fName, INT cb, PVOID lpData);
  100. BOOL DeleteResourceFromList(PUPDATEDATA pUpd, PRESTYPE pType, PRESNAME pName, INT idLang, INT fType, INT fName);
  101. /* Prototypes for Enumeration done in BeginUpdateResource */
  102. BOOL EnumTypesFunc(HANDLE hModule, LPWSTR lpType, LONG lParam);
  103. BOOL EnumNamesFunc(HANDLE hModule, LPWSTR lpName, LPWSTR lpType, LONG lParam);
  104. BOOL EnumLangsFunc(HANDLE hModule, LPWSTR lpType, LPWSTR lpName, WORD languages, LONG lParam);
  105. /* Prototypes for general worker functions in updres.c */
  106. LONG WriteResFile(IN HANDLE hUpdate, IN WCHAR *pDstname);
  107. VOID FreeData(PUPDATEDATA pUpd);
  108. PRESNAME WriteResSection(PUPDATEDATA pUpdate, INT outfh, ULONG align, ULONG cbLeft, PRESNAME pResSave);
  109. LONG PatchRVAs(int inpfh, int outfh, PIMAGE_SECTION_HEADER po32, ULONG pagedelta, PIMAGE_NT_HEADERS pNew, ULONG OldSize);
  110. LONG PatchDebug(int inpfh, int outfh, PIMAGE_SECTION_HEADER po32DebugOld, PIMAGE_SECTION_HEADER po32DebugNew, PIMAGE_SECTION_HEADER po32DebugDirOld, PIMAGE_SECTION_HEADER po32DebugDirNew, PIMAGE_NT_HEADERS pOld, PIMAGE_NT_HEADERS pNew, ULONG ibMaxDbgOffsetOld, PULONG pPointerToRawData);