ReactOS 0.4.16-dev-1948-gd260c1d
globals.cpp File Reference
#include "fxobjectpch.hpp"
Include dependency graph for globals.cpp:

Go to the source code of this file.

Typedefs

typedef NTSTATUS(NTAPIPFN_RTL_GET_VERSION) (__out PRTL_OSVERSIONINFOW VersionInformation)
 
typedef NTSTATUS(NTAPIPFN_RTL_VERIFY_VERSION_INFO) (__in PRTL_OSVERSIONINFOEXW VersionInfo, __in ULONG TypeMask, __in ULONGLONG ConditionMask)
 
typedef ULONGLONG(NTAPIPFN_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(NTAPI * 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(NTAPI * 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 //
1088
1095
1096 //
1097 // Verifier settings. Off by default.
1098 //
1100
1101 //
1102 // By default don't apply latest-version restricted verifier checks
1103 // to downlevel version drivers.
1104 //
1106
1107 //
1108 // Verbose is separate knob
1109 //
1111
1112 //
1113 // Do not parent queue presented requests.
1114 // This performance optimization is on by default.
1115 //
1117
1118 //
1119 // Enhanced verifier options. Off by default
1120 //
1122
1123 //
1124 // If FxVerifierDbgBreakOnError is true, WaitForSignal interrupts the
1125 // execution of the system after waiting for the specified number
1126 // of seconds. Developer will have an opportunity to validate the state
1127 // of the driver when breakpoint is hit. Developer can continue to wait
1128 // by entering 'g' in the debugger.
1129 //
1131
1132 //
1133 // Timeout used by the wake interrupt ISR in WaitForSignal to catch
1134 // scenarios where the interrupt ISR is blocked because the device stack
1135 // is taking too long to power up
1136 //
1138
1139 //
1140 // Minidump log related settings.
1141 //
1143
1144#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1145 // pFxDriverGlobals->FxTrackDriverForMiniDumpLog = TRUE;
1148#else
1151#endif
1152
1153#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1154 //
1155 // Minidump driver info related settings.
1156 //
1158#endif
1159
1160 //
1161 // By default disable the support for device simulation framework (DSF).
1162 //
1164
1165 //
1166 // Allocate a telemetry context if a telemetry client is enabled, for any level/keyword.
1167 //
1169#ifdef EVENT_TRACING // __REACTOS__
1170 if (TraceLoggingProviderEnabled(g_TelemetryProvider, 0 ,0)) {
1172 }
1173#endif
1174
1175 return &pFxDriverGlobals->Public;
1176}
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:33
KIRQL irql
Definition: wave.h:1
#define InsertHeadList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#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:329
@ 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().

◆ 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:38
@ Executive
Definition: ketypes.h:467

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:1315
_Must_inspect_result_ FxObjectDebugInfo * FxVerifierGetObjectDebugInfo(__in HANDLE Key, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: globals.cpp:1223
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 1179 of file globals.cpp.

1182{
1184 KIRQL irql;
1185
1186 pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals);
1187
1192
1194
1196
1200 }
1201
1203
1206 }
1207
1208 //
1209 // Cleanup event b/c d'tor is not called for MxAllocatePoolWithTag.
1210 //
1212
1216 }
1217
1219}
__inline VOID Uninitialize()
Definition: mxeventkm.h:146
__inline VOID Uninitialize()
Definition: mxlockkm.h:104
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
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:1359
#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
#define L(x)
Definition: resources.c:13
VOID FxInitializeBugCheckDriverInfo()
VOID(NTAPI * PFN_IO_REPORT_INTERRUPT_INACTIVE)(_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
Definition: fxglobalskm.h:309
VOID(NTAPI * PFN_POX_START_DEVICE_POWER_MANAGEMENT)(__in POHANDLE Handle)
Definition: fxglobalskm.h:242
NTSTATUS(NTAPI * PFN_IO_DISCONNECT_INTERRUPT_EX)(__in PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters)
Definition: fxglobalskm.h:104
VOID(NTAPI * PFN_POX_REPORT_DEVICE_POWERED_ON)(__in POHANDLE Handle)
Definition: fxglobalskm.h:270
NTSTATUS(NTAPI * PFN_IO_CONNECT_INTERRUPT_EX)(__inout PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)
Definition: fxglobalskm.h:98
VOID(NTAPI * PFN_POX_UNREGISTER_DEVICE)(__in POHANDLE Handle)
Definition: fxglobalskm.h:248
VOID(NTAPI * PFN_VF_CHECK_NX_POOL_TYPE)(_In_ POOL_TYPE PoolType, _In_ PVOID CallingAddress, _In_ ULONG PoolTag)
Definition: fxglobalskm.h:315
NTSTATUS(NTAPI * PFN_IO_UNREGISTER_PLUGPLAY_NOTIFICATION_EX)(__in PVOID NotificationEntry)
Definition: fxglobalskm.h:228
VOID(NTAPI * PFN_KE_SET_TARGET_PROCESSOR_DPC)(__in PRKDPC Dpc, __in CCHAR Number)
Definition: fxglobalskm.h:175
KAFFINITY(NTAPI * PFN_KE_QUERY_ACTIVE_PROCESSORS)(VOID)
Definition: fxglobalskm.h:169
VOID(NTAPI * PFN_POX_SET_DEVICE_IDLE_TIMEOUT)(__in POHANDLE Handle, __in ULONGLONG IdleTimeout)
Definition: fxglobalskm.h:296
VOID(NTAPI * PFN_POX_COMPLETE_IDLE_CONDITION)(__in POHANDLE Handle, __in ULONG Component)
Definition: fxglobalskm.h:283
VOID(NTAPI * PFN_POX_COMPLETE_DEVICE_POWER_NOT_REQUIRED)(__in POHANDLE Handle)
Definition: fxglobalskm.h:290
VOID(NTAPI * PFN_POX_COMPLETE_IDLE_STATE)(__in POHANDLE Handle, __in ULONG Component)
Definition: fxglobalskm.h:276
VOID(NTAPI * PFN_POX_ACTIVATE_COMPONENT)(__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
Definition: fxglobalskm.h:254
NTSTATUS(NTAPI * PFN_POX_REGISTER_DEVICE)(__in MdDeviceObject Pdo, __in PPO_FX_DEVICE PoxDevice, __out POHANDLE *Handle)
Definition: fxglobalskm.h:234
VOID(NTAPI * PFN_IO_REPORT_INTERRUPT_ACTIVE)(_In_ PIO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS Parameters)
Definition: fxglobalskm.h:303
VOID(NTAPI * PFN_POX_IDLE_COMPONENT)(__in POHANDLE Handle, __in ULONG Component, __in ULONG Flags)
Definition: fxglobalskm.h:262
#define WmiQueryTraceInformation
Definition: fxwmicompat.h:64
NTSTATUS(NTAPI * PFN_RTL_GET_VERSION)(__out PRTL_OSVERSIONINFOW VersionInformation)
Definition: globals.cpp:402
VOID FxVerifyObjectTableIsSorted(VOID)
Definition: globals.cpp:381
VOID FxLibraryGlobalsVerifyVersion(VOID)
Definition: globals.cpp:423
VOID FxLibraryGlobalsQueryRegistrySettings(VOID)
Definition: globals.cpp:464
#define ASSERT(a)
Definition: mode.c:44
#define MAKE_MX_FUNC_NAME(x)
Definition: mxgeneralkm.h:26
BOOLEAN(NTAPI * 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)
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:3615
#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:1026
#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(NTAPI * PFN_RTL_VERIFY_VERSION_INFO)(__in PRTL_OSVERSIONINFOEXW VersionInfo, __in ULONG TypeMask, __in ULONGLONG ConditionMask)
Definition: globals.cpp:408
ULONGLONG(NTAPI * 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 1334 of file globals.cpp.

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

Referenced by FxRegistrySettingsInitialize().

◆ FxRegistrySettingsInitialize()

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

Definition at line 1359 of file globals.cpp.

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

1242{
1243 FxObjectDebugInfo* pInfo;
1246 ULONG length, type;
1247 DECLARE_CONST_UNICODE_STRING(valueName, L"TrackHandles");
1248
1249 pInfo = NULL;
1251 length = 0;
1252
1253 //
1254 // Find out how big a buffer we need to allocate if the value is present
1255 //
1256 status = FxRegKey::_QueryValue(FxDriverGlobals,
1257 Key,
1258 &valueName,
1259 length,
1260 NULL,
1261 &length,
1262 &type);
1263
1264 //
1265 // We expect the list to be bigger then a standard partial, so if it is
1266 // not, just bail now.
1267 //
1269 return NULL;
1270 }
1271
1272 //
1273 // Pool can be paged b/c we are running at PASSIVE_LEVEL and we are going
1274 // to free it at the end of this function.
1275 //
1277 if (dataBuffer == NULL) {
1278 return NULL;
1279 }
1280
1281 //
1282 // Requery now that we have a big enough buffer
1283 //
1284 status = FxRegKey::_QueryValue(FxDriverGlobals,
1285 Key,
1286 &valueName,
1287 length,
1288 dataBuffer,
1289 &length,
1290 &type);
1291 if (NT_SUCCESS(status)) {
1292 //
1293 // Verify that the data from the registry is a valid multi-sz string.
1294 //
1295 status = FxRegKey::_VerifyMultiSzString(FxDriverGlobals,
1296 &valueName,
1298 length);
1299 }
1300
1301 if (NT_SUCCESS(status)) {
1302#pragma prefast(push)
1303#pragma prefast(suppress:__WARNING_PRECONDITION_NULLTERMINATION_VIOLATION, "FxRegKey::_VerifyMultiSzString makes sure the string is NULL-terminated")
1304 pInfo = FxVerifyAllocateDebugInfo((LPWSTR) dataBuffer, FxDriverGlobals);
1305#pragma prefast(pop)
1306
1307 }
1308
1310
1311 return pInfo;
1312}
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:1504
#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 1315 of file globals.cpp.

1319{
1321 ULONG value = 0;
1322 DECLARE_CONST_UNICODE_STRING(valueName, L"TrackPower");
1323
1324 status = FxRegKey::_QueryULong(Key, &valueName, &value);
1326 *TrackPower = (FxTrackPowerOption)value;
1327 }
1328 else {
1329 *TrackPower = FxTrackPowerNone;
1330 }
1331}
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
union FxObjectDebugInfo::@5052 u
USHORT ObjectType
Definition: fxglobals.h:94
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.