xref: /reactos/sdk/include/reactos/verifier.h (revision e944dfa7)
1 #ifndef REACTOS_VERIFIER_H
2 #define REACTOS_VERIFIER_H
3 
4 #define DLL_PROCESS_VERIFIER 4
5 
6 typedef VOID (NTAPI* RTL_VERIFIER_DLL_LOAD_CALLBACK) (PWSTR DllName, PVOID DllBase, SIZE_T DllSize, PVOID Reserved);
7 typedef VOID (NTAPI* RTL_VERIFIER_DLL_UNLOAD_CALLBACK) (PWSTR DllName, PVOID DllBase, SIZE_T DllSize, PVOID Reserved);
8 typedef VOID (NTAPI* RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK) (PVOID AllocationBase, SIZE_T AllocationSize);
9 
10 typedef struct _RTL_VERIFIER_THUNK_DESCRIPTOR {
11     PCHAR ThunkName;
12     PVOID ThunkOldAddress;
13     PVOID ThunkNewAddress;
14 } RTL_VERIFIER_THUNK_DESCRIPTOR, *PRTL_VERIFIER_THUNK_DESCRIPTOR;
15 
16 typedef struct _RTL_VERIFIER_DLL_DESCRIPTOR {
17     PWCHAR DllName;
18     DWORD DllFlags;
19     PVOID DllAddress;
20     PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks;
21 } RTL_VERIFIER_DLL_DESCRIPTOR, *PRTL_VERIFIER_DLL_DESCRIPTOR;
22 
23 typedef struct _RTL_VERIFIER_PROVIDER_DESCRIPTOR {
24     // Provider fields
25     DWORD Length;
26     PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls;
27     RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback;
28     RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback;
29 
30     // Verifier fields
31     PWSTR VerifierImage;
32     DWORD VerifierFlags;
33     DWORD VerifierDebug;
34     PVOID RtlpGetStackTraceAddress;
35     PVOID RtlpDebugPageHeapCreate;
36     PVOID RtlpDebugPageHeapDestroy;
37 
38     // Provider field
39     RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback;
40 } RTL_VERIFIER_PROVIDER_DESCRIPTOR, *PRTL_VERIFIER_PROVIDER_DESCRIPTOR;
41 
42 
43 // VerifierFlags
44 
45 #define RTL_VRF_FLG_FULL_PAGE_HEAP                      0x00000001
46 #define RTL_VRF_FLG_RESERVED_DONOTUSE                   0x00000002
47 #define RTL_VRF_FLG_HANDLE_CHECKS                       0x00000004
48 #define RTL_VRF_FLG_STACK_CHECKS                        0x00000008
49 #define RTL_VRF_FLG_APPCOMPAT_CHECKS                    0x00000010
50 #define RTL_VRF_FLG_TLS_CHECKS                          0x00000020
51 #define RTL_VRF_FLG_DIRTY_STACKS                        0x00000040
52 #define RTL_VRF_FLG_RPC_CHECKS                          0x00000080
53 #define RTL_VRF_FLG_COM_CHECKS                          0x00000100
54 #define RTL_VRF_FLG_DANGEROUS_APIS                      0x00000200
55 #define RTL_VRF_FLG_RACE_CHECKS                         0x00000400
56 #define RTL_VRF_FLG_DEADLOCK_CHECKS                     0x00000800
57 #define RTL_VRF_FLG_FIRST_CHANCE_EXCEPTION_CHECKS       0x00001000
58 #define RTL_VRF_FLG_VIRTUAL_MEM_CHECKS                  0x00002000
59 #define RTL_VRF_FLG_ENABLE_LOGGING                      0x00004000
60 #define RTL_VRF_FLG_FAST_FILL_HEAP                      0x00008000
61 #define RTL_VRF_FLG_VIRTUAL_SPACE_TRACKING              0x00010000
62 #define RTL_VRF_FLG_ENABLED_SYSTEM_WIDE                 0x00020000
63 #define RTL_VRF_FLG_MISCELLANEOUS_CHECKS                0x00020000
64 #define RTL_VRF_FLG_LOCK_CHECKS                         0x00040000
65 
66 
67 // VerifierDebug
68 
69 #define RTL_VRF_DBG_SHOWSNAPS               0x00001
70 #define RTL_VRF_DBG_SHOWFOUNDEXPORTS        0x00002
71 #define RTL_VRF_DBG_SHOWVERIFIEDEXPORTS     0x00004
72 #define RTL_VRF_DBG_LISTPROVIDERS           0x00008
73 #define RTL_VRF_DBG_SHOWCHAINING            0x00010
74 #define RTL_VRF_DBG_SHOWCHAINING_DEBUG      0x00020
75 
76 #define RTL_VRF_DBG_CS_SPLAYTREE            0x00200
77 #define RTL_VRF_DBG_CS_DUMP_SPLAYTREE       0x00400
78 #define RTL_VRF_DBG_CS_CREATE_DELETE        0x00800
79 
80 #define RTL_VRF_DBG_VERIFIER_LOGCALLS       0x04000
81 #define RTL_VRF_DBG_VERIFIER_SHOWDYNTHUNKS  0x08000
82 
83 #define RTL_VRF_DBG_ENTRYPOINT_HOOKS        0x10000
84 #define RTL_VRF_DBG_ENTRYPOINT_CALLS        0x20000
85 
86 
87 // Verifier stop codes
88 
89 #define APPLICATION_VERIFIER_CORRUPT_HEAP_POINTER 0x0006
90 #define APPLICATION_VERIFIER_DOUBLE_FREE 0x0007
91 
92 #define APPLICATION_VERIFIER_EXCEPTION_WHILE_VERIFYING_BLOCK_HEADER 0x000B
93 #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_AFTER_FREE 0x000D
94 #define APPLICATION_VERIFIER_CORRUPTED_INFIX_PATTERN 0x000E
95 #define APPLICATION_VERIFIER_CORRUPTED_SUFFIX_PATTERN 0x000F
96 #define APPLICATION_VERIFIER_CORRUPTED_START_STAMP 0x0010
97 #define APPLICATION_VERIFIER_CORRUPTED_END_STAMP 0x0011
98 #define APPLICATION_VERIFIER_CORRUPTED_PREFIX_PATTERN 0x0012
99 
100 
101 VOID NTAPI
102 RtlApplicationVerifierStop(
103     _In_ ULONG_PTR Code,
104     _In_ PCSTR Message,
105     _In_ PVOID Value1,
106     _In_ PCSTR Description1,
107     _In_ PVOID Value2,
108     _In_ PCSTR Description2,
109     _In_ PVOID Value3,
110     _In_ PCSTR Description3,
111     _In_ PVOID Value4,
112     _In_ PCSTR Description4);
113 
114 
115 #endif // REACTOS_VERIFIER_H
116