ReactOS 0.4.16-dev-1946-g52006dd
verifierapi.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 VerifierApi.c
8
9Abstract:
10
11 This module implements various global verifier worker routines
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23
24--*/
25
26#include "coreprivshared.hpp"
27#ifdef __REACTOS__
28#include "../../reactos_special.h"
29#include "../../kmdf/inc/private/wdf115.h"
30#endif
31
32//
33// extern "C" all APIs
34//
35extern "C" {
36
37//
38// Global triage Info for dbgeng and 0x9F work
39//
41
42VOID
45 __in
46 PWDF_DRIVER_GLOBALS DriverGlobals
47 )
48
49/*++
50
51Routine Description:
52
53 Common Driver Frameworks DbgBreakPoint() function.
54
55 This will only break point if WdfVerifierDbgBreakOnError is defined, so
56 it's safe to call for production systems.
57
58Arguments:
59
60 DriverGlobals -
61
62Return Value:
63
64 None.
65
66--*/
67
68{
70
72
73 pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals);
74
77 }
78}
79
80
81VOID
84 __in
85 PWDF_DRIVER_GLOBALS DriverGlobals,
86 __in
87 ULONG BugCheckCode,
88 __in
89 ULONG_PTR BugCheckParameter1,
90 __in
91 ULONG_PTR BugCheckParameter2,
92 __in
93 ULONG_PTR BugCheckParameter3,
94 __in
95 ULONG_PTR BugCheckParameter4
96 )
97
98/*++
99
100Routine Description:
101
102 Common Driver Frameworks KeBugCheckEx() function. Use this function rather
103 than the system one. This routine will indicate to the bugcheck callbacks
104 that the IFR data for this driver needs to be copied to the minidump file.
105
106Arguments:
107
108 DriverGlobals -
109
110 BugCheckCode - Specifies a value that indicates the reason for the bug check.
111
112 BugCheckParameter1 - Supply additional information, such as the address and
113 data where a memory-corruption error occurred, depending on the value of
114 BugCheckCode.
115
116 BugCheckParameter2 - Supply additional information, such as the address and
117 data where a memory-corruption error occurred, depending on the value of
118 BugCheckCode.
119
120 BugCheckParameter3 - Supply additional information, such as the address and
121 data where a memory-corruption error occurred, depending on the value of
122 BugCheckCode.
123
124 BugCheckParameter4 - Supply additional information, such as the address and
125 data where a memory-corruption error occurred, depending on the value of
126 BugCheckCode.
127
128Return Value:
129
130 None.
131
132--*/
133
134{
136
137 //
138 // Indicate to the BugCheck callback filter which IFR to dump.
139 //
141
142 pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals);
144
145#pragma prefast(suppress:__WARNING_USE_OTHER_FUNCTION, "WDF wrapper to KeBugCheckEx.");
146 Mx::MxBugCheckEx(BugCheckCode,
147 BugCheckParameter1,
148 BugCheckParameter2,
149 BugCheckParameter3,
150 BugCheckParameter4);
151}
152
153VOID
154NTAPI
156 __in
157 PWDF_DRIVER_GLOBALS DriverGlobals,
160 __in
161 ULONG BugCheckCode,
162 __in
163 ULONG_PTR BugCheckParameter1,
164 __in
165 ULONG_PTR BugCheckParameter2,
166 __in
167 ULONG_PTR BugCheckParameter3,
168 __in
169 ULONG_PTR BugCheckParameter4
170 )
171
172/*++
173
174Routine Description:
175
176 Common Driver Frameworks KeBugCheckEx() function. Cx should use this
177 function rather than the system one or WdfVerifierKeBugCheck. This routine
178 will indicate to the bugcheck callbacks that the IFR data for this driver or its
179 client driver needs to be copied to the minidump file.
180
181Arguments:
182
183 DriverGlobals -
184
185 Object - WDF uses this object to select which logs to write in the minidump.
186 Cx can pass an object from the client driver's hierarchy to force
187 the client driver's logs in the minidump.
188
189 BugCheckCode - Specifies a value that indicates the reason for the bug check.
190
191 BugCheckParameter1 - Supply additional information, such as the address and
192 data where a memory-corruption error occurred, depending on the value of
193 BugCheckCode.
194
195 BugCheckParameter2 - Supply additional information, such as the address and
196 data where a memory-corruption error occurred, depending on the value of
197 BugCheckCode.
198
199 BugCheckParameter3 - Supply additional information, such as the address and
200 data where a memory-corruption error occurred, depending on the value of
201 BugCheckCode.
202
203 BugCheckParameter4 - Supply additional information, such as the address and
204 data where a memory-corruption error occurred, depending on the value of
205 BugCheckCode.
206
207Return Value:
208
209 None.
210
211--*/
212
213{
215
218
219 if (NULL == Object) {
220 pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals);
221 }
222 else {
224 Object,
226 (PVOID*)&pObject,
228 }
229
231
232 //
233 // Indicate to the BugCheck callback filter which IFR to dump.
234 //
236
237#pragma prefast(suppress:__WARNING_USE_OTHER_FUNCTION, "WDF wrapper to KeBugCheckEx.");
238 Mx::MxBugCheckEx(BugCheckCode,
239 BugCheckParameter1,
240 BugCheckParameter2,
241 BugCheckParameter3,
242 BugCheckParameter4);
243}
244
245
246PVOID
247NTAPI
249 _In_
250 PWDF_DRIVER_GLOBALS DriverGlobals
251 )
252
253/*++
254
255Routine Description:
256
257 Returns a pointer to the WDF triage info for dbgeng and 0x9F work.
258
259Arguments:
260
261 DriverGlobals -
262
263Return Value:
264
265 None.
266
267--*/
268
269{
270 DDI_ENTRY();
271
272 UNREFERENCED_PARAMETER(DriverGlobals);
273 return &g_WdfTriageInfo;
274}
275
276} // extern "C"
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 __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
PFX_DRIVER_GLOBALS pFxDriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY_IMPERSONATION_OK()
Definition: fxglobalskm.h:55
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
FxObject * pObject
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define _In_
Definition: no_sal2.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define WDF_TRIAGE_INFO
BOOLEAN FxForceLogsInMiniDump
Definition: fxglobals.h:477
BOOLEAN FxVerifierDbgBreakOnError
Definition: fxglobals.h:431
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
VOID NTAPI WDFEXPORT() WdfCxVerifierKeBugCheck(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in_opt WDFOBJECT Object, __in ULONG BugCheckCode, __in ULONG_PTR BugCheckParameter1, __in ULONG_PTR BugCheckParameter2, __in ULONG_PTR BugCheckParameter3, __in ULONG_PTR BugCheckParameter4)
VOID NTAPI WDFEXPORT() WdfVerifierKeBugCheck(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in ULONG BugCheckCode, __in ULONG_PTR BugCheckParameter1, __in ULONG_PTR BugCheckParameter2, __in ULONG_PTR BugCheckParameter3, __in ULONG_PTR BugCheckParameter4)
Definition: verifierapi.cpp:83
WDF_TRIAGE_INFO g_WdfTriageInfo
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
FORCEINLINE VOID WdfVerifierDbgBreakPoint()
Definition: wdfverifier.h:68
FORCEINLINE PVOID WdfGetTriageInfo()
Definition: wdfverifier.h:126