ReactOS 0.4.15-dev-7834-g00c4b3d
fxqueryinterface.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxQueryInterface.cpp
8
9Abstract:
10
11 This module implements the device interface object.
12
13Author:
14
15
16
17Environment:
18
19 Kernel mode only
20
21Revision History:
22
23--*/
24
25#include "fxsupportpch.hpp"
26
27extern "C" {
28// #include "FxQueryInterface.tmh"
29}
30
34 ) :
35 m_Device(Device),
36 m_Interface(NULL)
37{
39
41
42 if (Config != NULL) {
43 m_SendQueryToParentStack = Config->SendQueryToParentStack;
44 m_ImportInterface = Config->ImportInterface;
45 m_ProcessRequest.m_Method = Config->EvtDeviceProcessQueryInterfaceRequest;
46 RtlCopyMemory(&m_InterfaceType, Config->InterfaceType, sizeof(GUID));
47 }
48}
49
51{
52 //
53 // Should not in any list
54 //
56
59 }
60}
61
62VOID
65 __in const GUID* InterfaceGuid,
67 __in USHORT InterfaceSize,
68 __in USHORT InterfaceVersion,
70 )
71{
73
74 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
75
77
78 stack->MajorFunction = IRP_MJ_PNP;
79 stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
80
81 stack->Parameters.QueryInterface.Interface = Interface;
82 stack->Parameters.QueryInterface.InterfaceSpecificData = InterfaceSpecificData;
83 stack->Parameters.QueryInterface.Size = InterfaceSize;
84 stack->Parameters.QueryInterface.Version = InterfaceVersion;
85 stack->Parameters.QueryInterface.InterfaceType = InterfaceGuid;
86}
87
91 __in PDEVICE_OBJECT TopOfStack,
92 __in const GUID* InterfaceType,
97 )
98/*++
99
100Routine Description:
101 Send an IRP_MJPNP/IRP_MN_QUERY_INTERFACE irp to a device object and its
102 attached stack.
103
104Arguments:
105 TargetDevice - device to send the query to.
106
107 InterfaceType - The type of interface to query for
108
109 Interface - The interface to fill out
110
111 Size - Size of Interface in bytes
112
113 Version - Version of the interface to be queried
114
115 InterfaceSpecificData - Addtional interface data to be queried
116
117
118Return Value:
119 NTSTATUS as indicated by the handler of the QI with in the device stack,
120 STATUS_NOT_SUPPORTED if the QI is not handled.
121
122 --*/
123{
124 PIRP pIrp;
126
127 pIrp = IoAllocateIrp(TopOfStack->StackSize, FALSE);
128
129 if (pIrp != NULL) {
131
133 pIrp,
135 Interface,
136 Size,
137 Version,
139 );
140
141 status = irp.SendIrpSynchronously(TopOfStack);
142 }
143 else {
145 }
146
147 return status;
148}
149
150VOID
154 )
155/*++
156
157Routine Description:
158 Marks the structure as embedded and sets the configuration. This is used
159 for FxQueryInterface structs which are embedded in other structures because
160 at contruction time the Config is not available yet.
161
162 By marking as embedded, FxPkgPnp will not free the structure when it deletes
163 the query interface chain.
164
165Arguments:
166 Config - how the interface behaves
167
168 Interface - the interface that is exported
169
170Return Value:
171 None
172
173 --*/
174{
177
178 m_SendQueryToParentStack = Config->SendQueryToParentStack;
179 m_ImportInterface = Config->ImportInterface;
180 m_ProcessRequest.m_Method = Config->EvtDeviceProcessQueryInterfaceRequest;
181 RtlCopyMemory(&m_InterfaceType, Config->InterfaceType, sizeof(GUID));
182}
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST m_Method
CHECK_RETURN_IF_USER_MODE NTSTATUS SendIrpSynchronously(__in MdDeviceObject DeviceObject)
Definition: fxirpum.cpp:151
Definition: _stack.h:55
_In_ PIRP Irp
Definition: csq.h:116
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
FxIrp * pIrp
FxIrp * irp
#define ASSERT(a)
Definition: mode.c:44
#define _Must_inspect_result_
Definition: ms_sal.h:558
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN m_SendQueryToParentStack
FxDeviceProcessQueryInterfaceRequest m_ProcessRequest
VOID SetEmbedded(__in PWDF_QUERY_INTERFACE_CONFIG Config, __in PINTERFACE Interface)
static _Must_inspect_result_ NTSTATUS _QueryForInterface(__in PDEVICE_OBJECT TopOfStack, __in const GUID *InterfaceType, __out PINTERFACE Interface, __in USHORT Size, __in USHORT Version, __in_opt PVOID InterfaceSpecificData)
SINGLE_LIST_ENTRY m_Entry
FxQueryInterface(__in CfxDevice *Device, __in PWDF_QUERY_INTERFACE_CONFIG Config)
static VOID _FormatIrp(__in PIRP Irp, __in const GUID *InterfaceGuid, __out PINTERFACE Interface, __in USHORT InterfaceSize, __in USHORT InterfaceVersion, __in_opt PVOID InterfaceSpecificData=NULL)
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629
Definition: ps.c:97
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:476
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:472
static const GUID InterfaceGuid
Definition: wlanapi.c:25
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IRP_MN_QUERY_INTERFACE