ReactOS 0.4.15-dev-7705-g2320c37
fxverifier.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FxVerifierBugCheck(FxDriverGlobals, Error, ...)
 

Enumerations

enum  FxEnhancedVerifierBitFlags {
  FxEnhancedVerifierCallbackIrqlAndCRCheck = 0x00000001 , FxEnhancedVerifierForwardProgressFailAll = 0x00010000 , FxEnhancedVerifierForwardProgressFailRandom = 0x00020000 , FxEnhancedVerifierFunctionTableHookMask = 0x0000ffff ,
  FxEnhancedVerifierForwardProgressMask = 0x000f0000 , FxEnhancedVerifierPerformanceAnalysisMask = 0x00f00000
}
 

Functions

__inline VOID FxVerifierDbgBreakPoint (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline VOID FxVerifierBreakOnDeviceStateError (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline BOOLEAN IsFxVerifierFunctionTableHooking (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
DECLSPEC_NORETURN VOID FxVerifierBugCheckWorker (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDF_BUGCHECK_CODES WdfBugCheckCode, __in_opt ULONG_PTR BugCheckParameter2=0, __in_opt ULONG_PTR BugCheckParameter3=0)
 
DECLSPEC_NORETURN VOID FxVerifierNullBugCheck (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID ReturnAddress)
 
__inline NTSTATUS FxVerifierCheckIrqlLevel (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
 
__inline BOOLEAN IsFxVerifierTestForwardProgressFailAll (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline BOOLEAN IsFxVerifierTestForwardProgressFailRandom (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline BOOLEAN IsFxVerifierTestForwardProgress (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
__inline BOOLEAN IsFxPerformanceAnalysis (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 

Macro Definition Documentation

◆ FxVerifierBugCheck

#define FxVerifierBugCheck (   FxDriverGlobals,
  Error,
  ... 
)
Value:
FX_VERIFY_WITH_NAME(DRIVER(BadAction, Error), \
TRAPMSG("WDF Violation: Please check" \
"tracelog for a description of this error"), \
FxDriverGlobals->Public.DriverName)
BOOL Error
Definition: chkdsk.c:66
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)

Definition at line 58 of file fxverifier.h.

Enumeration Type Documentation

◆ FxEnhancedVerifierBitFlags

Enumerator
FxEnhancedVerifierCallbackIrqlAndCRCheck 
FxEnhancedVerifierForwardProgressFailAll 
FxEnhancedVerifierForwardProgressFailRandom 
FxEnhancedVerifierFunctionTableHookMask 
FxEnhancedVerifierForwardProgressMask 
FxEnhancedVerifierPerformanceAnalysisMask 

Definition at line 34 of file fxverifier.h.

34 {
35 //
36 // low 2 bytes are used for function table Hooking
37 //
39 //
40 // Lower nibble of 3rd byte for forward progress
41 //
44
45 //
46 // bit masks
47 //
50
51 //
52 // higher nibble of 3rd byte for performance analysis
53 //
55};
@ FxEnhancedVerifierFunctionTableHookMask
Definition: fxverifier.h:48
@ FxEnhancedVerifierForwardProgressMask
Definition: fxverifier.h:49
@ FxEnhancedVerifierPerformanceAnalysisMask
Definition: fxverifier.h:54
@ FxEnhancedVerifierForwardProgressFailRandom
Definition: fxverifier.h:43
@ FxEnhancedVerifierCallbackIrqlAndCRCheck
Definition: fxverifier.h:38
@ FxEnhancedVerifierForwardProgressFailAll
Definition: fxverifier.h:42

Function Documentation

◆ FxVerifierBreakOnDeviceStateError()

__inline VOID FxVerifierBreakOnDeviceStateError ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 101 of file fxverifier.h.

104{
105#if FX_CORE_MODE == FX_CORE_KERNEL_MODE
106 CHAR ext[] = "sys";
107#else
108 CHAR ext[] = "dll";
109#endif
110
111 Mx::MxDbgPrint("WDF detected potentially invalid device state in %s.%s. "
112 "Dump the driver log (!wdflogdump %s.$s) for more information.\n",
113 FxDriverGlobals->Public.DriverName, ext,
114 FxDriverGlobals->Public.DriverName, ext);
115
116 if (FxDriverGlobals->FxVerifierDbgBreakOnDeviceStateError) {
118 } else {
119 Mx::MxDbgPrint("Turn on framework verifier for %s.%s to automatically "
120 "break into the debugger next time it happens.\n",
121 FxDriverGlobals->Public.DriverName, ext);
122 }
123}
static __inline VOID MxDbgBreakPoint()
Definition: mxgeneralkm.h:157
static VOID MxDbgPrint(__drv_formatString(printf) __in PCSTR DebugMessage,...)
Definition: mxgeneralkm.cpp:7
static const WCHAR *const ext[]
Definition: module.c:53
char CHAR
Definition: xmlstorage.h:175

Referenced by FxPkgPnp::PowerPolSleeping().

◆ FxVerifierBugCheckWorker()

DECLSPEC_NORETURN VOID FxVerifierBugCheckWorker ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDF_BUGCHECK_CODES  WdfBugCheckCode,
__in_opt ULONG_PTR  BugCheckParameter2 = 0,
__in_opt ULONG_PTR  BugCheckParameter3 = 0 
)

Definition at line 44 of file fxverifierbugcheck.cpp.

62{
63 //
64 // Indicate to the BugCheck callback filter which IFR to dump.
65 //
66 FxDriverGlobals->FxForceLogsInMiniDump = TRUE;
67
69 WdfBugCheckCode,
70 BugCheckParameter2,
71 BugCheckParameter3,
72 (ULONG_PTR) FxDriverGlobals );
73}
static DECLSPEC_NORETURN VOID MxBugCheckEx(__in ULONG BugCheckCode, __in ULONG_PTR BugCheckParameter1, __in ULONG_PTR BugCheckParameter2, __in ULONG_PTR BugCheckParameter3, __in ULONG_PTR BugCheckParameter4)
Definition: mxgeneralkm.h:133
#define TRUE
Definition: types.h:120
#define WDF_VIOLATION
Definition: mx.h:37
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ FxVerifierCheckIrqlLevel()

__inline NTSTATUS FxVerifierCheckIrqlLevel ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in KIRQL  Irql 
)

Definition at line 158 of file fxverifier.h.

175{
176 //
177 // Full treatment only if VerifierOn is set.
178 //
179 if (FxDriverGlobals->FxVerifierOn) {
180
181 KIRQL currentIrql = Mx::MxGetCurrentIrql();
182
183 if (currentIrql <= Irql) {
184 return STATUS_SUCCESS;
185 }
186
188 "Called at wrong IRQL; at level %d, should be "
189 "at level %d", currentIrql, Irql);
190
191 FxVerifierDbgBreakPoint(FxDriverGlobals);
192
194 }
195
196 //
197 // If Verifier is turned off, always return success.
198 //
199 return STATUS_SUCCESS;
200}
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
_Out_ PKIRQL Irql
Definition: csq.h:179
#define TRACINGDEVICE
Definition: dbgtrace.h:58
UCHAR KIRQL
Definition: env_spec_w32.h:591
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
__inline VOID FxVerifierDbgBreakPoint(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: fxverifier.h:74
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138

Referenced by __deref_out_range(), __drv_maxIRQL(), __drv_strictTypeMatch(), __drv_when(), __in_bcount_opt(), __in_ecount(), __in_xcount(), FxDevice::_OpenKey(), _Requires_lock_held_(), _Requires_lock_not_held_(), FxUsbPipe::_SendTransfer(), FxCommonBuffer::AllocateCommonBuffer(), FxDevice::DeleteObject(), FxIoTargetSendIo(), FxIoTargetSendIoctl(), FxDevice::FxValidateInterfacePropertyData(), if(), FxDeviceDescriptionEntry::IsDeviceRemoved(), FxChildList::NotifyDeviceRemove(), FxChildList::NotifyDeviceSurpriseRemove(), FxChildList::ProcessBusRelations(), FxDeviceDescriptionEntry::ProcessDeviceRemoved(), and StopIdleWorker().

◆ FxVerifierDbgBreakPoint()

__inline VOID FxVerifierDbgBreakPoint ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 74 of file fxverifier.h.

77{
78#if FX_CORE_MODE == FX_CORE_KERNEL_MODE
79 CHAR ext[] = "sys";
80#else
81 CHAR ext[] = "dll";
82#endif
83
84 Mx::MxDbgPrint("WDF detected potentially invalid operation by %s.%s "
85 "Dump the driver log (!wdflogdump %s.%s) for more information.\n",
86 FxDriverGlobals->Public.DriverName, ext,
87 FxDriverGlobals->Public.DriverName, ext
88 );
89
90 if (FxDriverGlobals->FxVerifierDbgBreakOnError) {
92 } else {
93 Mx::MxDbgPrint("Turn on framework verifier for %s.%s to automatically "
94 "break into the debugger next time it happens.\n",
95 FxDriverGlobals->Public.DriverName, ext);
96 }
97}

Referenced by FxVerifierCheckIrqlLevel().

◆ FxVerifierNullBugCheck()

DECLSPEC_NORETURN VOID FxVerifierNullBugCheck ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PVOID  ReturnAddress 
)

Definition at line 77 of file fxverifierbugcheck.cpp.

94{
95
97 "NULL Required Parameter Passed to a DDI\n"
98 "FxDriverGlobals 0x%p",
99 FxDriverGlobals
100 );
101
102 FxVerifierBugCheck(FxDriverGlobals,
103 WDF_REQUIRED_PARAMETER_IS_NULL, // Bugcheck code.
104 0, // Parameter 2
105 (ULONG_PTR)ReturnAddress // Parameter 3
106 );
107}
#define TRACINGERROR
Definition: dbgtrace.h:63
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
#define TRACE_LEVEL_FATAL
Definition: storswtr.h:26
@ WDF_REQUIRED_PARAMETER_IS_NULL
Definition: wdfbugcodes.h:61

◆ IsFxPerformanceAnalysis()

__inline BOOLEAN IsFxPerformanceAnalysis ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 250 of file fxverifier.h.

253{
254 if (FxDriverGlobals->FxEnhancedVerifierOptions &
256 return TRUE;
257 }
258 else {
259 return FALSE;
260 }
261}
#define FALSE
Definition: types.h:117

Referenced by FxLibraryCommonRegisterClient(), PerfEvtDeviceD0EntryStart(), PerfEvtDeviceD0ExitStart(), PerfEvtDevicePrepareHardwareStart(), PerfEvtDeviceReleaseHardwareStart(), PerfEvtIoStopStart(), PerfIoComplete(), PerfIoStart(), and PerformanceAnalysisPowerProcess().

◆ IsFxVerifierFunctionTableHooking()

__inline BOOLEAN IsFxVerifierFunctionTableHooking ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 127 of file fxverifier.h.

130{
131 if (FxDriverGlobals->FxEnhancedVerifierOptions &
133 return TRUE;
134 }
135 else {
136 return FALSE;
137 }
138}

Referenced by FxLibraryCommonRegisterClient(), and FxLibraryCommonUnregisterClient().

◆ IsFxVerifierTestForwardProgress()

__inline BOOLEAN IsFxVerifierTestForwardProgress ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 235 of file fxverifier.h.

238{
239 if (FxDriverGlobals->FxEnhancedVerifierOptions &
241 return TRUE;
242 }
243 else {
244 return FALSE;
245 }
246}

Referenced by FxPkgIo::DispatchStep2().

◆ IsFxVerifierTestForwardProgressFailAll()

__inline BOOLEAN IsFxVerifierTestForwardProgressFailAll ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 205 of file fxverifier.h.

208{
209 if (FxDriverGlobals->FxEnhancedVerifierOptions &
211 return TRUE;
212 }
213 else {
214 return FALSE;
215 }
216}

Referenced by FxPkgIo::VerifierFreeRequestToTestForwardProgess().

◆ IsFxVerifierTestForwardProgressFailRandom()

__inline BOOLEAN IsFxVerifierTestForwardProgressFailRandom ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 220 of file fxverifier.h.

223{
224 if (FxDriverGlobals->FxEnhancedVerifierOptions &
226 return TRUE;
227 }
228 else {
229 return FALSE;
230 }
231}

Referenced by FxPkgIo::VerifierFreeRequestToTestForwardProgess().