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