Add HeapStackDatabase types
@@ -4392,7 +4392,7 @@ RtlWalkHeap(
#define HeapExtendedInformation 0x2 // q; s: HEAP_EXTENDED_INFORMATION
#define HeapOptimizeResources 0x3 // q; s: HEAP_OPTIMIZE_RESOURCES_INFORMATION
#define HeapTaggingInformation 0x4
-#define HeapStackDatabase 0x5
+#define HeapStackDatabase 0x5 // q: RTL_HEAP_STACK_QUERY; s: RTL_HEAP_STACK_CONTROL
#define HeapMemoryLimit 0x6 // since 19H2
#define HeapTag 0x7 // since 20H1
#define HeapDetailedFailureInformation 0x80000001
@@ -4544,6 +4544,51 @@ typedef struct _HEAP_EXTENDED_INFORMATION
};
} HEAP_EXTENDED_INFORMATION, *PHEAP_EXTENDED_INFORMATION;
+// rev
+typedef NTSTATUS (NTAPI *RTL_HEAP_STACK_WRITE_ROUTINE)(
+ _In_ PVOID Information, // TODO: 2 missing structures (dmex)
+ _In_ ULONG Size,
+ _In_ PVOID Context
+ );
+
+// rev
+typedef struct _HEAP_STACK_TRACE_SERIALIZE_INIT
+{
+ ULONG Unknown[2];
+ ULONG Magic;
+} HEAP_STACK_TRACE_SERIALIZE_INIT, *PHEAP_STACK_TRACE_SERIALIZE_INIT;
+
+#define HEAP_STACK_QUERY_VERSION 0x2
+
+typedef struct _RTL_HEAP_STACK_QUERY
+{
+ ULONG Version;
+ HANDLE ProcessHandle;
+ RTL_HEAP_STACK_WRITE_ROUTINE WriteRoutine;
+ PVOID SerializationContext;
+ UCHAR QueryLevel;
+ UCHAR Flags;
+} RTL_HEAP_STACK_QUERY, *PRTL_HEAP_STACK_QUERY;
+
+#define HEAP_STACK_CONTROL_VERSION 0x1
+#define HEAP_STACK_CONTROL_FLAGS_STACKTRACE_ENABLE 0x1
+#define HEAP_STACK_CONTROL_FLAGS_STACKTRACE_DISABLE 0x2
+
+typedef struct _RTL_HEAP_STACK_CONTROL
+{
+ USHORT Version;
+ USHORT Flags;
+ HANDLE ProcessHandle;
+} RTL_HEAP_STACK_CONTROL, *PRTL_HEAP_STACK_CONTROL;
+
+// rev
+typedef NTSTATUS (NTAPI *PRTL_HEAP_DEBUGGING_INTERCEPTOR_ROUTINE)(
+ _In_ PVOID HeapHandle,
+ _In_ ULONG Action,
+ _In_ ULONG StackFramesToCapture,
+ _In_ PVOID *StackTrace
+ );
+
// rev
typedef NTSTATUS (NTAPI *PRTL_HEAP_LEAK_ENUMERATION_ROUTINE)(
_In_ LONG Reserved,
@@ -4557,7 +4602,7 @@ typedef NTSTATUS (NTAPI *PRTL_HEAP_LEAK_ENUMERATION_ROUTINE)(
// symbols
typedef struct _HEAP_DEBUGGING_INFORMATION
{
- PVOID InterceptorFunction;
+ PRTL_HEAP_DEBUGGING_INTERCEPTOR_ROUTINE InterceptorFunction;
USHORT InterceptorValue;
ULONG ExtendedOptions;
ULONG StackTraceDepth;
