ReactOS 0.4.16-dev-976-g18fc5a1
verifier.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS NT User Mode Library
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Verifier support routines
5 * COPYRIGHT: Copyright 2011 Aleksey Bragin (aleksey@reactos.org)
6 * Copyright 2018-2025 Mark Jansen (mark.jansen@reactos.org)
7 */
8
9
10#include <ntdll.h>
11#include <reactos/verifier.h>
12
13#define NDEBUG
14#include <debug.h>
15
16 /* heappage.c */
19
27
28#define VERIFIER_DLL_FLAGS_RESOLVED 1
29
30
31typedef struct _VERIFIER_PROVIDER
32{
37
38 // Provider data
44
45
46
47
48VOID
51{
53
55 L"VerifierDlls",
56 REG_SZ,
58 sizeof(AVrfpVerifierDllsString) - sizeof(WCHAR),
59 NULL);
60
61 if (!NT_SUCCESS(Status))
63
65 L"VerifierFlags",
68 sizeof(AVrfpVerifierFlags),
69 NULL);
70 if (!NT_SUCCESS(Status))
72
74 L"VerifierDebug",
77 sizeof(AVrfpDebug),
78 NULL);
79 if (!NT_SUCCESS(Status))
80 AVrfpDebug = 0;
81}
82
83
87{
88 /* If global flags request DPH, perform some additional actions */
90 {
91 // TODO: Read advanced DPH flags from the registry if requested
92 if (ReadAdvancedOptions)
93 {
95 }
96
97 /* Enable page heap */
99 }
100
102
103 return STATUS_SUCCESS;
104}
105
108{
111
113 {
115
116 if (BaseAddress == Provider->BaseAddress)
117 return TRUE;
118 }
119
120 return FALSE;
121}
122
123SIZE_T
125{
126 SIZE_T Count = 0;
127 while (Thunk[Count].u1.Function)
128 Count++;
129 return Count;
130}
131
132VOID
134{
135 ULONG Size;
136 PIMAGE_IMPORT_DESCRIPTOR ImportDescriptor;
137 PBYTE DllBase = LdrEntry->DllBase;
138
140 if (!ImportDescriptor)
141 {
142 //SHIMENG_INFO("Skipping module 0x%p \"%wZ\" due to no iat found\n", LdrEntry->DllBase, &LdrEntry->BaseDllName);
143 return;
144 }
145
146 for (; ImportDescriptor->Name && ImportDescriptor->OriginalFirstThunk; ImportDescriptor++)
147 {
148 PIMAGE_THUNK_DATA FirstThunk;
149 PVOID UnprotectedPtr = NULL;
150 SIZE_T UnprotectedSize = 0;
151 ULONG OldProtection = 0;
152 FirstThunk = (PIMAGE_THUNK_DATA)(DllBase + ImportDescriptor->FirstThunk);
153
154 /* Walk all imports */
155 for (;FirstThunk->u1.Function; FirstThunk++)
156 {
159
161 {
162 PRTL_VERIFIER_DLL_DESCRIPTOR DllDescriptor;
163
165 for (DllDescriptor = Provider->ProviderDlls; DllDescriptor && DllDescriptor->DllName; ++DllDescriptor)
166 {
167 PRTL_VERIFIER_THUNK_DESCRIPTOR ThunkDescriptor;
168
169 for (ThunkDescriptor = DllDescriptor->DllThunks; ThunkDescriptor && ThunkDescriptor->ThunkName; ++ThunkDescriptor)
170 {
171 /* Just compare function addresses, the loader will have handled forwarders and ordinals for us */
172 if ((PVOID)FirstThunk->u1.Function != ThunkDescriptor->ThunkOldAddress)
173 continue;
174
175 if (!UnprotectedPtr)
176 {
177 PVOID Ptr = &FirstThunk->u1.Function;
178 SIZE_T Size = sizeof(FirstThunk->u1.Function) * AVrfpCountThunks(FirstThunk);
180
181 UnprotectedPtr = Ptr;
182 UnprotectedSize = Size;
183
185 &Ptr,
186 &Size,
188 &OldProtection);
189
190 if (!NT_SUCCESS(Status))
191 {
192 DbgPrint("AVRF: Unable to unprotect IAT to modify thunks (status %08X).\n", Status);
193 UnprotectedPtr = NULL;
194 continue;
195 }
196 }
197
198 if (ThunkDescriptor->ThunkNewAddress == NULL)
199 {
200 DbgPrint("AVRF: internal error: New thunk for %s is null.\n", ThunkDescriptor->ThunkName);
201 continue;
202 }
203 FirstThunk->u1.Function = (SIZE_T)ThunkDescriptor->ThunkNewAddress;
205 DbgPrint("AVRF: Snapped (%wZ: %s) with (%wZ: %p).\n",
206 &LdrEntry->BaseDllName,
207 ThunkDescriptor->ThunkName,
208 &Provider->DllName,
209 ThunkDescriptor->ThunkNewAddress);
210 }
211 }
212 }
213 }
214
215 if (UnprotectedPtr)
216 {
217 PVOID Ptr = UnprotectedPtr;
218 SIZE_T Size = UnprotectedSize;
220
221 UnprotectedPtr = Ptr;
222 UnprotectedSize = Size;
223
225 &Ptr,
226 &Size,
227 OldProtection,
228 &OldProtection);
229 if (!NT_SUCCESS(Status))
230 {
231 DbgPrint("AVRF: Unable to reprotect IAT to modify thunks (status %08X).\n", Status);
232 }
233 }
234 }
235}
236
237
238VOID
240{
243
244 if (!AVrfpInitialized)
245 return;
246
248 {
249 PRTL_VERIFIER_DLL_DESCRIPTOR DllDescriptor;
250
252
253 for (DllDescriptor = Provider->ProviderDlls; DllDescriptor && DllDescriptor->DllName; ++DllDescriptor)
254 {
255 PRTL_VERIFIER_THUNK_DESCRIPTOR ThunkDescriptor;
256
257 if ((DllDescriptor->DllFlags & VERIFIER_DLL_FLAGS_RESOLVED) ||
258 _wcsicmp(DllDescriptor->DllName, LdrEntry->BaseDllName.Buffer))
259 continue;
260
262 DbgPrint("AVRF: pid 0x%X: found dll descriptor for `%wZ' with verified exports\n",
264 &LdrEntry->BaseDllName);
265
266 for (ThunkDescriptor = DllDescriptor->DllThunks; ThunkDescriptor && ThunkDescriptor->ThunkName; ++ThunkDescriptor)
267 {
268 if (!ThunkDescriptor->ThunkOldAddress)
269 {
270 ANSI_STRING ThunkName;
271
272 RtlInitAnsiString(&ThunkName, ThunkDescriptor->ThunkName);
273 /* We cannot call the public api, because that would run init routines! */
274 if (NT_SUCCESS(LdrpGetProcedureAddress(LdrEntry->DllBase, &ThunkName, 0, &ThunkDescriptor->ThunkOldAddress, FALSE)))
275 {
277 DbgPrint("AVRF: (%wZ) %Z export found.\n", &LdrEntry->BaseDllName, &ThunkName);
278 }
279 else
280 {
282 DbgPrint("AVRF: warning: did not find `%Z' export in %wZ.\n", &ThunkName, &LdrEntry->BaseDllName);
283 }
284 }
285 }
286
287 DllDescriptor->DllFlags |= VERIFIER_DLL_FLAGS_RESOLVED;
288 }
289 }
290
291 AVrfpSnapDllImports(LdrEntry);
292}
293
294
295
296VOID
297NTAPI
299{
301
303 return;
304
306 if (!AVrfpIsVerifierProviderDll(LdrEntry->DllBase))
307 {
308 AvrfpResolveThunks(LdrEntry);
309
311 {
313 RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback;
314
316
317 ProviderDllLoadCallback = Provider->ProviderDllLoadCallback;
318 if (ProviderDllLoadCallback)
319 {
320 ProviderDllLoadCallback(LdrEntry->BaseDllName.Buffer,
321 LdrEntry->DllBase,
322 LdrEntry->SizeOfImage,
323 LdrEntry);
324 }
325 }
326 }
328}
329
330VOID
331NTAPI
333{
335
337 return;
338
340 if (!AVrfpIsVerifierProviderDll(LdrEntry->DllBase))
341 {
343 {
345 RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback;
346
348
349 ProviderDllUnloadCallback = Provider->ProviderDllUnloadCallback;
350 if (ProviderDllUnloadCallback)
351 {
352 ProviderDllUnloadCallback(LdrEntry->BaseDllName.Buffer,
353 LdrEntry->DllBase,
354 LdrEntry->SizeOfImage,
355 LdrEntry);
356 }
357 }
358 }
360}
361
362VOID
363NTAPI
365{
367
369 return;
370
373 {
375 RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderHeapFreeCallback;
376
378
379 ProviderHeapFreeCallback = Provider->ProviderNtdllHeapFreeCallback;
380 if (ProviderHeapFreeCallback)
381 {
382 ProviderHeapFreeCallback(AllocationBase, AllocationSize);
383 }
384 }
386}
387
388VOID
389NTAPI
391{
392 /* Check if page heap dll notification is turned on */
394 return;
395
396 /* We don't support this flag currently */
398}
399
400
401VOID
402NTAPI
404{
405 PLIST_ENTRY ListHead, ListEntry;
406
407 ListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
408 for (ListEntry = ListHead->Flink; ListHead != ListEntry; ListEntry = ListEntry->Flink)
409 {
410 PLDR_DATA_TABLE_ENTRY LdrEntry;
411
412 LdrEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
413
414 if (AVrfpIsVerifierProviderDll(LdrEntry->DllBase))
415 {
417 DbgPrint("AVRF: skipped resnapping provider %wZ ...\n", &LdrEntry->BaseDllName);
418 }
419 else
420 {
422 DbgPrint("AVRF: resnapping %wZ ...\n", &LdrEntry->BaseDllName);
423
424 AvrfpResolveThunks(LdrEntry);
425 }
426 }
427}
428
429PVOID
430NTAPI
431AvrfpFindDuplicateThunk(PLIST_ENTRY EndEntry, PWCHAR DllName, PCHAR ThunkName)
432{
434
435 for (Entry = AVrfpVerifierProvidersList.Flink; Entry != EndEntry; Entry = Entry->Flink)
436 {
438 PRTL_VERIFIER_DLL_DESCRIPTOR DllDescriptor;
439
441
443 DbgPrint("AVRF: chain: searching in %wZ\n", &Provider->DllName);
444
445 for (DllDescriptor = Provider->ProviderDlls; DllDescriptor && DllDescriptor->DllName; ++DllDescriptor)
446 {
447 PRTL_VERIFIER_THUNK_DESCRIPTOR ThunkDescriptor;
448
450 DbgPrint("AVRF: chain: dll: %ws\n", DllDescriptor->DllName);
451
452 if (_wcsicmp(DllDescriptor->DllName, DllName))
453 continue;
454
455 for (ThunkDescriptor = DllDescriptor->DllThunks; ThunkDescriptor && ThunkDescriptor->ThunkName; ++ThunkDescriptor)
456 {
458 DbgPrint("AVRF: chain: thunk: %s == %s ?\n", ThunkDescriptor->ThunkName, ThunkName);
459
460 if (!_stricmp(ThunkDescriptor->ThunkName, ThunkName))
461 {
463 DbgPrint("AVRF: Found duplicate for (%ws: %s) in %wZ\n",
464 DllDescriptor->DllName, ThunkDescriptor->ThunkName, &Provider->DllName);
465
466 return ThunkDescriptor->ThunkNewAddress;
467 }
468 }
469 }
470 }
471 return NULL;
472}
473
474
475VOID
476NTAPI
478{
481
483 {
484 PRTL_VERIFIER_DLL_DESCRIPTOR DllDescriptor;
485 PRTL_VERIFIER_THUNK_DESCRIPTOR ThunkDescriptor;
486
488
489 for (DllDescriptor = Provider->ProviderDlls; DllDescriptor && DllDescriptor->DllName; ++DllDescriptor)
490 {
491 for (ThunkDescriptor = DllDescriptor->DllThunks; ThunkDescriptor && ThunkDescriptor->ThunkName; ++ThunkDescriptor)
492 {
493 PVOID Ptr;
494
496 DbgPrint("AVRF: Checking %wZ for duplicate (%ws: %s)\n",
497 &Provider->DllName, DllDescriptor->DllName, ThunkDescriptor->ThunkName);
498
499 Ptr = AvrfpFindDuplicateThunk(Entry, DllDescriptor->DllName, ThunkDescriptor->ThunkName);
500 if (Ptr)
501 {
503 DbgPrint("AVRF: Chaining (%ws: %s) to %wZ\n", DllDescriptor->DllName, ThunkDescriptor->ThunkName, &Provider->DllName);
504
505 ThunkDescriptor->ThunkOldAddress = Ptr;
506 }
507 }
508 }
509 }
510}
511
512static
513PVOID
514NTAPI
516{
519 return NULL;
520}
521
522static
523HANDLE
524NTAPI
526 PVOID Addr,
527 SIZE_T TotalSize,
529 PVOID Lock,
531{
532 HANDLE hHeap;
533 hHeap = RtlpPageHeapCreate(Flags, Addr, TotalSize, CommitSize, Lock, Parameters);
534 DbgPrint("AVRF: DebugPageHeapCreate(Flags=%x, Addr=%p, TotalSize=%u, CommitSize=%u, Lock=%p, Parameters=%p) = %p\n",
535 Flags, Addr, TotalSize, CommitSize, Lock, Parameters, hHeap);
536 return hHeap;
537}
538
539static
540PVOID
542{
543 DbgPrint("AVRF: DebugPageHeapDestroy(HeapPtr=%p)\n", HeapPtr);
544 return RtlpPageHeapDestroy(HeapPtr);
545}
546
548NTAPI
550{
556
557 RtlInitEmptyUnicodeString(&DllPath, StringBuffer, sizeof(StringBuffer));
559 RtlAppendUnicodeToString(&DllPath, L"\\System32\\");
560
562 DbgPrint("AVRF: verifier dll `%wZ'\n", &Provider->DllName);
563
564 Status = LdrLoadDll(DllPath.Buffer, NULL, &Provider->DllName, &Provider->BaseAddress);
565 if (!NT_SUCCESS(Status))
566 {
567 DbgPrint("AVRF: %wZ: failed to load provider `%wZ' (status %08X) from %wZ\n",
569 &Provider->DllName,
570 Status,
571 &DllPath);
572 return Status;
573 }
574
575 /* Prevent someone funny from specifying his own application as provider */
577 if (!ImageNtHeader ||
579 {
580 DbgPrint("AVRF: provider %wZ is not a DLL image\n", &Provider->DllName);
582 }
583
584 Provider->EntryPoint = LdrpFetchAddressOfEntryPoint(Provider->BaseAddress);
585 if (!Provider->EntryPoint)
586 {
587 DbgPrint("AVRF: cannot find an entry point for provider %wZ\n", &Provider->DllName);
589 }
590
592 {
593 if (LdrpCallInitRoutine(Provider->EntryPoint,
594 Provider->BaseAddress,
596 &Descriptor))
597 {
599 {
600 /* Copy the data */
601 Provider->ProviderDlls = Descriptor->ProviderDlls;
602 Provider->ProviderDllLoadCallback = Descriptor->ProviderDllLoadCallback;
603 Provider->ProviderDllUnloadCallback = Descriptor->ProviderDllUnloadCallback;
604 Provider->ProviderNtdllHeapFreeCallback = Descriptor->ProviderNtdllHeapFreeCallback;
605
606 /* Update some info for the provider */
608 Descriptor->VerifierFlags = AVrfpVerifierFlags;
609 Descriptor->VerifierDebug = AVrfpDebug;
610
611 Descriptor->RtlpGetStackTraceAddress = AVrfpGetStackTraceAddress;
612 Descriptor->RtlpDebugPageHeapCreate = AVrfpDebugPageHeapCreate;
613 Descriptor->RtlpDebugPageHeapDestroy = AVrfpDebugPageHeapDestroy;
615 }
616 else
617 {
618 DbgPrint("AVRF: provider %wZ passed an invalid descriptor @ %p\n", &Provider->DllName, Descriptor);
620 }
621 }
622 else
623 {
624 DbgPrint("AVRF: provider %wZ did not initialize correctly\n", &Provider->DllName);
626 }
627 }
629 {
631 }
632 _SEH2_END;
633
634 if (!NT_SUCCESS(Status))
635 return Status;
636
637
639 DbgPrint("AVRF: initialized provider %wZ (descriptor @ %p)\n", &Provider->DllName, Descriptor);
640
641 /* Done loading providers, allow dll notifications */
643
646
647 /* Manually call with DLL_PROCESS_ATTACH, since the process is not done initializing */
649 {
650 if (!LdrpCallInitRoutine(Provider->EntryPoint,
651 Provider->BaseAddress,
653 NULL))
654 {
655 DbgPrint("AVRF: provider %wZ did not initialize correctly\n", &Provider->DllName);
657 }
658
659 }
661 {
663 }
664 _SEH2_END;
665
666 return Status;
667}
668
669
671NTAPI
673{
677 WCHAR* Ptr, *Next;
678
681
682 if (!NT_SUCCESS(Status))
683 return Status;
684
685 DbgPrint("AVRF: %wZ: pid 0x%X: flags 0x%X: application verifier enabled\n",
687
688 Provider = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VERIFIER_PROVIDER));
689 if (!Provider)
690 return STATUS_NO_MEMORY;
691
692 RtlInitUnicodeString(&Provider->DllName, L"verifier.dll");
694
696
697 do
698 {
699 while (*Next == L' ' || *Next == L'\t')
700 Next++;
701
702 Ptr = Next;
703
704 while (*Next != ' ' && *Next != '\t' && *Next)
705 Next++;
706
707 if (*Next)
708 *(Next++) = '\0';
709 else
710 Next = NULL;
711
712 if (*Ptr)
713 {
714 Provider = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VERIFIER_PROVIDER));
715 if (!Provider)
716 return STATUS_NO_MEMORY;
719 }
720 } while (Next);
721
724 {
726 Entry = Entry->Flink;
727
729 if (!NT_SUCCESS(Status))
730 {
731 RemoveEntryList(&Provider->ListEntry);
732 RtlFreeHeap(RtlGetProcessHeap(), 0, Provider);
733 }
734 }
735
736 if (!NT_SUCCESS(Status))
737 {
738 DbgPrint("AVRF: %wZ: pid 0x%X: application verifier will be disabled due to an initialization error.\n",
740 NtCurrentPeb()->NtGlobalFlag &= ~FLG_APPLICATION_VERIFIER;
741 }
742
743 return Status;
744}
745
#define NtCurrentPeb()
Definition: FLS.c:22
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
#define _stricmp
Definition: cat.c:22
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
PIMAGE_NT_HEADERS WINAPI ImageNtHeader(_In_ PVOID)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define RtlImageNtHeader
Definition: compat.h:806
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PPEB Peb
Definition: dllmain.c:27
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:323
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:25
GLdouble u1
Definition: glext.h:8308
#define DbgPrint
Definition: hal.h:12
#define FLG_HEAP_PAGE_ALLOCS
Definition: pstypes.h:84
#define FLG_APPLICATION_VERIFIER
Definition: pstypes.h:64
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define NtCurrentTeb
#define REG_SZ
Definition: layer.c:22
NTSTATUS NTAPI LdrQueryImageFileKeyOption(_In_ HANDLE KeyHandle, _In_ PCWSTR ValueName, _In_ ULONG Type, _Out_ PVOID Buffer, _In_ ULONG BufferSize, _Out_opt_ PULONG ReturnedLength)
Definition: ldrinit.c:184
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
Definition: ldrapi.c:312
if(dx< 0)
Definition: linetemp.h:194
static const char const char * DllPath
Definition: image.c:34
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T CommitSize
Definition: mmfuncs.h:406
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)
int Count
Definition: noreturn.cpp:7
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1657
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
#define UNICODE_NULL
ULONG AVrfpVerifierFlags
Definition: verifier.c:21
LIST_ENTRY AVrfpVerifierProvidersList
Definition: verifier.c:26
PLDR_DATA_TABLE_ENTRY LdrpImageEntry
Definition: ldrinit.c:39
NTSTATUS NTAPI LdrpInitializeApplicationVerifierPackage(HANDLE KeyHandle, PPEB Peb, BOOLEAN SystemWide, BOOLEAN ReadAdvancedOptions)
Definition: verifier.c:86
PVOID NTAPI RtlpPageHeapDestroy(HANDLE HeapPtr)
Definition: heappage.c:1678
BOOL AVrfpInitialized
Definition: verifier.c:24
VOID NTAPI AVrfReadIFEO(HANDLE KeyHandle)
Definition: verifier.c:50
ULONG AVrfpDebug
Definition: verifier.c:23
static PVOID AVrfpDebugPageHeapDestroy(HANDLE HeapPtr)
Definition: verifier.c:541
NTSTATUS NTAPI AVrfInitializeVerifier(VOID)
Definition: verifier.c:672
struct _VERIFIER_PROVIDER * PVERIFIER_PROVIDER
RTL_CRITICAL_SECTION AVrfpVerifierLock
Definition: verifier.c:25
VOID NTAPI AVrfInternalHeapFreeNotification(PVOID AllocationBase, SIZE_T AllocationSize)
Definition: verifier.c:364
SIZE_T AVrfpCountThunks(PIMAGE_THUNK_DATA Thunk)
Definition: verifier.c:124
#define VERIFIER_DLL_FLAGS_RESOLVED
Definition: verifier.c:28
static PVOID NTAPI AVrfpGetStackTraceAddress(ULONG Arg0)
Definition: verifier.c:515
VOID NTAPI AVrfpResnapInitialModules(VOID)
Definition: verifier.c:403
struct _VERIFIER_PROVIDER VERIFIER_PROVIDER
PVOID NTAPI AvrfpFindDuplicateThunk(PLIST_ENTRY EndEntry, PWCHAR DllName, PCHAR ThunkName)
Definition: verifier.c:431
BOOLEAN AVrfpIsVerifierProviderDll(PVOID BaseAddress)
Definition: verifier.c:107
WCHAR AVrfpVerifierDllsString[256]
Definition: verifier.c:22
VOID NTAPI AVrfDllUnloadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:332
static HANDLE NTAPI AVrfpDebugPageHeapCreate(ULONG Flags, PVOID Addr, SIZE_T TotalSize, SIZE_T CommitSize, PVOID Lock, PRTL_HEAP_PARAMETERS Parameters)
Definition: verifier.c:525
NTSTATUS NTAPI AVrfpLoadAndInitializeProvider(PVERIFIER_PROVIDER Provider)
Definition: verifier.c:549
VOID NTAPI AVrfDllLoadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:298
VOID NTAPI AVrfpChainDuplicateThunks(VOID)
Definition: verifier.c:477
VOID AVrfpSnapDllImports(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:133
VOID NTAPI AVrfPageHeapDllNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:390
HANDLE NTAPI RtlpPageHeapCreate(ULONG Flags, PVOID Addr, SIZE_T TotalSize, SIZE_T CommitSize, PVOID Lock, PRTL_HEAP_PARAMETERS Parameters)
Definition: heappage.c:1537
VOID AvrfpResolveThunks(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:239
ULONG RtlpDphGlobalFlags
Definition: heappage.c:108
NTSTATUS NTAPI LdrpGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress, _In_ BOOLEAN ExecuteInit)
Definition: ldrutils.c:2231
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context)
Definition: ldrutils.c:100
PVOID NTAPI LdrpFetchAddressOfEntryPoint(PVOID ImageBase)
BOOLEAN RtlpPageHeapEnabled
Definition: heappage.c:107
#define DPH_FLAG_DLL_NOTIFY
Definition: ntdllp.h:24
PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
Definition: ntimage.h:566
ULONG NtGlobalFlag
Definition: init.c:54
NTSTATUS NTAPI NtProtectVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UnsafeBaseAddress, IN OUT SIZE_T *UnsafeNumberOfBytesToProtect, IN ULONG NewAccessProtection, OUT PULONG UnsafeOldAccessProtection)
Definition: virtual.c:3111
#define STATUS_INVALID_PARAMETER_4
Definition: ntstatus.h:478
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:358
#define STATUS_DLL_INIT_FAILED
Definition: ntstatus.h:558
#define L(x)
Definition: ntvdm.h:50
#define IMAGE_DIRECTORY_ENTRY_IMPORT
Definition: pedump.c:260
BYTE * PBYTE
Definition: pedump.c:66
#define IMAGE_FILE_DLL
Definition: pedump.c:169
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SharedUserData
#define STATUS_SUCCESS
Definition: shellext.h:65
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
base of all file and directory entries
Definition: entries.h:83
HANDLE UniqueProcess
Definition: compat.h:825
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
union _IMAGE_THUNK_DATA32::@2218 u1
Definition: btrfs_drv.h:1876
PVOID DllBase
Definition: btrfs_drv.h:1880
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:149
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG NtGlobalFlag
Definition: ntddk_ex.h:270
PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks
Definition: verifier.h:20
UNICODE_STRING DllName
Definition: verifier.c:34
LIST_ENTRY ListEntry
Definition: verifier.c:33
RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback
Definition: verifier.c:42
PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls
Definition: verifier.c:39
RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback
Definition: verifier.c:40
RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback
Definition: verifier.c:41
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
VOID(NTAPI * RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK)(PVOID AllocationBase, SIZE_T AllocationSize)
Definition: verifier.h:8
#define RTL_VRF_DBG_SHOWFOUNDEXPORTS
Definition: verifier.h:70
#define RTL_VRF_DBG_SHOWCHAINING
Definition: verifier.h:73
#define RTL_VRF_DBG_LISTPROVIDERS
Definition: verifier.h:72
#define RTL_VRF_FLG_HANDLE_CHECKS
Definition: verifier.h:47
#define RTL_VRF_DBG_SHOWSNAPS
Definition: verifier.h:69
#define DLL_PROCESS_VERIFIER
Definition: verifier.h:4
#define RTL_VRF_DBG_SHOWCHAINING_DEBUG
Definition: verifier.h:74
#define RTL_VRF_DBG_SHOWVERIFIEDEXPORTS
Definition: verifier.h:71
VOID(NTAPI * RTL_VERIFIER_DLL_UNLOAD_CALLBACK)(PWSTR DllName, PVOID DllBase, SIZE_T DllSize, PVOID Reserved)
Definition: verifier.h:7
#define RTL_VRF_FLG_LOCK_CHECKS
Definition: verifier.h:64
#define RTL_VRF_FLG_FAST_FILL_HEAP
Definition: verifier.h:60
VOID(NTAPI * RTL_VERIFIER_DLL_LOAD_CALLBACK)(PWSTR DllName, PVOID DllBase, SIZE_T DllSize, PVOID Reserved)
Definition: verifier.h:6
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151
__wchar_t WCHAR
Definition: xmlstorage.h:180