39#ifdef _BASE_HANDLE_TRACE_
40#define BH_PRINT DbgPrint
42#define BH_PRINT DPRINT
44#define BASE_TRACE_ALLOC(x, y) \
45 BH_PRINT("[BASE_HEAP] %s : Allocating %lx bytes with flags: %lx\n", \
47#define BASE_TRACE_ALLOC2(x) \
48 BH_PRINT("[BASE_HEAP] %s : Allocated %p\n", \
50#define BASE_TRACE_PTR(x, y) \
51 BH_PRINT("[BASE_HEAP] %s : Using handle: %p for pointer: %p\n", \
53#define BASE_TRACE_HANDLE(x, y) \
54 BH_PRINT("[BASE_HEAP] %s : Using handle: %lx for block: %p\n", \
56#define BASE_TRACE_DEALLOC(x) \
57 BH_PRINT("[BASE_HEAP] %s : Freeing %p\n", \
59#define BASE_TRACE_FAILURE() \
60 BH_PRINT("[BASE_HEAP] %s : Failing %d\n", \
61 __FUNCTION__, __LINE__)
83#define BASE_HEAP_ENTRY_FLAG_MOVABLE 0x0002
84#define BASE_HEAP_ENTRY_FLAG_REUSABLE 0x0004
85#define BASE_HEAP_ENTRY_FLAG_REUSE 0x0008
86#define BASE_HEAP_ENTRY_FLAG_DDESHARE 0x0010
91#define BASE_HEAP_IS_HANDLE_ENTRY \
92 (ULONG_PTR)FIELD_OFFSET(BASE_HEAP_HANDLE_ENTRY, Object)
98#define BASE_HEAP_FLAG_MOVABLE HEAP_SETTABLE_USER_FLAG1
99#define BASE_HEAP_FLAG_DDESHARE HEAP_SETTABLE_USER_FLAG2
104#define BaseHeapAllocEntry() \
105 (PBASE_HEAP_HANDLE_ENTRY)RtlAllocateHandle(&BaseHeapHandleTable, NULL)
107#define BaseHeapGetEntry(h) \
108 (PBASE_HEAP_HANDLE_ENTRY) \
109 CONTAINING_RECORD(h, \
110 BASE_HEAP_HANDLE_ENTRY, \
113#define BaseHeapValidateEntry(he) \
114 RtlIsValidHandle(&BaseHeapHandleTable, (PRTL_HANDLE_TABLE_ENTRY)he)
116#define BaseHeapFreeEntry(he) \
117 RtlFreeHandle(&BaseHeapHandleTable, (PRTL_HANDLE_TABLE_ENTRY)he);
struct _BASE_HEAP_HANDLE_ENTRY * PBASE_HEAP_HANDLE_ENTRY
struct _BASE_HEAP_HANDLE_ENTRY BASE_HEAP_HANDLE_ENTRY