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.

140 lines
3.6 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-1998.
  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. typedef struct _RIFT_ENTRY {
  19. ULONG OldFileRva;
  20. ULONG NewFileRva;
  21. } RIFT_ENTRY, *PRIFT_ENTRY;
  22. typedef struct _RIFT_TABLE {
  23. ULONG RiftEntryCount;
  24. ULONG RiftEntryAlloc;
  25. PRIFT_ENTRY RiftEntryArray;
  26. PUCHAR RiftUsageArray;
  27. } RIFT_TABLE, *PRIFT_TABLE;
  28. typedef struct _PATCH_HEADER_OLD_FILE_INFO {
  29. HANDLE OldFileHandle;
  30. ULONG OldFileSize;
  31. ULONG OldFileCrc;
  32. ULONG PatchDataSize;
  33. ULONG IgnoreRangeCount;
  34. PPATCH_IGNORE_RANGE IgnoreRangeArray;
  35. ULONG RetainRangeCount;
  36. PPATCH_RETAIN_RANGE RetainRangeArray;
  37. RIFT_TABLE RiftTable;
  38. } HEADER_OLD_FILE_INFO, *PHEADER_OLD_FILE_INFO;
  39. typedef struct _PATCH_HEADER_INFO {
  40. ULONG Signature;
  41. ULONG OptionFlags;
  42. ULONG ExtendedOptionFlags;
  43. PVOID OptionData;
  44. ULONG NewFileCoffBase;
  45. ULONG NewFileCoffTime;
  46. ULONG NewFileResTime;
  47. ULONG NewFileTime;
  48. ULONG NewFileSize;
  49. ULONG NewFileCrc;
  50. ULONG OldFileCount;
  51. PHEADER_OLD_FILE_INFO OldFileInfoArray;
  52. } PATCH_HEADER_INFO, *PPATCH_HEADER_INFO;
  53. BOOL
  54. ProgressCallbackWrapper(
  55. IN PPATCH_PROGRESS_CALLBACK ProgressCallback,
  56. IN PVOID CallbackContext,
  57. IN ULONG CurrentPosition,
  58. IN ULONG MaximumPosition
  59. );
  60. BOOL
  61. WINAPIV
  62. NormalizeOldFileImageForPatching(
  63. IN PVOID FileMappedImage,
  64. IN ULONG FileSize,
  65. IN ULONG OptionFlags,
  66. IN PVOID OptionData,
  67. IN ULONG NewFileCoffBase,
  68. IN ULONG NewFileCoffTime,
  69. IN ULONG IgnoreRangeCount,
  70. IN PPATCH_IGNORE_RANGE IgnoreRangeArray,
  71. IN ULONG RetainRangeCount,
  72. IN PPATCH_RETAIN_RANGE RetainRangeArray,
  73. ...
  74. );
  75. BOOL
  76. WINAPIV
  77. TransformOldFileImageForPatching(
  78. IN ULONG TransformOptions,
  79. IN PVOID OldFileMapped,
  80. IN ULONG OldFileSize,
  81. IN ULONG NewFileResTime,
  82. IN PRIFT_TABLE RiftTable,
  83. ...
  84. );
  85. //
  86. // The following is a private flag to indicate external rift data is being
  87. // specified in the OptionData->OldFileSymbolPathArray[ OldFileIndex ] field
  88. // (really a PRIFT_TABLE pointer).
  89. //
  90. #define PATCH_SYMBOL_EXTERNAL_RIFT PATCH_SYMBOL_RESERVED1
  91. //
  92. // The following is an internal flag stored in the patch header to indicate
  93. // the ExtendedOptionFlags field is present (non-zero) in the header. It is
  94. // never necessary to specify this flag when creating a patch.
  95. //
  96. #define PATCH_OPTION_EXTENDED_OPTIONS PATCH_OPTION_RESERVED1
  97. //
  98. // Following are flags in the ExtendedOptionFlags field.
  99. //
  100. #define PATCH_TRANSFORM_NO_RELOCS 0x00000001 // don't xform relocs
  101. #define PATCH_TRANSFORM_NO_IMPORTS 0x00000002 // don't xform imports
  102. #define PATCH_TRANSFORM_NO_EXPORTS 0x00000004 // don't xform exports
  103. #define PATCH_TRANSFORM_NO_RELJMPS 0x00000008 // don't xform E9 or 0F 8x instructions
  104. #define PATCH_TRANSFORM_NO_RELCALLS 0x00000010 // don't xform E8 instructions
  105. #define PATCH_TRANSFORM_NO_RESOURCE 0x00000020 // don't xform resources
  106. VOID
  107. __fastcall
  108. RiftQsort(
  109. PRIFT_ENTRY LowerBound,
  110. PRIFT_ENTRY UpperBound
  111. );
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif // _PATCHPRV_H_