ReactOS  0.4.15-dev-2700-g4b4ffa9
wdfqueryinterface.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 
5 _WdfVersionBuild_
6 
7 Module Name:
8 
9  WdfQueryInterface.h
10 
11 Abstract:
12 
13  This file contains the DDIs for handling query interface
14 
15 Environment:
16 
17  kernel mode only
18 
19 Revision History:
20 
21 --*/
22 
23 //
24 // NOTE: This header is generated by stubwork. Please make any
25 // modifications to the corresponding template files
26 // (.x or .y) and use stubwork to regenerate the header
27 //
28 
29 #ifndef _WDFQUERYINTERFACE_H_
30 #define _WDFQUERYINTERFACE_H_
31 
32 #ifndef WDF_EXTERN_C
33  #ifdef __cplusplus
34  #define WDF_EXTERN_C extern "C"
35  #define WDF_EXTERN_C_START extern "C" {
36  #define WDF_EXTERN_C_END }
37  #else
38  #define WDF_EXTERN_C
39  #define WDF_EXTERN_C_START
40  #define WDF_EXTERN_C_END
41  #endif
42 #endif
43 
45 
46 
47 
48 #if (NTDDI_VERSION >= NTDDI_WIN2K)
49 
50 
51 
52 typedef
53 _Function_class_(EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST)
57 STDCALL
58 EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST(
59  _In_
60  WDFDEVICE Device,
61  _In_
63  _Inout_
67  );
68 
69 typedef EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST *PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST;
70 
72  //
73  // Size of this structure in bytes.
74  //
76 
77  //
78  // Interface to be returned to the caller. Optional if BehaviorType is set
79  // to WdfQueryInterfaceTypePassThrough or ImportInterface is set to TRUE.
80  //
82 
83  //
84  // The GUID identifying the interface
85  //
87 
88  //
89  // Valid only for PDOs. The framework will allocate a new request and
90  // forward it down the parent's device stack.
91  //
93 
94  //
95  // Driver supplied callback which is called after some basic interface
96  // validation has been performed (size, version, and guid checking). This
97  // is an optional parameter and may be NULL unless ImportInterface is
98  // specified.
99  //
100  // If the callback returns !NT_SUCCESS, this error will be returned to the
101  // caller and the query interface will fail.
102  //
103  // In this callback, the caller is free to modify the ExposedInterface in
104  // any manner of its choosing. For instance, the callback may change any
105  // field in the interface. The callback may also alloate a dynamic context
106  // to be associated with the interface; the InterfaceReference and
107  // InterfaceDereference functions may also be overridden.
108  //
109  // If ImportInterface is set to TRUE, then this is a required field and the
110  // callback must initialize the interface (the framework will leave the
111  // ExposedInterface buffer exactly as it received it) since the framework
112  // has no way of knowing which fields to fill in and which to leave alone.
113  //
115 
116  //
117  // If TRUE, the interface provided by the caller contains data that the
118  // driver is interested in. By setting to this field to TRUE, the
119  // EvtDeviceProcessQueryInterfaceRequest callback must initialize the
120  // ExposedInterface.
121  //
122  // If FALSE, the entire ExposedInterface is initialized through a memory
123  // copy before the EvtDeviceProcessQueryInterfaceRequest is called.
124  //
126 
128 
130 VOID
135  _In_opt_ PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST EvtDeviceProcessQueryInterfaceRequest
136  )
137 {
139 
141  InterfaceConfig->Interface = Interface;
142  InterfaceConfig->InterfaceType = InterfaceType;
143  InterfaceConfig->EvtDeviceProcessQueryInterfaceRequest =
144  EvtDeviceProcessQueryInterfaceRequest;
145 }
146 
147 //
148 // WDF Function: WdfDeviceAddQueryInterface
149 //
150 typedef
153 WDFAPI
154 NTSTATUS
155 (STDCALL *PFN_WDFDEVICEADDQUERYINTERFACE)(
156  _In_
158  _In_
159  WDFDEVICE Device,
160  _In_
162  );
163 
167 NTSTATUS
168 WdfDeviceAddQueryInterface(
169  _In_
170  WDFDEVICE Device,
171  _In_
173  )
174 {
175  return ((PFN_WDFDEVICEADDQUERYINTERFACE) WdfFunctions[WdfDeviceAddQueryInterfaceTableIndex])(WdfDriverGlobals, Device, InterfaceConfig);
176 }
177 
178 
179 
180 //
181 // The following functions can be assigned to INTERFACE::InterfaceReference
182 // and INTERFACE::InterfaceDeference
183 //
184 // o WdfDeviceInterfaceReferenceNoOp
185 // o WdfDeviceInterfaceDereferenceNoOp
186 //
187 // Thes 2 functions do nothing when called. These are appropriate for
188 // interfaces which can be queried for and used independent of the PNP state of
189 // the WDFDEVICE the interface was retrieved from.
190 //
192 VOID
195  )
196 {
198 }
199 
201 VOID
204  )
205 {
207 }
208 
209 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
210 
211 
212 
214 
215 #endif // _WDFQUERYINTERFACE_H_
216 
PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST EvtDeviceProcessQueryInterfaceRequest
#define _Must_inspect_result_
Definition: no_sal2.h:62
_Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL) WDFAPI NTSTATUS(STDCALL *PFN_WDFDEVICEADDQUERYINTERFACE)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
struct _WDF_QUERY_INTERFACE_CONFIG * PWDF_QUERY_INTERFACE_CONFIG
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
LONG NTSTATUS
Definition: precomp.h:26
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE ExposedInterface
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_QUERY_INTERFACE_CONFIG InterfaceConfig
DriverGlobals
#define _In_opt_
Definition: no_sal2.h:212
#define WdfFunctions
Definition: wdf.h:66
#define WDFAPI
Definition: wdftypes.h:53
unsigned char BOOLEAN
#define _Out_
Definition: no_sal2.h:160
#define _IRQL_requires_same_
Definition: driverspecs.h:215
PWDF_DRIVER_GLOBALS WdfDriverGlobals
#define STDCALL
Definition: wdf.h:45
#define _Inout_
Definition: no_sal2.h:162
_Must_inspect_result_ _In_ WDFDEVICE Device
#define NTSTATUS
Definition: precomp.h:20
struct _WDF_QUERY_INTERFACE_CONFIG WDF_QUERY_INTERFACE_CONFIG
#define WDF_EXTERN_C_START
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
FORCEINLINE VOID WDF_QUERY_INTERFACE_CONFIG_INIT(_Out_ PWDF_QUERY_INTERFACE_CONFIG InterfaceConfig, _In_opt_ PINTERFACE Interface, _In_ CONST GUID *InterfaceType, _In_opt_ PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST EvtDeviceProcessQueryInterfaceRequest)
WDF_EXTERN_C_START typedef _Function_class_(EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST) _IRQL_requires_same_ _IRQL_requires_max_(PASSIVE_LEVEL) NTSTATUS STDCALL EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST(_In_ WDFDEVICE Device
#define _In_
Definition: no_sal2.h:158
EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST * PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
#define FORCEINLINE
Definition: wdftypes.h:67
#define WDF_EXTERN_C_END
WDF_EXTERN_C_START typedef _In_ LPGUID InterfaceType
FORCEINLINE VOID WdfDeviceInterfaceReferenceNoOp(_In_ PVOID Context)
WDF_EXTERN_C_START typedef _In_ LPGUID _Inout_ PINTERFACE _Inout_opt_ PVOID ExposedInterfaceSpecificData
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
FORCEINLINE VOID WdfDeviceInterfaceDereferenceNoOp(_In_ PVOID Context)
#define CONST
Definition: pedump.c:81
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:461
#define _Inout_opt_
Definition: no_sal2.h:216