ReactOS 0.4.15-dev-8222-g9164419
globals.cpp File Reference
#include "fxobjectpch.hpp"
Include dependency graph for globals.cpp:

Go to the source code of this file.

Typedefs

typedef NTSTATUS(* PFN_RTL_GET_VERSION) (__out PRTL_OSVERSIONINFOW VersionInformation)
 
typedef NTSTATUS(* PFN_RTL_VERIFY_VERSION_INFO) (__in PRTL_OSVERSIONINFOEXW VersionInfo, __in ULONG TypeMask, __in ULONGLONG ConditionMask)
 
typedef ULONGLONG(* PFN_VER_SET_CONDITION_MASK) (__in ULONGLONG ConditionMask, __in ULONG TypeMask, __in UCHAR Condition)
 

Functions

VOID VerifierPageLockHandle (VOID)
 
VOID FxLibraryGlobalsQueryRegistrySettings (VOID)
 
VOID FxRegistrySettingsInitialize (__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING RegistryPath, __in BOOLEAN WindowsVerifierOn)
 
_Must_inspect_result_ FxObjectDebugInfoFxVerifierGetObjectDebugInfo (__in HANDLE Key, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID FxVerifierQueryTrackPower (__in HANDLE Key, __out FxTrackPowerOption *TrackPower)
 
_Must_inspect_result_ BOOLEAN FxVerifyObjectTypeInTable (__in USHORT ObjectType)
 
_Must_inspect_result_ FxObjectDebugInfoFxVerifyAllocateDebugInfo (__in LPWSTR HandleNameList, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID FxDriverGlobalsInitializeDebugExtension (__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt HANDLE Key)
 
PCSTR FxObjectTypeToHandleName (__in WDFTYPE ObjectType)
 
_Must_inspect_result_ BOOLEAN FxVerifierGetTrackReferences (__in FxObjectDebugInfo *DebugInfo, __in WDFTYPE ObjectType)
 
VOID FxVerifyObjectTableIsSorted (VOID)
 
VOID FxLibraryGlobalsVerifyVersion (VOID)
 
_Must_inspect_result_ NTSTATUS FxLibraryGlobalsCommission (VOID)
 
VOID FxLibraryGlobalsDecommission (VOID)
 
VOID LockVerifierSection (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING RegistryPath)
 
VOID UnlockVerifierSection (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ NTSTATUS FxInitialize (__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in MdDriverObject DriverObject, __in PCUNICODE_STRING RegistryPath, __in_opt PWDF_DRIVER_CONFIG DriverConfig)
 
BOOLEAN IsWindowsVerifierOn (_In_ MdDriverObject DriverObject)
 
VOID FxDestroy (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
_Must_inspect_result_ PWDF_DRIVER_GLOBALS FxAllocateDriverGlobals (VOID)
 
VOID FxFreeDriverGlobals (__in PWDF_DRIVER_GLOBALS DriverGlobals)
 
VOID FxOverrideDefaultVerifierSettings (__in HANDLE Key, __in LPWSTR Name, __out PBOOLEAN OverrideValue)
 

Variables

FX_POOL FxPoolFrameworks
 
FxLibraryGlobalsType FxLibraryGlobals = { 0 }
 
const FX_OBJECT_INFO FxObjectsInfo []
 
ULONG FxObjectsInfoCount
 

Typedef Documentation

◆ PFN_RTL_GET_VERSION

typedef NTSTATUS(* PFN_RTL_GET_VERSION) (__out PRTL_OSVERSIONINFOW VersionInformation)

Definition at line 401 of file globals.cpp.

◆ PFN_RTL_VERIFY_VERSION_INFO

Definition at line 407 of file globals.cpp.

◆ PFN_VER_SET_CONDITION_MASK

typedef ULONGLONG(* PFN_VER_SET_CONDITION_MASK) (__in ULONGLONG ConditionMask, __in ULONG TypeMask, __in UCHAR Condition)

Definition at line 415 of file globals.cpp.

Function Documentation

◆ FxAllocateDriverGlobals()

_Must_inspect_result_ PWDF_DRIVER_GLOBALS FxAllocateDriverGlobals ( VOID  )

Definition at line 1052 of file globals.cpp.

1055{
1057 // KIRQL irql;
1059
1062
1063 if (pFxDriverGlobals == NULL) {
1064 return NULL;
1065 }
1066
1067 *pFxDriverGlobals = {};
1068
1070
1072#if (FX_CORE_MODE==FX_CORE_USER_MODE)
1073 if (!NT_SUCCESS(status)) {
1075 return NULL;
1076 }
1077#else
1079#endif
1080
1081 //
1082 // Initialize this new FxDriverGlobals structure.
1083 //
1084#ifndef __REACTOS__
1089#endif
1090
1097
1098 //
1099 // Verifier settings. Off by default.
1100 //
1102
1103 //
1104 // By default don't apply latest-version restricted verifier checks
1105 // to downlevel version drivers.
1106 //
1108
1109 //
1110 // Verbose is separate knob
1111 //
1113
1114 //
1115 // Do not parent queue presented requests.
1116 // This performance optimization is on by default.
1117 //
1119
1120 //
1121 // Enhanced verifier options. Off by default
1122 //
1124
1125 //
1126 // If FxVerifierDbgBreakOnError is true, WaitForSignal interrupts the
1127 // execution of the system after waiting for the specified number
1128 // of seconds. Developer will have an opportunity to validate the state
1129 // of the driver when breakpoint is hit. Developer can continue to wait
1130 // by entering 'g' in the debugger.
1131 //
1133
1134 //
1135 // Timeout used by the wake interrupt ISR in WaitForSignal to catch
1136 // scenarios where the interrupt ISR is blocked because the device stack
1137 // is taking too long to power up
1138 //
1140
1141 //
1142 // Minidump log related settings.
1143 //
1145
1146#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1147 // pFxDriverGlobals->FxTrackDriverForMiniDumpLog = TRUE;
1150#else
1153#endif
1154
1155#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1156 //
1157 // Minidump driver info related settings.
1158 //
1160#endif
1161
1162 //
1163 // By default disable the support for device simulation framework (DSF).
1164 //
1166
1167 //
1168 // Allocate a telemetry context if a telemetry client is enabled, for any level/keyword.
1169 //
1171#ifdef EVENT_TRACING // __REACTOS__
1172 if (TraceLoggingProviderEnabled(g_TelemetryProvider, 0 ,0)) {
1174 }
1175#endif
1176
1177 return &pFxDriverGlobals->Public;
1178}
LONG NTSTATUS
Definition: precomp.h:26
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in EVENT_TYPE Type, __in BOOLEAN InitialState)
Definition: mxeventkm.h:55
static __inline VOID MxFreePool(__in PVOID Ptr)
Definition: mxmemorykm.h:41
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
Definition: mxmemorykm.h:30
#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:32
KIRQL irql
Definition: wave.h:1
#define InsertHeadList(ListHead, Entry)
#define NonPagedPool
Definition: env_spec_w32.h:307
PFX_DRIVER_GLOBALS pFxDriverGlobals
struct _FX_DRIVER_GLOBALS * PFX_DRIVER_GLOBALS
Definition: fxforward.hpp:7
#define FX_TAG
Definition: fxmacros.hpp:155
DECLSPEC_SELECTANY const ULONG_PTR FxHandleValueMask
VOID AllocAndInitializeTelemetryContext(_In_ PFX_TELEMETRY_CONTEXT *TelemetryContext)
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
@ NotificationEvent
LIST_ENTRY FxDriverGlobalsList
Definition: fxglobals.h:774
MxLockNoDynam FxDriverGlobalsListLock
Definition: fxglobals.h:772
LIST_ENTRY Linkage
Definition: fxglobals.h:339
LONG WdfVerifierAllocateFailCount
Definition: fxglobals.h:362
ULONG DbgWaitForWakeInterruptIsrTimeoutInSec
Definition: fxglobals.h:534
FxDriver * Driver
Definition: fxglobals.h:374
ULONG FxEnhancedVerifierOptions
Definition: fxglobals.h:518
BOOLEAN FxVerifyDownlevel
Definition: fxglobals.h:426
FxLibraryGlobalsType * LibraryGlobals
Definition: fxglobals.h:378
VOID SetVerifierState(__in BOOLEAN State)
Definition: fxglobals.h:236
ULONG BugCheckDriverInfoIndex
Definition: fxglobals.h:506
BOOLEAN FxForceLogsInMiniDump
Definition: fxglobals.h:477
ULONG_PTR WdfHandleMask
Definition: fxglobals.h:356
FxDriverGlobalsDebugExtension * DebugExtension
Definition: fxglobals.h:376
PFX_TELEMETRY_CONTEXT TelemetryContext
Definition: fxglobals.h:540
BOOLEAN IsUserModeDriver
Definition: fxglobals.h:488
ULONG FxVerifierDbgWaitForSignalTimeoutInSec
Definition: fxglobals.h:527
BOOLEAN FxVerboseOn
Definition: fxglobals.h:462
BOOLEAN FxRequestParentOptimizationOn
Definition: fxglobals.h:467
BOOLEAN FxTrackDriverForMiniDumpLog
Definition: fxglobals.h:483
MxEvent DestroyEvent
Definition: fxglobals.h:351
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59

Referenced by FxLibraryCommonRegisterClient(), and RosInitWdf().

◆ FxDestroy()

VOID FxDestroy ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 981 of file globals.cpp.

1003{
1004 //
1005 // Release the last reference.
1006 //
1007 FxDriverGlobals->RELEASE((PVOID)FxDestroy);
1008
1009 //
1010 // Wait for everyone else to be done.
1011 //
1012 Mx::MxEnterCriticalRegion();
1013 FxDriverGlobals->DestroyEvent.WaitFor(Executive, KernelMode, FALSE, NULL);
1014 Mx::MxLeaveCriticalRegion();
1015
1016 //
1017 // Lock verifier package
1018 //
1019 FxVerifierLockDestroy(FxDriverGlobals);
1020
1021 //
1022 // Cleanup frameworks structures
1023 //
1024 FxPoolPackageDestroy(FxDriverGlobals);
1025
1026#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
1027 //
1028 // Deregister from the bugcheck callbacks.
1029 //
1030 FxUnregisterBugCheckCallback(FxDriverGlobals);
1031
1032 //
1033 // Purge driver info from bugcheck data.
1034 //
1035 FxPurgeBugCheckDriverInfo(FxDriverGlobals);
1036#endif
1037
1038#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
1039 //
1040 // unlock verifier image sections
1041 //
1042 if(FxDriverGlobals->FxVerifierOn){
1043 UnlockVerifierSection(FxDriverGlobals);
1044 }
1045#endif
1046
1047 return;
1048}
VOID FxUnregisterBugCheckCallback(__inout PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID FxPurgeBugCheckDriverInfo(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
void FxVerifierLockDestroy(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID FxPoolPackageDestroy(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: wdfpool.cpp:689
VOID UnlockVerifierSection(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: globals.cpp:827
VOID FxDestroy(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: globals.cpp:981
#define KernelMode
Definition: asm.h:34
@ Executive
Definition: ketypes.h:415

Referenced by FxDestroy(), and FxLibraryCommonUnregisterClient().

◆ FxDriverGlobalsInitializeDebugExtension()

VOID FxDriverGlobalsInitializeDebugExtension ( __inout PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in_opt HANDLE  Key 
)

Definition at line 271 of file globals.cpp.

275{
277
278 //
279 // The wdf subkey may not be present for inbox drivers that do not use inf.
280 // Since Mdl tracking doen't need regsitry info we go ahead and allocate
281 // debug extension for use in Mdl tracking. Tag tracker depends on registry
282 // info and it won't be available if registry info is not present.
283 //
284
286 NonPagedPool, sizeof(FxDriverGlobalsDebugExtension), FxDriverGlobals->Tag);
287
288 if (pExtension == NULL) {
289 return;
290 }
291
292 *pExtension = {};
293
295
297
298 pExtension->TrackPower = FxTrackPowerNone;
299
300 FxDriverGlobals->DebugExtension = pExtension;
301
302 if (Key != NULL) {
304 Key,
305 FxDriverGlobals
306 );
308 }
309
310#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
312#endif
313}
__inline VOID Initialize()
Definition: mxlockkm.h:43
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
@ FxTrackPowerNone
Definition: fxglobals.h:72
VOID FxVerifierQueryTrackPower(__in HANDLE Key, __out FxTrackPowerOption *TrackPower)
Definition: globals.cpp:1317
_Must_inspect_result_ FxObjectDebugInfo * FxVerifierGetObjectDebugInfo(__in HANDLE Key, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: globals.cpp:1225
FxTrackPowerOption TrackPower
Definition: fxglobals.h:145
FxObjectDebugInfo * ObjectDebugInfo
Definition: fxglobals.h:118
LIST_ENTRY AllocatedTagTrackersListHead
Definition: fxglobals.h:134

Referenced by FxRegistrySettingsInitialize().

◆ FxFreeDriverGlobals()

VOID FxFreeDriverGlobals ( __in PWDF_DRIVER_GLOBALS  DriverGlobals)

Definition at line 1181 of file globals.cpp.

1184{
1186 KIRQL irql;
1187
1189
1194
1196
1198
1202 }
1203
1205
1208 }
1209
1210 //
1211 // Cleanup event b/c d'tor is not called for MxAllocatePoolWithTag.
1212 //
1214
1218 }
1219
1221}
__inline VOID Uninitialize()
Definition: mxeventkm.h:146
__inline VOID Uninitialize()
Definition: mxlockkm.h:104
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
UCHAR KIRQL
Definition: env_spec_w32.h:591
DriverGlobals
VOID FxFreeAllocatedMdlsDebugInfo(__in FxDriverGlobalsDebugExtension *DebugExtension)
Definition: globalskm.cpp:20
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597

Referenced by FxLibraryCommonUnregisterClient().

◆ FxInitialize()

_Must_inspect_result_ NTSTATUS FxInitialize ( __inout PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in MdDriverObject  DriverObject,
__in PCUNICODE_STRING  RegistryPath,
__in_opt PWDF_DRIVER_CONFIG  DriverConfig 
)

Definition at line 848 of file globals.cpp.

880{
882 BOOLEAN windowsVerifierOn = FALSE;
883
885
886 //
887 // Check if windows driver verifier is on for this driver
888 // We need this when initializing wdf verifier
889 //
890 windowsVerifierOn = IsWindowsVerifierOn(DriverObject);
891
892 //
893 // Get registry values first since these effect the
894 // rest of initialization
895 //
896 FxRegistrySettingsInitialize(FxDriverGlobals,
898 windowsVerifierOn);
899
900 //
901 // Initialize IFR logging
902 //
903 // FxIFRStart(FxDriverGlobals, RegistryPath, DriverObject); __REACTOS__
904
906 "Initialize globals for %!wZ!", RegistryPath);
907
908 //
909 // Only first one initializes the frameworks globals
910 //
911 status = FxPoolPackageInitialize(FxDriverGlobals);
912 if (!NT_SUCCESS(status)) {
913 //
914 // FxPoolPackageInitialize logs a message in case of failure so
915 // we don't need to log failure here.
916 //
917 // FxIFRStop(FxDriverGlobals); __REACTOS__
918 return status;
919 }
920
921 //
922 // Lock verifier package
923 //
924 FxVerifierLockInitialize(FxDriverGlobals);
925
926#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
927 //
928 // Cache driver info for bugcheck callback.
929 //
930 FxCacheBugCheckDriverInfo(FxDriverGlobals);
931
932 //
933 // Register for bugcheck callbacks.
934 //
936#endif
937
938 if (NULL != RegistryPath) {
939 if (FALSE == FxDriverGlobals->IsCorrectVersionRegistered(RegistryPath))
940 FxDriverGlobals->RegisterClientVersion(RegistryPath);
941 }
942
943#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
944 if(FxDriverGlobals->FxVerifierOn){
945 LockVerifierSection(FxDriverGlobals, RegistryPath);
946 }
947#endif
948
949 return STATUS_SUCCESS;
950}
unsigned char BOOLEAN
#define TRACINGDRIVER
Definition: dbgtrace.h:68
VOID FxCacheBugCheckDriverInfo(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID FxRegisterBugCheckCallback(__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in PDRIVER_OBJECT DriverObject)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
void FxVerifierLockInitialize(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
_Must_inspect_result_ NTSTATUS FxPoolPackageInitialize(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: wdfpool.cpp:667
BOOLEAN IsWindowsVerifierOn(_In_ MdDriverObject DriverObject)
Definition: globals.cpp:953
VOID LockVerifierSection(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING RegistryPath)
Definition: globals.cpp:783
VOID FxRegistrySettingsInitialize(__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING RegistryPath, __in BOOLEAN WindowsVerifierOn)
Definition: globals.cpp:1361
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PWDF_DRIVER_CONFIG DriverConfig
Definition: wdfdriver.h:219
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213

◆ FxLibraryGlobalsCommission()

_Must_inspect_result_ NTSTATUS FxLibraryGlobalsCommission ( VOID  )

Definition at line 494 of file globals.cpp.

497{
498 PFN_RTL_GET_VERSION pRtlGetVersion;
500
501 //
502 // Global initialization for mode-agnostic primitives library
503 //
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
522#else
524#endif
525
526 //
527 // IFR is enabled by default
528 //
530
531 //
532 // Query global WDF settings (both KMDF and UMDF).
533 //
535
536#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
537 UNICODE_STRING funcName;
538
539 // For DSF support.
540 RtlInitUnicodeString(&funcName, L"IoConnectInterruptEx");
542 MmGetSystemRoutineAddress(&funcName);
543
544 RtlInitUnicodeString(&funcName, L"IoDisconnectInterruptEx");
546 MmGetSystemRoutineAddress(&funcName);
547
548 // 32 bit: W2k and forward.
549 // 64 bit: W2k -> Windows Server 2008 (obsolete otherwise).
550 RtlInitUnicodeString(&funcName, L"KeQueryActiveProcessors");
552 MmGetSystemRoutineAddress(&funcName);
553
554 RtlInitUnicodeString(&funcName, L"KeSetTargetProcessorDpc");
556 MmGetSystemRoutineAddress(&funcName);
557
558 // These should always be there (obsolete in 64 bit Win 7 and forward).
561
562 // Win 7 and forward.
563 RtlInitUnicodeString(&funcName, L"KeQueryActiveGroupCount");
564 if (MmGetSystemRoutineAddress(&funcName) != NULL) {
566 }
567
568 // Win 7 and forward.
569 RtlInitUnicodeString(&funcName, L"KeSetCoalescableTimer");
571 MmGetSystemRoutineAddress(&funcName);
572
573 // Win 7 and forward.
574 RtlInitUnicodeString(&funcName, L"IoUnregisterPlugPlayNotificationEx");
576 MmGetSystemRoutineAddress(&funcName);
577
578 // Win 8 and forward
579 RtlInitUnicodeString(&funcName, L"PoFxRegisterDevice");
582
583 // Win 8 and forward
584 RtlInitUnicodeString(&funcName, L"PoFxStartDevicePowerManagement");
587 MmGetSystemRoutineAddress(&funcName);
588
589 // Win 8 and forward
590 RtlInitUnicodeString(&funcName, L"PoFxUnregisterDevice");
593 MmGetSystemRoutineAddress(&funcName);
594
595 // Win 8 and forward
596 RtlInitUnicodeString(&funcName, L"PoFxActivateComponent");
598 MmGetSystemRoutineAddress(&funcName);
599
600 // Win 8 and forward
601 RtlInitUnicodeString(&funcName, L"PoFxIdleComponent");
603 MmGetSystemRoutineAddress(&funcName);
604
605 // Win 8 and forward
606 RtlInitUnicodeString(&funcName, L"PoFxReportDevicePoweredOn");
609
610 // Win 8 and forward
611 RtlInitUnicodeString(&funcName, L"PoFxCompleteIdleState");
614
615 // Win 8 and forward
616 RtlInitUnicodeString(&funcName, L"PoFxCompleteIdleCondition");
619
620 // Win 8 and forward
621 RtlInitUnicodeString(&funcName, L"PoFxCompleteDevicePowerNotRequired");
624
625 // Win 8 and forward
626 RtlInitUnicodeString(&funcName, L"PoFxSetDeviceIdleTimeout");
629
630 // Win 8 and forward
631 RtlInitUnicodeString(&funcName, L"IoReportInterruptActive");
634
635 // Win 8 and forward
636 RtlInitUnicodeString(&funcName, L"IoReportInterruptInactive");
639
640 // Win 8.2 and forward
641 RtlInitUnicodeString(&funcName, L"VfCheckNxPoolType");
644
645#endif //((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
646
648
649 // User/Kernel agnostic.
650
651 pRtlGetVersion = (PFN_RTL_GET_VERSION)
653
654 ASSERT(pRtlGetVersion != NULL);
657
658 //
659 // Initialize power management-related stuff.
660 //
663
664 //
665 // Insure that the FxObject is layed-up correctly.
666 //
668
669 //
670 // Initialize the list of FxDriverGlobals.
671 // This is essentially the list of drivers on this WDF version.
672 //
675
676#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
677 //
678 // Register for the global (library) bugcheck callbacks.
679 //
681#ifdef EVENT_TRACING // __REACTOS__
682 //
683 // Init driver usage tracker. This tracker is used by the debug dump
684 // callback routines for finding the driver's dump log file to write
685 // in the minidump. Ignore any tracker's errors.
686 //
688
689 //
690 // Initialize enhanced-verifier section handle
691 //
694
695 //
696 // Retrieve a pointer to the data structure that cotains trace routines
697 // corresponding to WdfNotifyRoutinesClass from the SystemTraceProvider
698 // that we'll use for perf tracing of WDF operations. The trace
699 // routines inside the structuyre are present only when tracing is enabled
700 // by some trace client (e.g. tracelog or xperf) for WDF specific perf
701 // groups. Note that no unregistration is necessary.
702 //
703 status = WmiQueryTraceInformation(WdfNotifyRoutinesClass,
705 sizeof(PWMI_WDF_NOTIFY_ROUTINES),
706 NULL,
707 NULL);
708
709 if (!NT_SUCCESS(status)) {
710 //
711 // WDF trace routines are available only on win8+, so failure is
712 // expected on pre-Win8 OS. Use the dummy routines on failure.
713 //
715 sizeof(WMI_WDF_NOTIFY_ROUTINES));
717 sizeof(WMI_WDF_NOTIFY_ROUTINES);
721 }
722
723 //
724 // The Size member of WMI_WDF_NOTIFY_ROUTINES allows versioning. When
725 // the WMI_WDF_NOTIFY_ROUTINES structure is revised with additional
726 // members in future OS versions, the Size member will allow validating
727 // the various versions, and initializeing the structure correctly.
728 //
730 sizeof(WMI_WDF_NOTIFY_ROUTINES));
731#else
732 status = STATUS_SUCCESS; // __REACTOS__
733#endif // EVENT_TRACING
734#else
736#endif
737
738 return status;
739}
#define VOID
Definition: acefi.h:82
static VOID MxGlobalInit(VOID)
Definition: mxgeneralkm.cpp:51
static __inline PVOID MxGetSystemRoutineAddress(__in MxFuncName FuncName)
Definition: mxgeneralkm.h:226
VOID FxInitializeBugCheckDriverInfo()
VOID(STDCALL * PFN_POX_ACTIVATE_COMPONENT)(__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
Definition: fxglobalskm.h:254
VOID(STDCALL * PFN_POX_COMPLETE_IDLE_CONDITION)(__in POHANDLE Handle, __in ULONG Component)
Definition: fxglobalskm.h:283
VOID(STDCALL * PFN_VF_CHECK_NX_POOL_TYPE)(_In_ POOL_TYPE PoolType, _In_ PVOID CallingAddress, _In_ ULONG PoolTag)
Definition: fxglobalskm.h:315
NTSTATUS(STDCALL * PFN_IO_DISCONNECT_INTERRUPT_EX)(__in PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters)
Definition: fxglobalskm.h:104
VOID(STDCALL * PFN_POX_IDLE_COMPONENT)(__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
Definition: fxglobalskm.h:262
VOID(STDCALL * PFN_IO_REPORT_INTERRUPT_ACTIVE)(_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
Definition: fxglobalskm.h:303
VOID(STDCALL * PFN_IO_REPORT_INTERRUPT_INACTIVE)(_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
Definition: fxglobalskm.h:309
NTSTATUS(STDCALL * PFN_IO_CONNECT_INTERRUPT_EX)(__inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)
Definition: fxglobalskm.h:98
VOID(STDCALL * PFN_POX_UNREGISTER_DEVICE)(__in POHANDLE Handle)
Definition: fxglobalskm.h:248
VOID(STDCALL * PFN_POX_COMPLETE_IDLE_STATE)(__in POHANDLE Handle, __in ULONG Component)
Definition: fxglobalskm.h:276
NTSTATUS(STDCALL * PFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX)(__in PVOID NotificationEntry)
Definition: fxglobalskm.h:228
VOID(STDCALL * PFN_KE_SET_TARGET_PROCESSOR_DPC)(__in PRKDPC Dpc, __in CCHAR Number)
Definition: fxglobalskm.h:175
VOID(STDCALL * PFN_POX_SET_DEVICE_IDLE_TIMEOUT)(__in POHANDLE Handle, __in ULONGLONG IdleTimeout)
Definition: fxglobalskm.h:296
VOID(STDCALL * PFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED)(__in POHANDLE Handle)
Definition: fxglobalskm.h:290
NTSTATUS(STDCALL * PFN_POX_REGISTER_DEVICE)(__in MdDeviceObject Pdo, __in PPO_FX_DEVICE PoxDevice, __out POHANDLE *Handle)
Definition: fxglobalskm.h:234
VOID(STDCALL * PFN_POX_REPORT_DEVICE_POWERED_ON)(__in POHANDLE Handle)
Definition: fxglobalskm.h:270
KAFFINITY(STDCALL * PFN_KE_QUERY_ACTIVE_PROCESSORS)(VOID)
Definition: fxglobalskm.h:169
VOID(STDCALL * PFN_POX_START_DEVICE_POWER_MANAGEMENT)(__in POHANDLE Handle)
Definition: fxglobalskm.h:242
#define WmiQueryTraceInformation
Definition: fxwmicompat.h:64
VOID FxVerifyObjectTableIsSorted(VOID)
Definition: globals.cpp:381
VOID FxLibraryGlobalsVerifyVersion(VOID)
Definition: globals.cpp:423
VOID FxLibraryGlobalsQueryRegistrySettings(VOID)
Definition: globals.cpp:464
NTSTATUS(* PFN_RTL_GET_VERSION)(__out PRTL_OSVERSIONINFOW VersionInformation)
Definition: globals.cpp:402
#define ASSERT(a)
Definition: mode.c:44
#define MAKE_MX_FUNC_NAME(x)
Definition: mxgeneralkm.h:26
BOOLEAN(STDCALL * PFN_KE_SET_COALESCABLE_TIMER)(__inout PKTIMER Timer, __in LARGE_INTEGER DueTime, __in ULONG Period, __in ULONG TolerableDelay, __in_opt PKDPC Dpc)
Definition: mxtimerkm.h:29
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define L(x)
Definition: ntvdm.h:50
FX_DRIVER_TRACKER_CACHE_AWARE DriverTracker
Definition: fxglobals.h:812
PFN_KE_QUERY_ACTIVE_PROCESSORS KeQueryActiveProcessors
Definition: fxglobals.h:734
PFN_IO_REPORT_INTERRUPT_INACTIVE IoReportInterruptInactive
Definition: fxglobals.h:764
PVOID VerifierSectionHandle
Definition: fxglobals.h:842
PFN_POX_REGISTER_DEVICE PoxRegisterDevice
Definition: fxglobals.h:742
PFN_KE_SET_TARGET_PROCESSOR_DPC KeSetTargetProcessorDpc
Definition: fxglobals.h:736
PFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED PoxCompleteDevicePowerNotRequired
Definition: fxglobals.h:758
PFN_POX_START_DEVICE_POWER_MANAGEMENT PoxStartDevicePowerManagement
Definition: fxglobals.h:744
PVOID DummyPerfTraceRoutines
Definition: fxglobals.h:863
PFN_IO_DISCONNECT_INTERRUPT_EX IoDisconnectInterruptEx
Definition: fxglobals.h:732
PFN_POX_COMPLETE_IDLE_STATE PoxCompleteIdleState
Definition: fxglobals.h:754
RTL_OSVERSIONINFOEXW OsVersionInfo
Definition: fxglobals.h:770
PFN_POX_IDLE_COMPONENT PoxIdleComponent
Definition: fxglobals.h:750
PFN_KE_SET_COALESCABLE_TIMER KeSetCoalescableTimer
Definition: fxglobals.h:738
PFN_IO_CONNECT_INTERRUPT_EX IoConnectInterruptEx
Definition: fxglobals.h:730
PFN_POX_REPORT_DEVICE_POWERED_ON PoxReportDevicePoweredOn
Definition: fxglobals.h:752
PFN_VF_CHECK_NX_POOL_TYPE VfCheckNxPoolType
Definition: fxglobals.h:766
PFN_IO_REPORT_INTERRUPT_ACTIVE IoReportInterruptActive
Definition: fxglobals.h:762
PFN_POX_COMPLETE_IDLE_CONDITION PoxCompleteIdleCondition
Definition: fxglobals.h:756
PFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX IoUnregisterPlugPlayNotificationEx
Definition: fxglobals.h:740
PFN_POX_ACTIVATE_COMPONENT PoxActivateComponent
Definition: fxglobals.h:748
BOOLEAN ProcessorGroupSupport
Definition: fxglobals.h:798
PFN_POX_SET_DEVICE_IDLE_TIMEOUT PoxSetDeviceIdleTimeout
Definition: fxglobals.h:760
BOOLEAN MachineSleepStates[FxMachineSleepStatesMax]
Definition: fxglobals.h:836
BOOLEAN IsUserModeFramework
Definition: fxglobals.h:825
PFN_POX_UNREGISTER_DEVICE PoxUnregisterDevice
Definition: fxglobals.h:746
volatile LONG VerifierSectionHandleRefCount
Definition: fxglobals.h:848
_Must_inspect_result_ NTSTATUS Initialize()
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3604
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by FxLibraryCommonCommission().

◆ FxLibraryGlobalsDecommission()

VOID FxLibraryGlobalsDecommission ( VOID  )

Definition at line 742 of file globals.cpp.

745{
746 //
747 // Assure the all driver's FxDriverGlobals have been freed.
748 //
750
751#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
752 //
753 // Cleanup for the driver usage tracker.
754 //
756
757 //
758 // Deregister from the global (library) bugcheck callbacks.
759 //
761#endif
762
764
765 return;
766}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
VOID FxUninitializeBugCheckDriverInfo()

Referenced by FxLibraryCommonDecommission().

◆ FxLibraryGlobalsQueryRegistrySettings()

VOID FxLibraryGlobalsQueryRegistrySettings ( VOID  )

Definition at line 464 of file globals.cpp.

467{
468 FxAutoRegKey hWdf;
472 ULONG ifrDisabled = 0;
473
474 status = FxRegKey::_OpenKey(NULL, &path, &hWdf.m_Key, KEY_READ);
475 if (!NT_SUCCESS(status)) {
476 goto exit;
477 }
478
479 status = FxRegKey::_QueryULong(hWdf.m_Key, &ifrDisabledName, &ifrDisabled);
480 if (!NT_SUCCESS(status)) {
481 goto exit;
482 }
483
484 if (ifrDisabled == 1) {
486 }
487
488exit:
489 return;
490}
#define WDF_REGISTRY_BASE_PATH
Definition: corepriv.hpp:31
#define KEY_READ
Definition: nt_native.h:1023
#define exit(n)
Definition: config.h:202
#define WDF_GLOBAL_VALUE_IFRDISABLED
Definition: objectpriv.hpp:36
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161

Referenced by FxLibraryGlobalsCommission().

◆ FxLibraryGlobalsVerifyVersion()

VOID FxLibraryGlobalsVerifyVersion ( VOID  )

Definition at line 423 of file globals.cpp.

426{
428 PFN_RTL_VERIFY_VERSION_INFO pRtlVerifyVersionInfo;
429 PFN_VER_SET_CONDITION_MASK pVerSetConditionMask;
432
433 pRtlVerifyVersionInfo = (PFN_RTL_VERIFY_VERSION_INFO)
434 Mx::MxGetSystemRoutineAddress(MAKE_MX_FUNC_NAME("RtlVerifyVersionInfo"));
435
436 if (pRtlVerifyVersionInfo == NULL) {
437 return;
438 }
439
440 pVerSetConditionMask = (PFN_VER_SET_CONDITION_MASK)
441 Mx::MxGetSystemRoutineAddress(MAKE_MX_FUNC_NAME("VerSetConditionMask"));
442
443 //
444 // Check for Win8 (6.2) and later for passive-level interrupt support.
445 //
446 RtlZeroMemory(&info, sizeof(info));
447 info.dwOSVersionInfoSize = sizeof(info);
448 info.dwMajorVersion = 6;
449 info.dwMinorVersion = 2;
450
451 condition = 0;
452 condition = pVerSetConditionMask(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);
453 condition = pVerSetConditionMask(condition, VER_MINORVERSION, VER_GREATER_EQUAL);
454
455 status = pRtlVerifyVersionInfo(&info,
457 condition);
458 if (NT_SUCCESS(status)) {
460 }
461}
GLenum condition
Definition: glext.h:9255
NTSTATUS(* PFN_RTL_VERIFY_VERSION_INFO)(__in PRTL_OSVERSIONINFOEXW VersionInfo, __in ULONG TypeMask, __in ULONGLONG ConditionMask)
Definition: globals.cpp:408
ULONGLONG(* PFN_VER_SET_CONDITION_MASK)(__in ULONGLONG ConditionMask, __in ULONG TypeMask, __in UCHAR Condition)
Definition: globals.cpp:416
#define VER_MAJORVERSION
Definition: rtltypes.h:229
#define VER_GREATER_EQUAL
Definition: rtltypes.h:241
#define VER_MINORVERSION
Definition: rtltypes.h:228
BOOLEAN PassiveLevelInterruptSupport
Definition: fxglobals.h:820
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by FxLibraryGlobalsCommission().

◆ FxObjectTypeToHandleName()

PCSTR FxObjectTypeToHandleName ( __in WDFTYPE  ObjectType)

Definition at line 316 of file globals.cpp.

319{
320 ULONG i;
321
322 for (i = 0; i < FxObjectsInfoCount; i++) {
324 return FxObjectsInfo[i].HandleName;
325 }
326 else if (ObjectType > FxObjectsInfo[i].ObjectType) {
327 continue;
328 }
329
330 return NULL;
331 }
332
333 return NULL;
334}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG FxObjectsInfoCount
const FX_OBJECT_INFO FxObjectsInfo[]
ObjectType
Definition: metafile.c:81
const CHAR * HandleName
Definition: fxglobals.h:887

Referenced by FxObject::~FxObject().

◆ FxOverrideDefaultVerifierSettings()

VOID FxOverrideDefaultVerifierSettings ( __in HANDLE  Key,
__in LPWSTR  Name,
__out PBOOLEAN  OverrideValue 
)

Definition at line 1336 of file globals.cpp.

1341{
1342 UNICODE_STRING valueName;
1343 ULONG value = 0;
1344
1345 RtlInitUnicodeString(&valueName, Name);
1346
1347 if (NT_SUCCESS(FxRegKey::_QueryULong(Key,
1348 (PCUNICODE_STRING)&valueName,
1349 &value))) {
1350 if (value) {
1351 *OverrideValue = TRUE;
1352 } else {
1353 *OverrideValue = FALSE;
1354 }
1355 }
1356
1357}
Definition: pdh_main.c:94

Referenced by FxRegistrySettingsInitialize().

◆ FxRegistrySettingsInitialize()

VOID FxRegistrySettingsInitialize ( __inout PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PCUNICODE_STRING  RegistryPath,
__in BOOLEAN  WindowsVerifierOn 
)

Definition at line 1361 of file globals.cpp.

1382{
1384 RTL_QUERY_REGISTRY_TABLE paramTable[10];
1385 ULONG verifierOnValue;
1386 ULONG verifyDownlevelValue;
1387 ULONG verboseValue;
1388 ULONG allocateFailValue;
1389 ULONG forceLogsInMiniDump;
1390 ULONG trackDriverForMiniDumpLog;
1391 ULONG requestParentOptimizationOn;
1392 ULONG dsfValue;
1393 ULONG removeLockOptionFlags;
1394 ULONG zero = 0;
1395 ULONG max = 0xFFFFFFFF;
1396 ULONG defaultTrue = (ULONG) TRUE;
1397 ULONG i;
1398 ULONG timeoutValue = 0;
1399 FxAutoRegKey hDriver, hWdf;
1400 DECLARE_CONST_UNICODE_STRING(parametersPath, L"Parameters\\Wdf");
1401
1402 typedef NTSTATUS NTAPI QUERYFN(
1404
1405 QUERYFN* queryFn;
1406
1407#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1409#endif
1410
1411 //
1412 // UMDF may not provide this registry path
1413 //
1414 if (NULL == RegistryPath) {
1415 return;
1416 }
1417
1418 status = FxRegKey::_OpenKey(NULL, RegistryPath, &hDriver.m_Key, KEY_READ);
1419 if (!NT_SUCCESS(status)) {
1420 return;
1421 }
1422
1423 status = FxRegKey::_OpenKey(hDriver.m_Key, &parametersPath, &hWdf.m_Key, KEY_READ);
1424 if (!NT_SUCCESS(status)) {
1425 //
1426 // For version >= 1.9 we enable WDF verifier automatically when driver
1427 // verifier or app verifier is enabled. Since inbox drivers may not have
1428 // WDF subkey populated as they may not use INF, we need to enable
1429 // verifier even if we fail to open wdf subkey (if DriverVerifier is on).
1430 //
1431 if (FxDriverGlobals->IsVersionGreaterThanOrEqualTo(1,9)) {
1432 //
1433 // Verifier settings are all or nothing. We currently do not support
1434 // turning on individual sub-verifiers.
1435 //
1436 FxDriverGlobals->SetVerifierState(WindowsVerifierOn);
1437 if (FxDriverGlobals->FxVerifierOn) {
1439 }
1440 }
1441
1442 return;
1443 }
1444
1445 RtlZeroMemory (&paramTable[0], sizeof(paramTable));
1446 i = 0;
1447
1448 verboseValue = 0;
1449
1450 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1451 paramTable[i].Name = L"VerboseOn";
1452 paramTable[i].EntryContext = &verboseValue;
1453 paramTable[i].DefaultType = REG_DWORD;
1454 paramTable[i].DefaultData = &zero;
1455 paramTable[i].DefaultLength = sizeof(ULONG);
1456
1457 allocateFailValue = (ULONG) -1;
1458 i++;
1459
1460 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1461 paramTable[i].Name = L"VerifierAllocateFailCount";
1462 paramTable[i].EntryContext = &allocateFailValue;
1463 paramTable[i].DefaultType = REG_DWORD;
1464 paramTable[i].DefaultData = &max;
1465 paramTable[i].DefaultLength = sizeof(ULONG);
1466
1467 verifierOnValue = 0;
1468
1469 //
1470 // If the client version is 1.9 or above, the defaut (i.e when
1471 // the key is not present) VerifierOn state is tied to the
1472 // driver verifier.
1473 //
1474 if (FxDriverGlobals->IsVersionGreaterThanOrEqualTo(1,9)) {
1475 verifierOnValue = WindowsVerifierOn;
1476 }
1477
1478 i++;
1479
1480 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1481 paramTable[i].Name = L"VerifierOn";
1482 paramTable[i].EntryContext = &verifierOnValue;
1483 paramTable[i].DefaultType = REG_DWORD;
1484 paramTable[i].DefaultData = &verifierOnValue;
1485 paramTable[i].DefaultLength = sizeof(ULONG);
1486
1487 verifyDownlevelValue = 0;
1488 i++;
1489
1490 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1491 paramTable[i].Name = L"VerifyDownLevel";
1492 paramTable[i].EntryContext = &verifyDownlevelValue;
1493 paramTable[i].DefaultType = REG_DWORD;
1494 paramTable[i].DefaultData = &zero;
1495 paramTable[i].DefaultLength = sizeof(ULONG);
1496
1497 forceLogsInMiniDump = 0;
1498 i++;
1499
1500 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1501 paramTable[i].Name = L"ForceLogsInMiniDump";
1502 paramTable[i].EntryContext = &forceLogsInMiniDump;
1503 paramTable[i].DefaultType = REG_DWORD;
1504 paramTable[i].DefaultData = &zero;
1505 paramTable[i].DefaultLength = sizeof(ULONG);
1506
1507 //
1508 // Track driver for minidump log:
1509 // Default for KMDF is on.
1510 // Default for UMDF is off.
1511 //
1512#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1513 trackDriverForMiniDumpLog = (ULONG) TRUE;
1514#else
1515 trackDriverForMiniDumpLog = 0;
1516#endif
1517 i++;
1518
1519 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1520 paramTable[i].Name = L"TrackDriverForMiniDumpLog";
1521 paramTable[i].EntryContext = &trackDriverForMiniDumpLog;
1522 paramTable[i].DefaultType = REG_DWORD;
1523#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1524 paramTable[i].DefaultData = &defaultTrue;
1525#else
1526 paramTable[i].DefaultData = &zero;
1527#endif
1528 paramTable[i].DefaultLength = sizeof(ULONG);
1529
1530 requestParentOptimizationOn = (ULONG) TRUE;
1531 i++;
1532
1533 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1534 paramTable[i].Name = L"RequestParentOptimizationOn";
1535 paramTable[i].EntryContext = &requestParentOptimizationOn;
1536 paramTable[i].DefaultType = REG_DWORD;
1537 paramTable[i].DefaultData = &defaultTrue;
1538 paramTable[i].DefaultLength = sizeof(ULONG);
1539
1540 dsfValue = 0;
1541 i++;
1542
1543 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1544 paramTable[i].Name = L"DsfOn";
1545 paramTable[i].EntryContext = &dsfValue;
1546 paramTable[i].DefaultType = REG_DWORD;
1547 paramTable[i].DefaultData = &zero;
1548 paramTable[i].DefaultLength = sizeof(ULONG);
1549
1550 removeLockOptionFlags = 0;
1551 i++;
1552
1553 paramTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
1554 paramTable[i].Name = L"RemoveLockOptionFlags";
1555 paramTable[i].EntryContext = &removeLockOptionFlags;
1556 paramTable[i].DefaultType = REG_DWORD;
1557 paramTable[i].DefaultData = &zero;
1558 paramTable[i].DefaultLength = sizeof(ULONG);
1559
1560 ASSERT(i < sizeof(paramTable) / sizeof(paramTable[0]));
1561
1562#if (FX_CORE_MODE==FX_CORE_USER_MODE)
1563
1564 queryFn = (QUERYFN*) GetProcAddress(
1565 GetModuleHandle(TEXT("ntdll.dll")),
1566 "RtlQueryRegistryValuesEx"
1567 );
1568
1569#else
1570
1571 RtlInitUnicodeString(&FunctionName, L"RtlQueryRegistryValuesEx");
1572
1573#pragma warning(push)
1574#pragma warning(disable: 4055)
1575
1576 queryFn = (QUERYFN*)MmGetSystemRoutineAddress(&FunctionName);
1577
1578#pragma warning(pop)
1579
1580#endif
1581
1582 if (queryFn == NULL) {
1583 queryFn = &RtlQueryRegistryValues;
1584 }
1585
1586 status = queryFn(
1588 (PWSTR) hWdf.m_Key,
1589 &paramTable[0],
1590 NULL,
1591 NULL
1592 );
1593
1594 //
1595 // Only examine key values on success
1596 //
1597 if (NT_SUCCESS(status)) {
1598
1599 if (verboseValue) {
1600 FxDriverGlobals->FxVerboseOn = TRUE;
1601 }
1602 else {
1603 FxDriverGlobals->FxVerboseOn = FALSE;
1604 }
1605
1606 if (allocateFailValue != (ULONG) -1) {
1607 FxDriverGlobals->WdfVerifierAllocateFailCount = (LONG) allocateFailValue;
1608 }
1609 else {
1610 FxDriverGlobals->WdfVerifierAllocateFailCount = -1;
1611 }
1612
1613 //
1614 // Verifier settings are all or nothing. We currently do not support
1615 // turning on individual sub-verifiers.
1616 //
1617 FxDriverGlobals->SetVerifierState(verifierOnValue ? TRUE : FALSE);
1618
1619 if (FxDriverGlobals->FxVerifierOn) {
1620 FxDriverGlobalsInitializeDebugExtension(FxDriverGlobals, hWdf.m_Key);
1621 }
1622
1623 //
1624 // Update FxVerifyDownLevel independent of FxVerifyOn because for UMDF
1625 // verifer is always on so it does not consume FxVerifyOn value
1626 //
1627 if (verifyDownlevelValue) {
1628 FxDriverGlobals->FxVerifyDownlevel = TRUE;
1629 }
1630 else {
1631 FxDriverGlobals->FxVerifyDownlevel = FALSE;
1632 }
1633
1634 //
1635 // See if there exists an override in the registry for WDFVERIFY state.
1636 // We query for this separately so that we can establish a default state
1637 // based on verifierOnValue, and then know if the value was present in
1638 // the registry to override the default.
1639 //
1641 L"VerifyOn",
1642 &FxDriverGlobals->FxVerifyOn);
1643
1644 if (FxDriverGlobals->FxVerifyOn) {
1645 FxDriverGlobals->Public.DriverFlags |= WdfVerifyOn;
1646 }
1647
1649 L"DbgBreakOnError",
1650 &FxDriverGlobals->FxVerifierDbgBreakOnError);
1651
1653 L"DbgBreakOnDeviceStateError",
1654 &FxDriverGlobals->FxVerifierDbgBreakOnDeviceStateError);
1655
1656 if (FxDriverGlobals->FxVerifierDbgBreakOnError) {
1657 timeoutValue = 0;
1658 DECLARE_CONST_UNICODE_STRING(timeoutName, L"DbgWaitForSignalTimeoutInSec");
1659
1660 //
1661 // Get the override value for the WaitForSignal's timeout if present.
1662 //
1663 if (NT_SUCCESS(FxRegKey::_QueryULong(hWdf.m_Key,
1664 &timeoutName,
1665 &timeoutValue))) {
1666
1667 FxDriverGlobals->FxVerifierDbgWaitForSignalTimeoutInSec = timeoutValue;
1668 }
1669 }
1670
1671 timeoutValue = 0;
1672 DECLARE_CONST_UNICODE_STRING(timeoutName, L"DbgWaitForWakeInterruptIsrTimeoutInSec");
1673
1674 //
1675 // Get the override value for the Wake Interrupt ISR timeout if present.
1676 // Since the wake interrupt feature is only supported for 1.13 and higher,
1677 // avoid querying the reg key for older versions
1678 //
1679 if (FxDriverGlobals->IsVersionGreaterThanOrEqualTo(1,13) &&
1680 NT_SUCCESS(FxRegKey::_QueryULong(hWdf.m_Key,
1681 &timeoutName,
1682 &timeoutValue))) {
1683
1684 FxDriverGlobals->DbgWaitForWakeInterruptIsrTimeoutInSec = timeoutValue;
1685 }
1686
1687 FxDriverGlobals->FxForceLogsInMiniDump =
1688 (forceLogsInMiniDump) ? TRUE : FALSE;
1689
1690 FxDriverGlobals->FxTrackDriverForMiniDumpLog =
1691 (trackDriverForMiniDumpLog) ? TRUE : FALSE;
1692
1693 FxDriverGlobals->FxRequestParentOptimizationOn =
1694 (requestParentOptimizationOn) ? TRUE : FALSE;
1695
1696 FxDriverGlobals->FxDsfOn = (dsfValue) ? TRUE : FALSE;
1697
1698 FxDriverGlobals->RemoveLockOptionFlags = removeLockOptionFlags;
1699 }
1700
1701 return;
1702}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
Definition: acpixf.h:1279
#define GetProcAddress(x, y)
Definition: compat.h:753
VOID FxDriverGlobalsInitializeDebugExtension(__inout PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt HANDLE Key)
Definition: globals.cpp:271
VOID FxOverrideDefaultVerifierSettings(__in HANDLE Key, __in LPWSTR Name, __out PBOOLEAN OverrideValue)
Definition: globals.cpp:1336
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
#define TEXT(s)
Definition: k32.h:26
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_OPTIONAL
Definition: nt_native.h:169
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
int zero
Definition: sehframes.cpp:29
#define max(a, b)
Definition: svc.c:63
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
@ WdfVerifyOn
Definition: wdfdriver.h:53
#define GetModuleHandle
Definition: winbase.h:3827
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3557

Referenced by FxInitialize().

◆ FxVerifierGetObjectDebugInfo()

_Must_inspect_result_ FxObjectDebugInfo * FxVerifierGetObjectDebugInfo ( __in HANDLE  Key,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals 
)

Definition at line 1225 of file globals.cpp.

1244{
1245 FxObjectDebugInfo* pInfo;
1248 ULONG length, type;
1249 DECLARE_CONST_UNICODE_STRING(valueName, L"TrackHandles");
1250
1251 pInfo = NULL;
1253 length = 0;
1254
1255 //
1256 // Find out how big a buffer we need to allocate if the value is present
1257 //
1258 status = FxRegKey::_QueryValue(FxDriverGlobals,
1259 Key,
1260 &valueName,
1261 length,
1262 NULL,
1263 &length,
1264 &type);
1265
1266 //
1267 // We expect the list to be bigger then a standard partial, so if it is
1268 // not, just bail now.
1269 //
1271 return NULL;
1272 }
1273
1274 //
1275 // Pool can be paged b/c we are running at PASSIVE_LEVEL and we are going
1276 // to free it at the end of this function.
1277 //
1279 if (dataBuffer == NULL) {
1280 return NULL;
1281 }
1282
1283 //
1284 // Requery now that we have a big enough buffer
1285 //
1286 status = FxRegKey::_QueryValue(FxDriverGlobals,
1287 Key,
1288 &valueName,
1289 length,
1290 dataBuffer,
1291 &length,
1292 &type);
1293 if (NT_SUCCESS(status)) {
1294 //
1295 // Verify that the data from the registry is a valid multi-sz string.
1296 //
1297 status = FxRegKey::_VerifyMultiSzString(FxDriverGlobals,
1298 &valueName,
1300 length);
1301 }
1302
1303 if (NT_SUCCESS(status)) {
1304#pragma prefast(push)
1305#pragma prefast(suppress:__WARNING_PRECONDITION_NULLTERMINATION_VIOLATION, "FxRegKey::_VerifyMultiSzString makes sure the string is NULL-terminated")
1306 pInfo = FxVerifyAllocateDebugInfo((LPWSTR) dataBuffer, FxDriverGlobals);
1307#pragma prefast(pop)
1308
1309 }
1310
1312
1313 return pInfo;
1314}
static _Must_inspect_result_ NTSTATUS _VerifyMultiSzString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING RegValueName, __in_bcount(DataLength) PWCHAR DataString, __in ULONG DataLength)
Definition: fxregkey.cpp:14
#define PagedPool
Definition: env_spec_w32.h:308
PVOID dataBuffer
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_Must_inspect_result_ FxObjectDebugInfo * FxVerifyAllocateDebugInfo(__in LPWSTR HandleNameList, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: globals.cpp:139
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
uint16_t * PWCHAR
Definition: typedefs.h:56
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FxDriverGlobalsInitializeDebugExtension().

◆ FxVerifierGetTrackReferences()

_Must_inspect_result_ BOOLEAN FxVerifierGetTrackReferences ( __in FxObjectDebugInfo DebugInfo,
__in WDFTYPE  ObjectType 
)

Definition at line 338 of file globals.cpp.

358{
359 ULONG i;
360
361 //
362 // Array size of DebugInfo is the same size as FxObjectsInfo
363 //
364 for (i = 0; i < FxObjectsInfoCount; i++) {
365 if (ObjectType == DebugInfo[i].ObjectType) {
366 return FLAG_TO_BOOL(DebugInfo[i].u.DebugFlags,
368 }
369 else if (ObjectType > FxObjectsInfo[i].ObjectType) {
370 continue;
371 }
372
373 return FALSE;
374 }
375
376 return FALSE;
377}
@ FxObjectDebugTrackReferences
Definition: fxglobals.h:68
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240

Referenced by FxObject::AllocateTagTracker().

◆ FxVerifierQueryTrackPower()

VOID FxVerifierQueryTrackPower ( __in HANDLE  Key,
__out FxTrackPowerOption TrackPower 
)

Definition at line 1317 of file globals.cpp.

1321{
1323 ULONG value = 0;
1324 DECLARE_CONST_UNICODE_STRING(valueName, L"TrackPower");
1325
1326 status = FxRegKey::_QueryULong(Key, &valueName, &value);
1328 *TrackPower = (FxTrackPowerOption)value;
1329 }
1330 else {
1331 *TrackPower = FxTrackPowerNone;
1332 }
1333}
FxTrackPowerOption
Definition: fxglobals.h:71
@ FxTrackPowerMaxValue
Definition: fxglobals.h:75

Referenced by FxDriverGlobalsInitializeDebugExtension().

◆ FxVerifyAllocateDebugInfo()

_Must_inspect_result_ FxObjectDebugInfo * FxVerifyAllocateDebugInfo ( __in LPWSTR  HandleNameList,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals 
)

Definition at line 139 of file globals.cpp.

164{
165 FxObjectDebugInfo* pInfo;
166 PWCHAR pCur;
167 ULONG i, length;
168 BOOLEAN all;
169
170 //
171 // check to see if the multi sz is empty
172 //
173 if (*HandleNameList == NULL) {
174 return NULL;
175 }
176
178
179 //
180 // Freed with ExFreePool in FxFreeDriverGlobals. Must be non paged because
181 // objects can be allocated at IRQL > PASSIVE_LEVEL.
182 //
184 length,
185 FxDriverGlobals->Tag);
186
187 if (pInfo == NULL) {
188 return NULL;
189 }
190
191 all = *HandleNameList == L'*' ? TRUE : FALSE;
192
193 RtlZeroMemory(pInfo, length);
194
195 //
196 // Iterate over all of the objects in our internal array. We iterate over
197 // this array instead of the multi sz list b/c this way we only convert
198 // each ANSI string to UNICODE once.
199 //
200 for (i = 0; i < FxObjectsInfoCount; i++) {
201 UNICODE_STRING objectName;
202 WCHAR ubuffer[40];
204
206
207 //
208 // If this is an internal object, just continue past it
209 //
210 if (FxObjectsInfo[i].HandleName == NULL) {
211 continue;
212 }
213
214 //
215 // Short circuit if we are wildcarding
216 //
217 if (all) {
219 continue;
220 }
221
222 RtlInitAnsiString(&string, FxObjectsInfo[i].HandleName);
223
224 RtlZeroMemory(ubuffer, sizeof(ubuffer));
225 objectName.Buffer = ubuffer;
226 objectName.Length = 0;
227 objectName.MaximumLength = sizeof(ubuffer);
228
229 //
230 // Conversion failed, just continue. Failure is not critical to
231 // returning the list.
232 //
234 &string,
235 FALSE))) {
236 continue;
237 }
238
239 //
240 // Now iterate over the multi sz list, comparing handle strings in the
241 // list against the current object name.
242 //
243 pCur = HandleNameList;
244
245 while (*pCur != UNICODE_NULL) {
246 UNICODE_STRING handleName;
247
248 RtlInitUnicodeString(&handleName, pCur);
249
250 //
251 // Increment to the next string now. Add one so that we skip past
252 // terminating null for this sz as well.
253 // Length is the number of bytes, not the number of characters.
254 //
255 pCur += handleName.Length / sizeof(WCHAR) + 1;
256
257 //
258 // Case insensitive compare
259 //
260 if (RtlCompareUnicodeString(&handleName, &objectName, TRUE) == 0) {
262 break;
263 }
264 }
265 }
266
267 return pInfo;
268}
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
std::wstring STRING
Definition: fontsub.cpp:33
SINGLE_LIST_ENTRY * pCur
char string[160]
Definition: util.h:11
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define UNICODE_NULL
USHORT ObjectType
Definition: fxglobals.h:94
union FxObjectDebugInfo::@4774 u
USHORT ObjectType
Definition: fxglobals.h:898
USHORT MaximumLength
Definition: env_spec_w32.h:370
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by FxVerifierGetObjectDebugInfo().

◆ FxVerifyObjectTableIsSorted()

VOID FxVerifyObjectTableIsSorted ( VOID  )

Definition at line 381 of file globals.cpp.

384{
385 ULONG i;
386 USHORT prevType;
387
388 prevType = FxObjectsInfo[0].ObjectType;
389
390 for (i = 1; i < FxObjectsInfoCount; i++) {
391 if (prevType >= FxObjectsInfo[i].ObjectType) {
392 ASSERTMSG("FxObjectsInfo table is not in sorted order\n",
393 prevType < FxObjectsInfo[i].ObjectType);
394 }
395
396 prevType = FxObjectsInfo[i].ObjectType;
397 }
398}
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
unsigned short USHORT
Definition: pedump.c:61

Referenced by FxLibraryGlobalsCommission().

◆ FxVerifyObjectTypeInTable()

_Must_inspect_result_ BOOLEAN FxVerifyObjectTypeInTable ( __in USHORT  ObjectType)

Definition at line 117 of file globals.cpp.

120{
121 ULONG i;
122
123 for (i = 0; i < FxObjectsInfoCount; i++) {
125 return TRUE;
126 }
127 else if (ObjectType > FxObjectsInfo[i].ObjectType) {
128 continue;
129 }
130
131 return FALSE;
132 }
133
134 return FALSE;
135}

◆ IsWindowsVerifierOn()

BOOLEAN IsWindowsVerifierOn ( _In_ MdDriverObject  DriverObject)

Definition at line 953 of file globals.cpp.

956{
957 BOOLEAN windowsVerifierOn = FALSE;
958
959#if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
960 //
961 // Check if windows driver verifier is on for this driver
962 // We need this when initializing wdf verifier
963 //
964 windowsVerifierOn = MmIsDriverVerifying(DriverObject) ? TRUE: FALSE;
965
966#else
968
969 //
970 // For user-mode we check if app verifier's verifier.dll is loaded in this
971 // process (since app verifier doesn't provide any other way to detect its
972 // presence).
973 //
974 windowsVerifierOn = (GetModuleHandleW(L"verifier.dll") == NULL ? FALSE : TRUE);
975#endif
976
977 return windowsVerifierOn;
978}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
LOGICAL NTAPI MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject)
Definition: drvmgmt.c:212

Referenced by FxInitialize().

◆ LockVerifierSection()

VOID LockVerifierSection ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals,
_In_ PCUNICODE_STRING  RegistryPath 
)

Definition at line 783 of file globals.cpp.

787{
788 LONG count;
789
790 //
791 // This asserts makes sure the struct is not pack(1) and the counter
792 // is correctly aligned on a 32 bit boundary.
793 //
794 C_ASSERT((FIELD_OFFSET(FxLibraryGlobalsType, VerifierSectionHandleRefCount)
795 % __alignof(LONG)) == 0);
796
798 ASSERT(count > 0);
799
800 //
801 // If verifier section is unlocked, lock it in.
802 //
804 //
805 //First time verifier section is being locked.
806 //
808 "First time Locking (%d) in Verifier Paged Memory "
809 "from %!wZ! from driver globals %p",
810 count, RegistryPath, FxDriverGlobals);
811 //
812 // VerifierLockHandle is a function that we use to lock in all the code from it's section
813 // since all the verifier code is in the same section as VerifierLockHandle.
814 //
816 }
817 else {
818 MmLockPagableSectionByHandle(FxLibraryGlobals.VerifierSectionHandle);
820 "Increment Lock counter (%d) for Verifier Paged Memory "
821 "from %!wZ! from driver globals %p",
822 count, RegistryPath, FxDriverGlobals);
823 }
824}
#define InterlockedIncrement
Definition: armddk.h:53
GLuint GLuint GLsizei count
Definition: gl.h:1545
VOID VerifierPageLockHandle(VOID)
Definition: globals.cpp:774
#define C_ASSERT(e)
Definition: intsafe.h:73
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define MmLockPagableCodeSection(Address)

Referenced by FxInitialize(), and FxLibraryCommonRegisterClient().

◆ UnlockVerifierSection()

VOID UnlockVerifierSection ( _In_ PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 827 of file globals.cpp.

830{
832 LONG count;
833
835 ASSERT(count >= 0);
836
837 MmUnlockPagableImageSection(FxLibraryGlobals.VerifierSectionHandle);
839 "Decrement UnLock counter (%d) for Verifier Paged Memory "
840 "with driver globals %p",
841 count, FxDriverGlobals);
842 }
843}
#define InterlockedDecrement
Definition: armddk.h:52

Referenced by FxDestroy(), and FxLibraryCommonUnregisterClient().

◆ VerifierPageLockHandle()

VOID VerifierPageLockHandle ( VOID  )

Definition at line 774 of file globals.cpp.

777{
779 DO_NOTHING();
780}
#define DO_NOTHING()
Definition: mxgeneral.h:32
#define PAGED_CODE_LOCKED()
Definition: kefuncs.h:1417

Referenced by LockVerifierSection().

Variable Documentation

◆ FxLibraryGlobals

◆ FxObjectsInfo

◆ FxObjectsInfoCount

◆ FxPoolFrameworks

FX_POOL FxPoolFrameworks

Definition at line 93 of file globals.cpp.