ReactOS 0.4.16-dev-109-gf4cb10f
version.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 Stub.cpp
8
9Abstract:
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
23Environment:
24
25 User mode only
26
27Revision History:
28
29--*/
30
31#define FX_DYNAMICS_GENERATE_TABLE 1
32
33#include <ntverp.h>
34extern "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
44extern const WDFFUNC *WdfFunctions;
45
46extern "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
70extern "C"
73 VOID
74 );
75
76extern "C"
79 VOID
80 );
81
82extern "C"
88 );
89
90extern "C"
95 );
96
97extern "C" {
98
100 sizeof(WDF_LIBRARY_INFO),
105 { __WUDF_MAJOR_VERSION, __WUDF_MINOR_VERSION, __WUDF_SERVICE_VERSION }
106};
107
108}
109
110//-----------------------------------------------------------------------------
111//
112//-----------------------------------------------------------------------------
113extern "C"
116 VOID
117 )
118{
120}
121
122//-----------------------------------------------------------------------------
123//
124//-----------------------------------------------------------------------------
125extern "C"
128 VOID
129 )
130{
132}
133
134#define EVTLOG_MESSAGE_SIZE 70
135#define RAW_DATA_SIZE 4
136
137extern "C"
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
217extern "C"
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
278extern "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
290union {
291
305// DECLARE_TYPE (FX_DUMP_DRIVER_INFO_ENTRY); // KMDF only
307
309
310} // extern "C" end
311
312//-----------------------------------------------------------------------------
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
PFX_DRIVER_GLOBALS pFxDriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define WDF_LIBRARY_COMMISSION
Definition: fxldr.h:110
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __deref_out PWDF_COMPONENT_GLOBALS *ComponentGlobals, __deref_inout PVOID *Context)
Definition: fxldr.h:69
struct _WDF_LIBRARY_INFO WDF_LIBRARY_INFO
#define WDF_LIBRARY_UNREGISTER_CLIENT
Definition: fxldr.h:113
#define WDF_LIBRARY_DECOMMISSION
Definition: fxldr.h:111
#define WDF_LIBRARY_REGISTER_CLIENT
Definition: fxldr.h:112
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYCOMMISSION)(VOID)
Definition: fxldr.h:55
struct _CLIENT_INFO * PCLIENT_INFO
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYDECOMMISSION)(VOID)
Definition: fxldr.h:62
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYUNREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __in PWDF_COMPONENT_GLOBALS DriverGlobals)
Definition: fxldr.h:78
_Must_inspect_result_ NTSTATUS FxLibraryCommonRegisterClient(__inout PWDF_BIND_INFO Info, __deref_out PWDF_DRIVER_GLOBALS *WdfDriverGlobals, __in_opt PCLIENT_INFO ClientInfo)
_Must_inspect_result_ NTSTATUS FxLibraryCommonDecommission(VOID)
#define __Print(_x_)
_Must_inspect_result_ NTSTATUS FxLibraryCommonCommission(VOID)
#define LITERAL(a)
_Must_inspect_result_ NTSTATUS FxLibraryCommonUnregisterClient(__in PWDF_BIND_INFO Info, __in PWDF_DRIVER_GLOBALS WdfDriverGlobals)
#define ASSERT(a)
Definition: mode.c:44
static unsigned char rawData[2356]
Definition: data.c:573
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: ntstatus.h:273
#define L(x)
Definition: ntvdm.h:50
#define RAW_DATA_SIZE
Definition: version.cpp:439
union @4746 uAllPublicTypes
ULONG WdfLdrDbgPrintOn
Definition: version.cpp:106
PCHAR WdfLdrType
Definition: version.cpp:108
#define EVTLOG_MESSAGE_SIZE
Definition: version.cpp:438
WDF_LIBRARY_INFO WdfLibraryInfo
Definition: version.cpp:178
#define KMDF_DEFAULT_NAME
Definition: version.cpp:85
const WDFFUNC * WdfFunctions
#define DECLARE_TYPE(Name)
Definition: version.cpp:287
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
Definition: fxpool.h:63
PWDF_BIND_INFO WdfBindInfo
Definition: fxglobals.h:405
WDF_VERSION Version
Definition: fxldr.h:145
WDF_MAJOR_VERSION Major
Definition: fxldr.h:122
WDF_MINOR_VERSION Minor
Definition: fxldr.h:123
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
VOID(* WDFFUNC)(VOID)
Definition: wdf.h:68
enum _WDF_REQUEST_FATAL_ERROR_CODES WDF_REQUEST_FATAL_ERROR_CODES
WDF_EXTERN_C_START enum _WDF_BUGCHECK_CODES WDF_BUGCHECK_CODES
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
PWDF_DRIVER_GLOBALS WdfDriverGlobals
__wchar_t WCHAR
Definition: xmlstorage.h:180