ReactOS  0.4.15-dev-2704-gd5265b0
fxldr.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  fxldr.h
8 
9 Abstract:
10  This module contains private interfaces to the WDF loader. This interface
11  is used by
12  a) the stub code in the client driver
13  b) the framework
14  c) the framework loader
15 --*/
16 #ifndef __FXLDR_H__
17 #define __FXLDR_H__
18 
19 #include <initguid.h>
20 #include <wdfldr.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define WDF_COMPONENT_NAME(a) L#a
27 
28 //
29 // Bind info structures are aligned on memory allocation boundaries on 64-bit
30 // platforms, pointer boundaries on 32-bit. The alignment __declspec didn't
31 // fix this for Itanium builds, so we must accomodate this.
32 //
33 // This "marker type" allows us to declare a leading boundary that will always
34 // have the proper alignment. It may "waste" 4 to 8 bytes (0-4 to align the
35 // marker, and 4 more because the alignment isn't necessary, making the marker
36 // bigger than needed) on 32-bit, but that's not a large price to pay.
37 //
38 
39 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _MARKER_TYPE {
42 
43 typedef struct _LIBRARY_MODULE *PLIBRARY_MODULE;
45 
46 typedef
47 VOID
49  VOID
50  );
51 
52 typedef
56  VOID
57  );
58 
59 typedef
63  VOID
64  );
65 
66 typedef
71  __deref_out PWDF_COMPONENT_GLOBALS * ComponentGlobals,
73  );
74 
75 typedef
81  );
82 
83 typedef
87  __in PWDF_LIBRARY_INFO LibraryInfo,
88  __in PUNICODE_STRING ServicePath,
89  __in PCUNICODE_STRING LibraryDeviceName
90  ) ;
91 
92 typedef
100  ) ;
101 
102 typedef
103 NTSTATUS
108  );
109 
110 #define WDF_LIBRARY_COMMISSION LibraryCommission
111 #define WDF_LIBRARY_DECOMMISSION LibraryDecommission
112 #define WDF_LIBRARY_REGISTER_CLIENT LibraryRegisterClient
113 #define WDF_LIBRARY_UNREGISTER_CLIENT LibraryUnregisterClient
114 
115 #define WDF_REGISTRY_DBGPRINT_ON L"DbgPrintOn"
116 
117 
118 //
119 // Version container
120 //
121 typedef struct _WDF_VERSION {
125 } WDF_VERSION;
126 
127 //
128 // WDF bind information structure.
129 //
130 typedef struct _WDF_BIND_INFO {
135  __field_bcount(FuncCount*sizeof(WDFFUNC)) WDFFUNC* FuncTable;
136  PLIBRARY_MODULE Module; // Mgmt and diagnostic use only
138 
139 typedef struct _WDF_LIBRARY_INFO {
147 
148 // {49215DFF-F5AC-4901-8588-AB3D540F6021}
149 DEFINE_GUID(GUID_WDF_LOADER_INTERFACE_STANDARD, \
150  0x49215dff, 0xf5ac, 0x4901, 0x85, 0x88, 0xab, 0x3d, 0x54, 0xf, 0x60, 0x21);
151 
152 typedef struct _WDF_LOADER_INTERFACE {
159 
160 VOID
161 __inline
164  )
165 {
167  Interface->Header.InterfaceSize = sizeof(WDF_LOADER_INTERFACE);
168  Interface->Header.InterfaceType = &GUID_WDF_LOADER_INTERFACE_STANDARD;
169 }
170 
171 //
172 // Client Driver information structure. This is used by loader when
173 // registering client with library to provide some additional info to
174 // library that is not already present in WDF_BIND_INFO (also passed to library
175 // during client registration)
176 //
177 typedef struct _CLIENT_INFO {
178  //
179  // Size of this structure
180  //
182 
183  //
184  // registry service path of client driver
185  //
187 
189 
190 //-----------------------------------------------------------------------------
191 // WDFLDR.SYS exported function prototype definitions
192 //-----------------------------------------------------------------------------
194 NTSTATUS
198  __inout PWDF_BIND_INFO BindInfo,
199  __out PWDF_COMPONENT_GLOBALS* ComponentGlobals
200  );
201 
202 NTSTATUS
205  __in PWDF_BIND_INFO BindInfo,
206  __in PWDF_COMPONENT_GLOBALS ComponentGlobals
207  );
208 
210 NTSTATUS
212  __in PWDF_LIBRARY_INFO LibraryInfo,
213  __in PUNICODE_STRING ServicePath,
214  __in PCUNICODE_STRING LibraryDeviceName
215  );
216 
217 #ifdef ALLOC_PRAGMA
218 #pragma alloc_text (PAGE, WdfVersionBind)
219 #pragma alloc_text (PAGE, WdfVersionUnbind)
220 #pragma alloc_text (PAGE, WdfRegisterLibrary)
221 // #pragma alloc_text (PAGE, WdfRegisterClassLibrary)
222 #endif
223 
224 #ifdef __cplusplus
225 } // extern "C"
226 #endif
227 
228 //
229 // Event name: WdfCensusEvtLinkClientToCx
230 //
231 // Source: WdfLdr
232 // Description: Written when a client is binding to a class extension.
233 // WdfVersionBindClass which is called from the client's stub,
234 // will load/reference the Cx and add it to the fx library's
235 // list of clients. The client driver's class extension list is
236 // also updated at that time, which is when this event is written.
237 //
238 // Frequency: Everytime a client driver binds to a class extension.
239 //
240 //
241 #define WDF_CENSUS_EVT_WRITE_LINK_CLIENT_TO_CX(TraceHandle, CxImageName, ClientImageName) \
242  TraceLoggingWrite(TraceHandle, \
243  "WdfCensusEvtLinkClientToCx", \
244  WDF_TELEMETRY_EVT_KEYWORDS, \
245  TraceLoggingWideString(CxImageName, "CxImageName"), \
246  TraceLoggingWideString(ClientImageName, "ClientImageName" ) \
247  );
248 
249 #endif // __FXLDR_H__
PFNLIBRARYUNREGISTERCLIENT LibraryUnregisterClient
Definition: fxldr.h:144
PWDF_REGISTER_LIBRARY RegisterLibrary
Definition: fxldr.h:154
struct _WDF_BIND_INFO WDF_BIND_INFO
ULONG Size
Definition: fxldr.h:131
#define _Must_inspect_result_
Definition: no_sal2.h:62
_Must_inspect_result_ NTSTATUS(* PWDF_REGISTER_LIBRARY)(__in PWDF_LIBRARY_INFO LibraryInfo, __in PUNICODE_STRING ServicePath, __in PCUNICODE_STRING LibraryDeviceName)
Definition: fxldr.h:86
struct _CLIENT_INFO CLIENT_INFO
PWDF_VERSION_BIND VersionBind
Definition: fxldr.h:155
ULONG FuncCount
Definition: fxldr.h:134
VOID __inline WDF_LOADER_INTERFACE_INIT(PWDF_LOADER_INTERFACE Interface)
Definition: fxldr.h:162
PLIBRARY_MODULE Module
Definition: fxldr.h:136
PFNLIBRARYREGISTERCLIENT LibraryRegisterClient
Definition: fxldr.h:143
WDF_VERSION Version
Definition: fxldr.h:145
LONG NTSTATUS
Definition: precomp.h:26
struct _WDF_LIBRARY_INFO * PWDF_LIBRARY_INFO
Definition: fxldr.h:44
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
ULONG Size
Definition: fxldr.h:181
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __deref_out PWDF_COMPONENT_GLOBALS *ComponentGlobals, __deref_inout PVOID *Context)
Definition: fxldr.h:69
char * Pad(char *Str, char PadChar, ULONG Length)
Definition: cabman.cxx:29
DriverGlobals
NTSTATUS(* PWDF_VERSION_UNBIND)(__in PUNICODE_STRING RegistryPath, __in PWDF_BIND_INFO Info, __in PWDF_COMPONENT_GLOBALS Globals)
Definition: fxldr.h:104
VOID(* WDFFUNC)(VOID)
Definition: fxldr.h:48
uint16_t * PWCHAR
Definition: typedefs.h:56
#define __deref_inout
Definition: sal.h:2766
struct _WDF_LOADER_INTERFACE * PWDF_LOADER_INTERFACE
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
struct _WDF_VERSION WDF_VERSION
WDF_VERSION Version
Definition: fxldr.h:133
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
WDF_BUILD_NUMBER Build
Definition: fxldr.h:124
_Must_inspect_result_ NTSTATUS(* PWDF_VERSION_BIND)(__in PDRIVER_OBJECT DriverObject, __in PUNICODE_STRING RegistryPath, __in PWDF_BIND_INFO Info, __out PWDF_COMPONENT_GLOBALS *Globals)
Definition: fxldr.h:95
#define __out
Definition: dbghelp.h:62
#define __field_bcount(size)
Definition: specstrings.h:289
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
PFNLIBRARYCOMMISSION LibraryCommission
Definition: fxldr.h:141
struct _LIBRARY_MODULE * PLIBRARY_MODULE
Definition: fxldr.h:43
MARKER_TYPE
Definition: fxldr.h:41
PWDF_LDR_DIAGNOSTICS_VALUE_BY_NAME_AS_ULONG DiagnosticsValueByNameAsULONG
Definition: fxldr.h:157
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYDECOMMISSION)(VOID)
Definition: fxldr.h:62
ULONG WDF_MINOR_VERSION
Definition: fxldrum.h:27
WDF_MAJOR_VERSION Major
Definition: fxldr.h:122
PWDF_VERSION_UNBIND VersionUnbind
Definition: fxldr.h:156
PFNLIBRARYDECOMMISSION LibraryDecommission
Definition: fxldr.h:142
ULONG WDF_BUILD_NUMBER
Definition: fxldrum.h:28
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _WDF_LIBRARY_INFO WDF_LIBRARY_INFO
_Must_inspect_result_ NTSTATUS WdfVersionBind(__in PDRIVER_OBJECT DriverObject, __in PUNICODE_STRING RegistryPath, __inout PWDF_BIND_INFO BindInfo, __out PWDF_COMPONENT_GLOBALS *ComponentGlobals)
#define NTSTATUS
Definition: precomp.h:20
#define VOID
Definition: acefi.h:82
#define __inout
Definition: dbghelp.h:50
WDF_INTERFACE_HEADER Header
Definition: fxldr.h:153
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYCOMMISSION)(VOID)
Definition: fxldr.h:55
PUNICODE_STRING RegistryPath
Definition: fxldr.h:186
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
struct _WDF_BIND_INFO * PWDF_BIND_INFO
DEFINE_GUID(GUID_WDF_LOADER_INTERFACE_STANDARD, 0x49215dff, 0xf5ac, 0x4901, 0x85, 0x88, 0xab, 0x3d, 0x54, 0xf, 0x60, 0x21)
NTSTATUS WdfVersionUnbind(__in PUNICODE_STRING RegistryPath, __in PWDF_BIND_INFO BindInfo, __in PWDF_COMPONENT_GLOBALS ComponentGlobals)
_Must_inspect_result_ NTSTATUS WdfRegisterLibrary(__in PWDF_LIBRARY_INFO LibraryInfo, __in PUNICODE_STRING ServicePath, __in PCUNICODE_STRING LibraryDeviceName)
struct tagContext Context
Definition: acpixf.h:1034
#define __deref_out
Definition: dbghelp.h:26
struct _CLIENT_INFO * PCLIENT_INFO
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
NTSTATUS(STDCALL * PWDF_LDR_DIAGNOSTICS_VALUE_BY_NAME_AS_ULONG)(PUNICODE_STRING, PULONG)
Definition: wdfldr.h:32
PWCHAR Component
Definition: fxldr.h:132
#define __in
Definition: dbghelp.h:35
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90
WDF_MINOR_VERSION Minor
Definition: fxldr.h:123
struct _WDF_LOADER_INTERFACE WDF_LOADER_INTERFACE
ULONG WDF_MAJOR_VERSION
Definition: fxldrum.h:26
_Must_inspect_result_ NTSTATUS(* PFNLIBRARYUNREGISTERCLIENT)(__in PWDF_BIND_INFO Info, __in PWDF_COMPONENT_GLOBALS DriverGlobals)
Definition: fxldr.h:78