ReactOS  0.4.15-dev-2774-gc8ce0cc
version.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  Stub.cpp
8 
9 Abstract:
10 
11  This is the stub used by UMDF corresponding to the stub used by
12  KMDF.
13 
14  It includes definitions of WdfFunctions, WdfBindInfo and WdfDriverGlobals
15 
16  On the UMDF side we don't need the thunk for DriverEntry because
17  DriverEntry is invoked by UMDF host.
18 
19  For COM API UMDF framework will link the stub in
20  For flat-C API UMDF driver will need to link the stub in
21  (similar to the way KMDF drivers link the stub)
22 
23 Environment:
24 
25  User mode only
26 
27 Revision History:
28 
29 --*/
30 
31 #define FX_DYNAMICS_GENERATE_TABLE 1
32 
33 #include <ntverp.h>
34 extern "C" {
35 #include "mx.h"
36 }
37 #include "fxmin.hpp"
38 #include "fxldrum.h"
39 #include "fxifr.h"
40 
41 #include <strsafe.h>
42 #include <driverspecs.h>
43 
44 extern const WDFFUNC *WdfFunctions;
45 
46 extern "C" {
47 
48 #include "fxdynamics.h"
49 
50 #include "..\librarycommon\fxlibrarycommon.h"
51 
52 #define KMDF_DEFAULT_NAME "Wdf" ## \
53  LITERAL(__WDF_MAJOR_VERSION) ## \
54  "000" //minor version
55 
56 
57 
58 //-----------------------------------------------------------------------------
59 // local prototype definitions
60 //-----------------------------------------------------------------------------
61 
63 
65 
66 } // extern "C"
67 
68 #include "umdfstub.h"
69 
70 extern "C"
73  VOID
74  );
75 
76 extern "C"
79  VOID
80  );
81 
82 extern "C"
87  PVOID * Context
88  );
89 
90 extern "C"
95  );
96 
97 extern "C" {
98 
100  sizeof(WDF_LIBRARY_INFO),
105  { __WUDF_MAJOR_VERSION, __WUDF_MINOR_VERSION, __WUDF_SERVICE_VERSION }
106 };
107 
108 }
109 
110 //-----------------------------------------------------------------------------
111 //
112 //-----------------------------------------------------------------------------
113 extern "C"
114 NTSTATUS
116  VOID
117  )
118 {
119  return FxLibraryCommonCommission();
120 }
121 
122 //-----------------------------------------------------------------------------
123 //
124 //-----------------------------------------------------------------------------
125 extern "C"
126 NTSTATUS
128  VOID
129  )
130 {
132 }
133 
134 #define EVTLOG_MESSAGE_SIZE 70
135 #define RAW_DATA_SIZE 4
136 
137 extern "C"
138 NTSTATUS
142  PVOID * Context
143  )
144 {
147  WCHAR insertString[EVTLOG_MESSAGE_SIZE];
149  PCLIENT_INFO clientInfo = NULL;
150 
152 
153  clientInfo = (PCLIENT_INFO)*Context;
154  *Context = NULL;
155 
156  ASSERT(Info->Version.Major == WdfLibraryInfo.Version.Major);
157 
158  //
159  // NOTE: If the currently loaded library < drivers minor version fail the load
160  // instead of binding to a lower minor version. The reason for that if there
161  // is a newer API or new contract change made the driver shouldn't be using older
162  // API than it was compiled with.
163  //
164 
165  if (Info->Version.Minor > WdfLibraryInfo.Version.Minor) {
166  status = StringCchPrintfW(insertString,
167  RTL_NUMBER_OF(insertString),
168  L"Driver Version: %d.%d Umdf Lib. Version: %d.%d",
169  Info->Version.Major,
170  Info->Version.Minor,
173  if (!NT_SUCCESS(status)) {
174  __Print(("ERROR: RtlStringCchPrintfW failed with Status 0x%x\n", status));
175  return status;
176  }
177  rawData[0] = Info->Version.Major;
178  rawData[1] = Info->Version.Minor;
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192  //
193  // this looks like the best status to return
194  //
196 
197  }
198 
200 
201  if (NT_SUCCESS(status)) {
202  //
203  // The context will be a pointer to FX_DRIVER_GLOBALS
204  //
206 
207  //
208  // Set the WDF_BIND_INFO structure pointer in FxDriverGlobals
209  //
212  }
213 
214  return status;
215 }
216 
217 extern "C"
218 NTSTATUS
222  )
223 {
225 }
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256 
257 
258 
259 
260 
261 
262 
263 
264 
265 
266 
267 
268 
269 
270 
271 
272 
273 
274 
275 
276 
277 
278 extern "C" {
279 
280 //-----------------------------------------------------------------------------
281 // These header files are referenced in order to make internal structures
282 // available in public symbols. Various WDFKD debug commands use these
283 // internal structures to provide information about WDF.
284 //-----------------------------------------------------------------------------
285 
286 #ifndef DECLARE_TYPE
287 #define DECLARE_TYPE(Name) Name* _DECL_##Name
288 #endif
289 
290 union {
291 
305 // DECLARE_TYPE (FX_DUMP_DRIVER_INFO_ENTRY); // KMDF only
307 
309 
310 } // extern "C" end
311 
312 //-----------------------------------------------------------------------------
signed char * PCHAR
Definition: retypes.h:7
WDF_LIBRARY_INFO WdfLibraryInfo
Definition: version.cpp:178
union @4541 uAllPublicTypes
PCHAR WdfLdrType
Definition: version.cpp:108
_Must_inspect_result_ NTSTATUS WDF_LIBRARY_DECOMMISSION(VOID)
Definition: version.cpp:431
#define DECLARE_TYPE(Name)
Definition: version.cpp:287
_Must_inspect_result_ NTSTATUS FxLibraryCommonCommission(VOID)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ NTSTATUS FxLibraryCommonRegisterClient(__inout PWDF_BIND_INFO Info, __deref_out PWDF_DRIVER_GLOBALS *WdfDriverGlobals, __in_opt PCLIENT_INFO ClientInfo)
WDF_VERSION Version
Definition: fxldr.h:145
LONG NTSTATUS
Definition: precomp.h:26
ULONG WdfLdrDbgPrintOn
Definition: version.cpp:106
#define RAW_DATA_SIZE
Definition: version.cpp:135
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __deref_out PWDF_COMPONENT_GLOBALS *ComponentGlobals, __deref_inout PVOID *Context)
Definition: fxldr.h:69
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define EVTLOG_MESSAGE_SIZE
Definition: version.cpp:134
Definition: fxpool.h:63
enum _WDF_REQUEST_FATAL_ERROR_CODES WDF_REQUEST_FATAL_ERROR_CODES
_Must_inspect_result_ NTSTATUS FxLibraryCommonUnregisterClient(__in PWDF_BIND_INFO Info, __in PWDF_DRIVER_GLOBALS WdfDriverGlobals)
_Must_inspect_result_ NTSTATUS WDF_LIBRARY_COMMISSION(VOID)
Definition: version.cpp:418
#define LITERAL(a)
VOID(* WDFFUNC)(VOID)
Definition: wdf.h:68
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_Must_inspect_result_ NTSTATUS FxLibraryCommonDecommission(VOID)
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: ntstatus.h:273
_Must_inspect_result_ NTSTATUS WDF_LIBRARY_UNREGISTER_CLIENT(__in PWDF_BIND_INFO Info, __in PWDF_DRIVER_GLOBALS WdfDriverGlobals)
Definition: version.cpp:527
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYDECOMMISSION)(VOID)
Definition: fxldr.h:62
PWDF_BIND_INFO WdfBindInfo
Definition: fxglobals.h:405
WDF_MAJOR_VERSION Major
Definition: fxldr.h:122
#define KMDF_DEFAULT_NAME
Definition: version.cpp:52
static const WCHAR L[]
Definition: oid.c:1250
struct _WDF_LIBRARY_INFO WDF_LIBRARY_INFO
WDF_EXTERN_C_START enum _WDF_BUGCHECK_CODES WDF_BUGCHECK_CODES
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYCOMMISSION)(VOID)
Definition: fxldr.h:55
const WDFFUNC * WdfFunctions
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define NULL
Definition: types.h:112
struct _CLIENT_INFO * PCLIENT_INFO
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ NTSTATUS WDF_LIBRARY_REGISTER_CLIENT(__inout PWDF_BIND_INFO Info, __deref_out PWDF_DRIVER_GLOBALS *WdfDriverGlobals, __deref_inout PVOID *Context)
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
static unsigned char rawData[2356]
Definition: data.c:573
static SERVICE_STATUS status
Definition: service.c:31
WDF_MINOR_VERSION Minor
Definition: fxldr.h:123
#define __Print(_x_)
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYUNREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __in PWDF_COMPONENT_GLOBALS DriverGlobals)
Definition: fxldr.h:78
Definition: ps.c:97