14#define TRACE_ALL_FREE_CALLS 1
16typedef struct SHIM_ALLOC_ENTRY
24} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY;
28static HANDLE g_PrivAllocationHeap;
55 SHIM_ALLOC_ENTRY
Entry = {0};
69 SHIM_ALLOC_ENTRY
Lookup = {0};
70 PSHIM_ALLOC_ENTRY
Entry;
82 Lookup.Address = newaddress;
88 Entry->Next = newaddress;
93static void SdbpPrintSingleAllocation(PSHIM_ALLOC_ENTRY
Entry)
102 SHIM_ALLOC_ENTRY
Lookup = {0};
103 PSHIM_ALLOC_ENTRY
Entry;
105#if TRACE_ALL_FREE_CALLS
106 DbgPrint(
"\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n",
file,
line);
119#if TRACE_ALL_FREE_CALLS
120 SdbpPrintSingleAllocation(&
Lookup);
130#if TRACE_ALL_FREE_CALLS
135void SdbpDebugHeapInit(
HANDLE privateHeapPtr)
137 g_PrivAllocationHeap = privateHeapPtr;
141 ShimAllocAllocateRoutine, ShimAllocFreeRoutine,
NULL);
144void SdbpDebugHeapDeinit(
void)
148 PSHIM_ALLOC_ENTRY
Entry;
150 DbgPrint(
"\r\n===============\r\n===============\r\nSdbpHeapDeinit: Dumping leaks\r\n");
156 SdbpPrintSingleAllocation(
Entry);
160 DbgPrint(
"===============\r\n===============\r\n");
VOID NTAPI RtlInitializeGenericTableAvl(IN OUT PRTL_AVL_TABLE Table, IN PRTL_AVL_COMPARE_ROUTINE CompareRoutine, IN PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine, IN PRTL_AVL_FREE_ROUTINE FreeRoutine, IN PVOID TableContext)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
static void Lookup(RTF_Info *, char *)
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
base of all file and directory entries
ULONG NumberGenericTableElements
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ NTSYSAPI PVOID NTAPI RtlLookupElementGenericTableAvl(_In_ PRTL_AVL_TABLE Table, _In_ PVOID Buffer)
NTSYSAPI BOOLEAN NTAPI RtlDeleteElementGenericTableAvl(_In_ PRTL_AVL_TABLE Table, _In_ PVOID Buffer)
NTSYSAPI PVOID NTAPI RtlInsertElementGenericTableAvl(_In_ PRTL_AVL_TABLE Table, _In_reads_bytes_(BufferSize) PVOID Buffer, _In_ CLONG BufferSize, _Out_opt_ PBOOLEAN NewElement)
_Must_inspect_result_ NTSYSAPI PVOID NTAPI RtlEnumerateGenericTableAvl(_In_ PRTL_AVL_TABLE Table, _In_ BOOLEAN Restart)
_IRQL_requires_same_ _In_ PVOID _In_ PVOID SecondStruct
_IRQL_requires_same_ _In_ CLONG ByteSize
_IRQL_requires_same_ _In_ PVOID FirstStruct
enum _RTL_GENERIC_COMPARE_RESULTS RTL_GENERIC_COMPARE_RESULTS