1 /*++
2
3 Copyright (c) Microsoft Corporation
4
5 ModuleName:
6
7 MxGeneralUm.cpp
8
9 Abstract:
10
11 Implementation of MxGeneralUm functions.
12
13 Author:
14
15
16
17 Revision History:
18
19
20
21 --*/
22
23 #include "Mx.h"
24
25 #include <strsafe.h>
26
27 #include "fxmin.hpp"
28
29 extern "C" IUMDFPlatform *g_IUMDFPlatform;
30
31 VOID
MxDbgPrint(__drv_formatString (printf)__in PCSTR DebugMessage,...)32 Mx::MxDbgPrint(
33 __drv_formatString(printf)
34 __in PCSTR DebugMessage,
35 ...
36 )
37 {
38 #if DBG
39
40 #define TEMP_BUFFER_SIZE 1024
41 va_list list;
42 CHAR debugMessageBuffer[TEMP_BUFFER_SIZE];
43 HRESULT hr;
44
45 va_start(list, DebugMessage);
46
47 if (DebugMessage) {
48
49 //
50 // Using new safe string functions instead of _vsnprintf.
51 // This function takes care of NULL terminating if the message
52 // is longer than the buffer.
53 //
54 hr = StringCbVPrintfA( debugMessageBuffer,
55 sizeof(debugMessageBuffer),
56 DebugMessage,
57 list );
58 if(!SUCCEEDED(hr)) {
59 OutputDebugStringA("WDF DbgPrint: Unable to expand: ");
60 OutputDebugStringA(DebugMessage);
61 }
62 else {
63 OutputDebugStringA(debugMessageBuffer);
64 }
65 }
66 va_end(list);
67
68 #else
69 UNREFERENCED_PARAMETER(DebugMessage);
70 #endif
71 return;
72 }
73
74 VOID
MxBugCheckEx(_In_ ULONG BugCheckCode,_In_ ULONG_PTR BugCheckParameter1,_In_ ULONG_PTR BugCheckParameter2,_In_ ULONG_PTR BugCheckParameter3,_In_ ULONG_PTR BugCheckParameter4)75 Mx::MxBugCheckEx(
76 _In_ ULONG BugCheckCode,
77 _In_ ULONG_PTR BugCheckParameter1,
78 _In_ ULONG_PTR BugCheckParameter2,
79 _In_ ULONG_PTR BugCheckParameter3,
80 _In_ ULONG_PTR BugCheckParameter4
81 )
82 {
83
84 UNREFERENCED_PARAMETER(BugCheckParameter1);
85 UNREFERENCED_PARAMETER(BugCheckParameter2);
86 UNREFERENCED_PARAMETER(BugCheckParameter3);
87 UNREFERENCED_PARAMETER(BugCheckParameter4);
88
89 FX_VERIFY(DRIVER(BadAction, BugCheckCode), TRAPMSG("UMDF verification "
90 "faults should not call this code path"));
91 UNREACHABLE;
92 }
93
94 VOID
MxGlobalInit(VOID)95 Mx::MxGlobalInit(
96 VOID
97 )
98 {
99 //
100 // Currently just a placeholder. If there is any global initialization
101 // needed for the user-mode primitives, it can be done here.
102 //
103 }
104
105 VOID
MxDetachDevice(_Inout_ MdDeviceObject Device)106 Mx::MxDetachDevice(
107 _Inout_ MdDeviceObject Device
108 )
109 {
110
111
112
113
114
115 HRESULT hrDetachDev =
116 Device->GetDeviceStackInterface()->DetachDevice(Device);
117
118
119
120
121
122 UNREFERENCED_PARAMETER(hrDetachDev);
123 }
124
125