1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxVerifierBugcheck.cpp
8 
9 Abstract:
10 
11     This file contains definitions of verifier bugcheck functions
12     These definitions are split from tracing.cpp in kmdf\src\core
13 
14 Author:
15 
16 
17 
18 
19 Environment:
20 
21     Both kernel and user mode
22 
23 Revision History:
24 
25 
26 --*/
27 
28 #include "fxobjectpch.hpp"
29 
30 // We use DoTraceMessage
31 extern "C" {
32 #if defined(EVENT_TRACING)
33 #include "FxVerifierBugcheck.tmh"
34 #endif
35 }
36 
37 //=============================================================================
38 //
39 //=============================================================================
40 
41 
42 DECLSPEC_NORETURN
43 VOID
44 FxVerifierBugCheckWorker(
45     __in PFX_DRIVER_GLOBALS FxDriverGlobals,
46     __in WDF_BUGCHECK_CODES WdfBugCheckCode,
47     __in_opt ULONG_PTR BugCheckParameter2,
48     __in_opt ULONG_PTR BugCheckParameter3
49     )
50 /*++
51 
52 Routine Description:
53     Wrapper for system BugCheck.
54 
55     Note this functions is marked "__declspec(noreturn)"
56 
57 Arguments:
58 
59 Returns:
60 
61 --*/
62 {
63     //
64     // Indicate to the BugCheck callback filter which IFR to dump.
65     //
66     FxDriverGlobals->FxForceLogsInMiniDump = TRUE;
67 
68     Mx::MxBugCheckEx(WDF_VIOLATION,
69                  WdfBugCheckCode,
70                  BugCheckParameter2,
71                  BugCheckParameter3,
72                  (ULONG_PTR) FxDriverGlobals );
73 }
74 
75 DECLSPEC_NORETURN
76 VOID
77 FxVerifierNullBugCheck(
78     __in PFX_DRIVER_GLOBALS FxDriverGlobals,
79     __in PVOID ReturnAddress
80     )
81 /*++
82 
83 Routine Description:
84 
85     Calls KeBugCheckEx indicating a WDF DDI was passed a NULL parameter.
86 
87     Note this functions is marked "__declspec(noreturn)"
88 
89 Arguments:
90 
91 Returns:
92 
93 --*/
94 {
95 
96     DoTraceLevelMessage( FxDriverGlobals, TRACE_LEVEL_FATAL, TRACINGERROR,
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 }
108