1 /**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5 
6 #include <winapifamily.h>
7 
8 #ifndef _AVRFSDK_
9 #define _AVRFSDK_
10 
11 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #define AVRF_MAX_TRACES 32
18 
19   enum eHeapAllocationState {
20     HeapFullPageHeap = 0x40000000,
21     HeapMetadata = 0x80000000,
22     HeapStateMask = 0xffff0000
23   };
24 
25   enum eHeapEnumerationLevel {
26     HeapEnumerationEverything = 0x0,
27     HeapEnumerationStop = 0xffffffff
28   };
29 
30   enum eHANDLE_TRACE_OPERATIONS {
31     OperationDbUnused,
32     OperationDbOPEN,
33     OperationDbCLOSE,
34     OperationDbBADREF
35   };
36 
37   enum eAvrfResourceTypes {
38     AvrfResourceHeapAllocation,
39     AvrfResourceHandleTrace,
40     AvrfResourceMax
41   };
42 
43   enum eUserAllocationState {
44     AllocationStateUnknown,
45     AllocationStateBusy,
46     AllocationStateFree
47   };
48 
49   typedef struct _AVRF_BACKTRACE_INFORMATION {
50     ULONG Depth;
51     ULONG Index;
52     ULONG64 ReturnAddresses[AVRF_MAX_TRACES];
53   } AVRF_BACKTRACE_INFORMATION,*PAVRF_BACKTRACE_INFORMATION;
54 
55   typedef struct _AVRF_HEAP_ALLOCATION {
56     ULONG64 HeapHandle;
57     ULONG64 UserAllocation;
58     ULONG64 UserAllocationSize;
59     ULONG64 Allocation;
60     ULONG64 AllocationSize;
61     ULONG UserAllocationState;
62     ULONG HeapState;
63     ULONG64 HeapContext;
64     PAVRF_BACKTRACE_INFORMATION BackTraceInformation;
65   } AVRF_HEAP_ALLOCATION,*PAVRF_HEAP_ALLOCATION;
66 
67   typedef struct _AVRF_HANDLE_OPERATION {
68     ULONG64 Handle;
69     ULONG ProcessId;
70     ULONG ThreadId;
71     ULONG OperationType;
72     ULONG Spare0;
73     AVRF_BACKTRACE_INFORMATION BackTraceInformation;
74   } AVRF_HANDLE_OPERATION,*PAVRF_HANDLE_OPERATION;
75 
76   typedef ULONG (NTAPI *AVRF_RESOURCE_ENUMERATE_CALLBACK) (PVOID ResourceDescription, PVOID EnumerationContext, PULONG EnumerationLevel);
77   typedef ULONG (NTAPI *AVRF_HEAPALLOCATION_ENUMERATE_CALLBACK) (PAVRF_HEAP_ALLOCATION HeapAllocation, PVOID EnumerationContext, PULONG EnumerationLevel);
78   typedef ULONG (NTAPI *AVRF_HANDLEOPERATION_ENUMERATE_CALLBACK) (PAVRF_HANDLE_OPERATION HandleOperation, PVOID EnumerationContext, PULONG EnumerationLevel);
79 
80 #define AVRF_ENUM_RESOURCES_FLAGS_SUSPEND 0x0001
81 #define AVRF_ENUM_RESOURCES_FLAGS_DONT_RESOLVE_TRACES 0x0002
82 
83   ULONG NTAPI VerifierEnumerateResource (HANDLE Process, ULONG Flags, ULONG ResourceType, AVRF_RESOURCE_ENUMERATE_CALLBACK ResourceCallback, PVOID EnumerationContext);
84   WINBOOL NTAPI VerifierIsPerUserSettingsEnabled (VOID);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif
91 #endif
92