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.

229 lines
5.3 KiB

  1. //
  2. // heappage.h
  3. //
  4. #ifndef _HEAP_PAGE_H_
  5. #define _HEAP_PAGE_H_
  6. //
  7. // #defining DEBUG_PAGE_HEAP will cause the page heap manager
  8. // to be compiled. Only #define this flag if NOT kernel mode.
  9. // Probably want to define this just for checked-build (DBG).
  10. //
  11. #ifndef NTOS_KERNEL_RUNTIME
  12. // #if DBG
  13. #define DEBUG_PAGE_HEAP 1
  14. // #endif
  15. #endif
  16. #include "heappagi.h"
  17. #ifndef DEBUG_PAGE_HEAP
  18. //
  19. // These macro-based hooks should be defined to nothing so they
  20. // simply "go away" during compile if the debug heap manager is
  21. // not desired (retail builds).
  22. //
  23. #define IF_DEBUG_PAGE_HEAP_THEN_RETURN( Handle, ReturnThis )
  24. #define IF_DEBUG_PAGE_HEAP_THEN_CALL( Handle, CallThis )
  25. #define IF_DEBUG_PAGE_HEAP_THEN_BREAK( Handle, Text, ReturnThis )
  26. #define HEAP_FLAG_PAGE_ALLOCS 0
  27. #else // DEBUG_PAGE_HEAP
  28. //
  29. // The following definitions and prototypes are the external interface
  30. // for hooking the debug heap manager in the retail heap manager.
  31. //
  32. #define HEAP_FLAG_PAGE_ALLOCS 0x01000000
  33. #define HEAP_PROTECTION_ENABLED 0x02000000
  34. #define HEAP_BREAK_WHEN_OUT_OF_VM 0x04000000
  35. #define HEAP_NO_ALIGNMENT 0x08000000
  36. #define IS_DEBUG_PAGE_HEAP_HANDLE( HeapHandle ) \
  37. (((PHEAP)(HeapHandle))->ForceFlags & HEAP_FLAG_PAGE_ALLOCS )
  38. #define IF_DEBUG_PAGE_HEAP_THEN_RETURN( Handle, ReturnThis ) \
  39. { \
  40. if ( IS_DEBUG_PAGE_HEAP_HANDLE( Handle )) \
  41. { \
  42. return ReturnThis; \
  43. } \
  44. }
  45. #define IF_DEBUG_PAGE_HEAP_THEN_CALL( Handle, CallThis ) \
  46. { \
  47. if ( IS_DEBUG_PAGE_HEAP_HANDLE( Handle )) \
  48. { \
  49. CallThis; \
  50. return; \
  51. } \
  52. }
  53. #define IF_DEBUG_PAGE_HEAP_THEN_BREAK( Handle, Text, ReturnThis ) \
  54. { \
  55. if ( IS_DEBUG_PAGE_HEAP_HANDLE( Handle )) \
  56. { \
  57. RtlpDebugPageHeapBreak( Text ); \
  58. return ReturnThis; \
  59. } \
  60. }
  61. PVOID
  62. RtlpDebugPageHeapCreate(
  63. IN ULONG Flags,
  64. IN PVOID HeapBase,
  65. IN ULONG ReserveSize,
  66. IN ULONG CommitSize,
  67. IN PVOID Lock,
  68. IN PRTL_HEAP_PARAMETERS Parameters
  69. );
  70. PVOID
  71. RtlpDebugPageHeapAllocate(
  72. IN PVOID HeapHandle,
  73. IN ULONG Flags,
  74. IN ULONG Size
  75. );
  76. BOOLEAN
  77. RtlpDebugPageHeapFree(
  78. IN PVOID HeapHandle,
  79. IN ULONG Flags,
  80. IN PVOID Address
  81. );
  82. PVOID
  83. RtlpDebugPageHeapReAllocate(
  84. IN PVOID HeapHandle,
  85. IN ULONG Flags,
  86. IN PVOID Address,
  87. IN ULONG Size
  88. );
  89. PVOID
  90. RtlpDebugPageHeapDestroy(
  91. IN PVOID HeapHandle
  92. );
  93. ULONG
  94. RtlpDebugPageHeapSize(
  95. IN PVOID HeapHandle,
  96. IN ULONG Flags,
  97. IN PVOID Address
  98. );
  99. ULONG
  100. RtlpDebugPageHeapGetProcessHeaps(
  101. ULONG NumberOfHeaps,
  102. PVOID *ProcessHeaps
  103. );
  104. ULONG
  105. RtlpDebugPageHeapCompact(
  106. IN PVOID HeapHandle,
  107. IN ULONG Flags
  108. );
  109. BOOLEAN
  110. RtlpDebugPageHeapValidate(
  111. IN PVOID HeapHandle,
  112. IN ULONG Flags,
  113. IN PVOID Address
  114. );
  115. NTSTATUS
  116. RtlpDebugPageHeapWalk(
  117. IN PVOID HeapHandle,
  118. IN OUT PRTL_HEAP_WALK_ENTRY Entry
  119. );
  120. BOOLEAN
  121. RtlpDebugPageHeapLock(
  122. IN PVOID HeapHandle
  123. );
  124. BOOLEAN
  125. RtlpDebugPageHeapUnlock(
  126. IN PVOID HeapHandle
  127. );
  128. BOOLEAN
  129. RtlpDebugPageHeapSetUserValue(
  130. IN PVOID HeapHandle,
  131. IN ULONG Flags,
  132. IN PVOID Address,
  133. IN PVOID UserValue
  134. );
  135. BOOLEAN
  136. RtlpDebugPageHeapGetUserInfo(
  137. IN PVOID HeapHandle,
  138. IN ULONG Flags,
  139. IN PVOID Address,
  140. OUT PVOID* UserValue,
  141. OUT PULONG UserFlags
  142. );
  143. BOOLEAN
  144. RtlpDebugPageHeapSetUserFlags(
  145. IN PVOID HeapHandle,
  146. IN ULONG Flags,
  147. IN PVOID Address,
  148. IN ULONG UserFlagsReset,
  149. IN ULONG UserFlagsSet
  150. );
  151. BOOLEAN
  152. RtlpDebugPageHeapSerialize(
  153. IN PVOID HeapHandle
  154. );
  155. NTSTATUS
  156. RtlpDebugPageHeapExtend(
  157. IN PVOID HeapHandle,
  158. IN ULONG Flags,
  159. IN PVOID Base,
  160. IN ULONG Size
  161. );
  162. NTSTATUS
  163. RtlpDebugPageHeapZero(
  164. IN PVOID HeapHandle,
  165. IN ULONG Flags
  166. );
  167. NTSTATUS
  168. RtlpDebugPageHeapUsage(
  169. IN PVOID HeapHandle,
  170. IN ULONG Flags,
  171. IN OUT PRTL_HEAP_USAGE Usage
  172. );
  173. BOOLEAN
  174. RtlpDebugPageHeapIsLocked(
  175. IN PVOID HeapHandle
  176. );
  177. VOID
  178. RtlpDebugPageHeapBreak(
  179. PCH Text
  180. );
  181. #endif // DEBUG_PAGE_HEAP
  182. #endif // _HEAP_PAGE_H_