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.

166 lines
4.3 KiB

  1. //
  2. // patchprv.h
  3. //
  4. // Private interface options for creating patch files.
  5. //
  6. // Author: Tom McGuire (tommcg) 2/98
  7. //
  8. // Copyright (C) Microsoft, 1997-2000.
  9. //
  10. // MICROSOFT CONFIDENTIAL
  11. //
  12. #ifndef _PATCHPRV_H_
  13. #define _PATCHPRV_H_
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define PATCH_SIGNATURE '91AP' // PA19 patch signature
  18. #define PATCH_VERSION_TEXT "1.99"
  19. #define PATCH_RESOURCE_VER 1,99,341,0 // major, minor, build#, qfe#
  20. //
  21. // DONT FORGET TO CHANGE THE DLL VERSION NUMBER IN SRC_DLL.INC !!!!
  22. //
  23. typedef struct _RIFT_ENTRY {
  24. ULONG OldFileRva;
  25. ULONG NewFileRva;
  26. } RIFT_ENTRY, *PRIFT_ENTRY;
  27. typedef struct _RIFT_TABLE {
  28. ULONG RiftEntryCount;
  29. ULONG RiftEntryAlloc;
  30. PRIFT_ENTRY RiftEntryArray;
  31. PUCHAR RiftUsageArray;
  32. } RIFT_TABLE, *PRIFT_TABLE;
  33. typedef struct _PATCH_HEADER_OLD_FILE_INFO {
  34. HANDLE OldFileHandle;
  35. ULONG OldFileSize;
  36. ULONG OldFileCrc;
  37. ULONG PatchDataSize;
  38. ULONG IgnoreRangeCount;
  39. PPATCH_IGNORE_RANGE IgnoreRangeArray;
  40. ULONG RetainRangeCount;
  41. PPATCH_RETAIN_RANGE RetainRangeArray;
  42. RIFT_TABLE RiftTable;
  43. } HEADER_OLD_FILE_INFO, *PHEADER_OLD_FILE_INFO;
  44. typedef struct _PATCH_HEADER_INFO {
  45. ULONG Signature;
  46. ULONG OptionFlags;
  47. ULONG ExtendedOptionFlags;
  48. ULONG NewFileCoffBase;
  49. ULONG NewFileCoffTime;
  50. ULONG NewFileResTime;
  51. ULONG NewFileTime;
  52. ULONG NewFileSize;
  53. ULONG NewFileCrc;
  54. ULONG OldFileCount;
  55. PHEADER_OLD_FILE_INFO OldFileInfoArray;
  56. PPATCH_INTERLEAVE_MAP* InterleaveMapArray;
  57. ULONG WindowSize;
  58. } PATCH_HEADER_INFO, *PPATCH_HEADER_INFO;
  59. BOOL
  60. ProgressCallbackWrapper(
  61. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  62. IN PVOID CallbackContext,
  63. IN ULONG CurrentPosition,
  64. IN ULONG MaximumPosition
  65. );
  66. BOOL
  67. WINAPIV
  68. NormalizeOldFileImageForPatching(
  69. IN PVOID FileMappedImage,
  70. IN ULONG FileSize,
  71. IN ULONG OptionFlags,
  72. IN PVOID OptionData,
  73. IN ULONG NewFileCoffBase,
  74. IN ULONG NewFileCoffTime,
  75. IN ULONG IgnoreRangeCount,
  76. IN PPATCH_IGNORE_RANGE IgnoreRangeArray,
  77. IN ULONG RetainRangeCount,
  78. IN PPATCH_RETAIN_RANGE RetainRangeArray,
  79. ...
  80. );
  81. BOOL
  82. WINAPIV
  83. TransformOldFileImageForPatching(
  84. IN ULONG TransformOptions,
  85. IN PVOID OldFileMapped,
  86. IN ULONG OldFileSize,
  87. IN ULONG NewFileResTime,
  88. IN PRIFT_TABLE RiftTable,
  89. ...
  90. );
  91. BOOL
  92. DecodePatchHeader(
  93. IN PVOID PatchHeader,
  94. IN ULONG PatchHeaderMaxSize,
  95. IN HANDLE SubAllocator,
  96. OUT PULONG PatchHeaderActualSize,
  97. OUT PPATCH_HEADER_INFO *HeaderInfo
  98. );
  99. ULONG
  100. EncodePatchHeader(
  101. IN PPATCH_HEADER_INFO HeaderInfo,
  102. OUT PVOID PatchHeaderBuffer
  103. );
  104. //
  105. // The following is a private flag to indicate external rift data is being
  106. // specified in the OptionData->OldFileSymbolPathArray[ OldFileIndex ] field
  107. // (really a PRIFT_TABLE pointer).
  108. //
  109. #define PATCH_SYMBOL_EXTERNAL_RIFT PATCH_SYMBOL_RESERVED1
  110. //
  111. // The following is an internal flag stored in the patch header to indicate
  112. // the ExtendedOptionFlags field is present (non-zero) in the header. It is
  113. // never necessary to specify this flag when creating a patch.
  114. //
  115. #define PATCH_OPTION_EXTENDED_OPTIONS PATCH_OPTION_RESERVED1
  116. //
  117. // Following are flags in the ExtendedOptionFlags field.
  118. //
  119. #define PATCH_TRANSFORM_NO_RELOCS 0x00000001 // don't xform relocs
  120. #define PATCH_TRANSFORM_NO_IMPORTS 0x00000002 // don't xform imports
  121. #define PATCH_TRANSFORM_NO_EXPORTS 0x00000004 // don't xform exports
  122. #define PATCH_TRANSFORM_NO_RELJMPS 0x00000008 // don't xform E9 or 0F 8x instructions
  123. #define PATCH_TRANSFORM_NO_RELCALLS 0x00000010 // don't xform E8 instructions
  124. #define PATCH_TRANSFORM_NO_RESOURCE 0x00000020 // don't xform resources
  125. #define PATCH_OPTION_SPECIFIED_WINDOW 0x00010000 // lzx window size encoded
  126. VOID
  127. __fastcall
  128. RiftQsort(
  129. PRIFT_ENTRY LowerBound,
  130. PRIFT_ENTRY UpperBound
  131. );
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif // _PATCHPRV_H_