Author: fireball
Date: Thu Oct 14 20:55:38 2010
New Revision: 49149
URL:
http://svn.reactos.org/svn/reactos?rev=49149&view=rev
Log:
[HEAP]
- Add special debug heap function declarations and stubs.
- Add a useful inline for detecting whether a special or normal heap is going to be used.
Modified:
trunk/reactos/lib/rtl/heap.h
trunk/reactos/lib/rtl/heapdbg.c
Modified: trunk/reactos/lib/rtl/heap.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.h?rev=49149&a…
==============================================================================
--- trunk/reactos/lib/rtl/heap.h [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heap.h [iso-8859-1] Thu Oct 14 20:55:38 2010
@@ -53,6 +53,26 @@
/* Segment flags */
#define HEAP_USER_ALLOCATED 0x1
+
+/* A handy inline to distinguis normal heap, special "debug heap" and special
"page heap" */
+FORCEINLINE BOOLEAN
+RtlpHeapIsSpecial(ULONG Flags)
+{
+ if (Flags & HEAP_SKIP_VALIDATION_CHECKS) return FALSE;
+
+ if (Flags & (HEAP_FLAG_PAGE_ALLOCS |
+ HEAP_VALIDATE_ALL_ENABLED |
+ HEAP_VALIDATE_PARAMETERS_ENABLED |
+ HEAP_CAPTURE_STACK_BACKTRACES |
+ HEAP_CREATE_ENABLE_TRACING))
+ {
+ /* This is a special heap */
+ return TRUE;
+ }
+
+ /* No need for a special treatment */
+ return FALSE;
+}
/* Heap structures */
struct _HEAP_COMMON_ENTRY
@@ -304,6 +324,59 @@
/* heapdbg.c */
HANDLE NTAPI
+RtlDebugCreateHeap(ULONG Flags,
+ PVOID Addr,
+ SIZE_T TotalSize,
+ SIZE_T CommitSize,
+ PVOID Lock,
+ PRTL_HEAP_PARAMETERS Parameters);
+
+HANDLE NTAPI
+RtlDebugDestroyHeap(HANDLE HeapPtr);
+
+PVOID NTAPI
+RtlDebugAllocateHeap(PVOID HeapPtr,
+ ULONG Flags,
+ SIZE_T Size);
+
+PVOID NTAPI
+RtlDebugReAllocateHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr,
+ SIZE_T Size);
+
+BOOLEAN NTAPI
+RtlDebugFreeHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr);
+
+BOOLEAN NTAPI
+RtlDebugGetUserInfoHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ PVOID *UserValue,
+ PULONG UserFlags);
+
+BOOLEAN NTAPI
+RtlDebugSetUserValueHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ PVOID UserValue);
+
+BOOLEAN
+NTAPI
+RtlDebugSetUserFlagsHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ ULONG UserFlagsReset,
+ ULONG UserFlagsSet);
+
+SIZE_T NTAPI
+RtlDebugSizeHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr);
+
+HANDLE NTAPI
RtlpPageHeapCreate(ULONG Flags,
PVOID Addr,
SIZE_T TotalSize,
Modified: trunk/reactos/lib/rtl/heapdbg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heapdbg.c?rev=4914…
==============================================================================
--- trunk/reactos/lib/rtl/heapdbg.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heapdbg.c [iso-8859-1] Thu Oct 14 20:55:38 2010
@@ -23,6 +23,89 @@
/* FUNCTIONS ******************************************************************/
HANDLE NTAPI
+RtlDebugCreateHeap(ULONG Flags,
+ PVOID Addr,
+ SIZE_T TotalSize,
+ SIZE_T CommitSize,
+ PVOID Lock,
+ PRTL_HEAP_PARAMETERS Parameters)
+{
+ return NULL;
+}
+
+HANDLE NTAPI
+RtlDebugDestroyHeap(HANDLE HeapPtr)
+{
+ return NULL;
+}
+
+PVOID NTAPI
+RtlDebugAllocateHeap(PVOID HeapPtr,
+ ULONG Flags,
+ SIZE_T Size)
+{
+ return NULL;
+}
+
+PVOID NTAPI
+RtlDebugReAllocateHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr,
+ SIZE_T Size)
+{
+ return NULL;
+}
+
+BOOLEAN NTAPI
+RtlDebugFreeHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr)
+{
+ return FALSE;
+}
+
+BOOLEAN NTAPI
+RtlDebugGetUserInfoHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ PVOID *UserValue,
+ PULONG UserFlags)
+{
+ return FALSE;
+}
+
+BOOLEAN NTAPI
+RtlDebugSetUserValueHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ PVOID UserValue)
+{
+ return FALSE;
+}
+
+BOOLEAN
+NTAPI
+RtlDebugSetUserFlagsHeap(PVOID HeapHandle,
+ ULONG Flags,
+ PVOID BaseAddress,
+ ULONG UserFlagsReset,
+ ULONG UserFlagsSet)
+{
+ return FALSE;
+}
+
+SIZE_T NTAPI
+RtlDebugSizeHeap(HANDLE HeapPtr,
+ ULONG Flags,
+ PVOID Ptr)
+{
+ return 0;
+}
+
+
+// Page heap -> move to another file
+
+HANDLE NTAPI
RtlpPageHeapCreate(ULONG Flags,
PVOID Addr,
SIZE_T TotalSize,