ReactOS 0.4.16-dev-340-g0540c21
FxMessageDispatch Class Reference

#include <fxmessagedispatchum.hpp>

Inheritance diagram for FxMessageDispatch:
Collaboration diagram for FxMessageDispatch:

Public Member Functions

 ~FxMessageDispatch ()
 
HRESULT __stdcall QueryInterface (_In_ REFIID riid, _Out_ LPVOID *ppvObject)
 
ULONG __stdcall AddRef ()
 
ULONG __stdcall Release ()
 
virtual void __stdcall DispatchPnP (_In_ IWudfIrp *pIrp)
 
virtual void __stdcall CreateFile (_In_ IWudfIoIrp *pCreateIrp)
 
virtual void __stdcall DeviceControl (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual void __stdcall ReadFile (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual void __stdcall WriteFile (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual void __stdcall CleanupFile (_In_ IWudfIoIrp *pIrp, _In_ IUnknown *pFxContext)
 
virtual void __stdcall CloseFile (_In_ IWudfIoIrp *pIrp, _In_ IUnknown *pFxContext)
 
virtual VOID __stdcall GetPreferredTransferMode (_Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *RetrievalMode, _Out_ UMINT::WDF_DEVICE_IO_TYPE *RWPreference, _Out_ UMINT::WDF_DEVICE_IO_TYPE *IoctlPreference)
 
virtual void __stdcall FlushBuffers (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual void __stdcall QueryInformationFile (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual void __stdcall SetInformationFile (_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
 
virtual NTSTATUS __stdcall ProcessWmiPowerQueryOrSetData (_In_ RdWmiPowerAction Action, _Out_ BOOLEAN *QueryResult)
 
virtual WUDF_INTERFACE_CONTEXT __stdcall RemoteInterfaceArrival (_In_ LPCGUID pDeviceInterfaceGuid, _In_ PCWSTR pSymbolicLink)
 
virtual void __stdcall RemoteInterfaceRemoval (_In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID)
 
virtual BOOL __stdcall TransportQueryID (_In_ DWORD Id, _In_ PVOID DataBuffer, _In_ SIZE_T cbDataBufferSize)
 
virtual ULONG __stdcall GetDirectTransferThreshold (VOID)
 
virtual void __stdcall PoFxDevicePowerRequired (VOID)
 
virtual void __stdcall PoFxDevicePowerNotRequired (VOID)
 
PDRIVER_OBJECT_UM GetDriverObject (VOID)
 
MdDeviceObject GetDeviceObject (VOID)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Static Public Member Functions

static NTSTATUS _CreateAndInitialize (_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ FxDevice *Device, _Out_ FxMessageDispatch **ppWudfDispatcher)
 
static FxMessageDispatch_GetObjFromItf (_In_ IFxMessageDispatch *pIFxMessageDispatch)
 
static IFxMessageDispatch * _GetDispatcherItf (_In_ FxMessageDispatch *pWudfDispatcher)
 

Private Member Functions

 FxMessageDispatch (_In_ FxDevice *Device)
 

Private Attributes

LONG m_cRefs
 
FxDevicem_Device
 

Additional Inherited Members

- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 

Detailed Description

Definition at line 33 of file fxmessagedispatchum.hpp.

Constructor & Destructor Documentation

◆ FxMessageDispatch()

FxMessageDispatch::FxMessageDispatch ( _In_ FxDevice Device)
inlineprivate

Definition at line 41 of file fxmessagedispatchum.hpp.

43 :
44 m_cRefs(1),
46 {
47 }
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

◆ ~FxMessageDispatch()

FxMessageDispatch::~FxMessageDispatch ( )
inline

Definition at line 50 of file fxmessagedispatchum.hpp.

51 {
52 // SAFE_RELEASE(m_Device);
53 }

Member Function Documentation

◆ _CreateAndInitialize()

NTSTATUS FxMessageDispatch::_CreateAndInitialize ( _In_ PFX_DRIVER_GLOBALS  DriverGlobals,
_In_ FxDevice Device,
_Out_ FxMessageDispatch **  ppWudfDispatcher 
)
static

Definition at line 44 of file fxmessagedispatchum.cpp.

49{
50 HRESULT hr = S_OK;
51 FxMessageDispatch * pWudfDispatcher = NULL;
53
54 *ppWudfDispatcher = NULL;
55
56 pWudfDispatcher = new (DriverGlobals) FxMessageDispatch(Device);
57 if (NULL == pWudfDispatcher) {
60 "Memory allocation failure. Cannot create Dispatcher object.\n");
61 goto Done;
62 }
63
64 *ppWudfDispatcher = pWudfDispatcher;
65
66Done:
67
68 if (FAILED(hr)) {
69 status = Device->NtStatusFromHr(hr);
70 }
71 else {
73 }
74
75 return status;
76}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
DriverGlobals
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define STATUS_SUCCESS
Definition: shellext.h:65
HRESULT hr
Definition: shlfolder.c:183
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97

◆ _GetDispatcherItf()

IFxMessageDispatch * FxMessageDispatch::_GetDispatcherItf ( _In_ FxMessageDispatch pWudfDispatcher)
static

Definition at line 376 of file fxmessagedispatchum.cpp.

379{
380 IFxMessageDispatch * pIFxMessageDispatch = NULL;
381 HRESULT hrQI = pWudfDispatcher->QueryInterface(IID_IFxMessageDispatch,
382 (PVOID*)&pIFxMessageDispatch);
383 FX_VERIFY(INTERNAL, CHECK_QI(hrQI, pIFxMessageDispatch));
384 pIFxMessageDispatch->Release(); //release the reference taken by QI
385 return pIFxMessageDispatch;
386}
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
HRESULT hrQI
Definition: framework.cpp:106
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsrefcnt Release()

◆ _GetObjFromItf()

FxMessageDispatch * FxMessageDispatch::_GetObjFromItf ( _In_ IFxMessageDispatch *  pIFxMessageDispatch)
static

Definition at line 357 of file fxmessagedispatchum.cpp.

360{
361 FxMessageDispatch * pWudfDispatcher = NULL;
362 HRESULT hrQI = pIFxMessageDispatch->QueryInterface(
364 reinterpret_cast<void**>(&pWudfDispatcher)
365 );
366 FX_VERIFY(INTERNAL, CHECK_QI(hrQI, pWudfDispatcher));
367 pWudfDispatcher->Release(); //release the reference taken by QI
368 return pWudfDispatcher;
369}
ULONG __stdcall Release()
const GUID IID_FxMessageDispatch

◆ AddRef()

ULONG FxMessageDispatch::AddRef ( )

Definition at line 82 of file fxmessagedispatchum.cpp.

83{
85
86 //
87 // This allows host to manage the lifetime of FxDevice.
88 //
89 m_Device->ADDREF(this);
90
91 return cRefs;
92}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60

Referenced by QueryInterface().

◆ CleanupFile()

void FxMessageDispatch::CleanupFile ( _In_ IWudfIoIrp *  pIrp,
_In_ IUnknown pFxContext 
)
virtual

Definition at line 217 of file fxmessagedispatchum.cpp.

221{
222 GetDriverObject()->MajorFunction[IRP_MJ_CLEANUP](GetDeviceObject(), pIrp, pFxContext);
223}
return pDevice GetDeviceObject()
return pDriver GetDriverObject()
FxIrp * pIrp
#define IRP_MJ_CLEANUP

◆ CloseFile()

void FxMessageDispatch::CloseFile ( _In_ IWudfIoIrp *  pIrp,
_In_ IUnknown pFxContext 
)
virtual

Definition at line 226 of file fxmessagedispatchum.cpp.

230{
231 GetDriverObject()->MajorFunction[IRP_MJ_CLOSE](GetDeviceObject(), pIrp, pFxContext);
232}
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45

◆ CreateFile()

void FxMessageDispatch::CreateFile ( _In_ IWudfIoIrp *  pCreateIrp)
virtual

Definition at line 178 of file fxmessagedispatchum.cpp.

181{
183 pCreateIrp,
184 NULL);
185}
#define IRP_MJ_CREATE
Definition: rdpdr.c:44

◆ DeviceControl()

void FxMessageDispatch::DeviceControl ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 188 of file fxmessagedispatchum.cpp.

192{
194 pIrp,
195 pFxContext);
196}
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

◆ DispatchPnP()

void FxMessageDispatch::DispatchPnP ( _In_ IWudfIrp *  pIrp)
virtual

Definition at line 154 of file fxmessagedispatchum.cpp.

157{
158 IWudfPnpIrp * pIPnpIrp = NULL;
159
160 HRESULT hrQI = pIrp->QueryInterface(IID_IWudfPnpIrp, (PVOID*)&pIPnpIrp);
161 FX_VERIFY(INTERNAL, CHECK_QI(hrQI, pIPnpIrp));
162
163 if (IRP_MJ_POWER == pIPnpIrp->GetMajorFunction()) {
164 GetDriverObject()->MajorFunction[IRP_MJ_POWER](GetDeviceObject(),
165 pIrp,
166 NULL);
167 }
168 else {
169 GetDriverObject()->MajorFunction[IRP_MJ_PNP](GetDeviceObject(),
170 pIrp,
171 NULL);
172 }
173
174 SAFE_RELEASE(pIPnpIrp);
175}
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define IRP_MJ_POWER
#define SAFE_RELEASE(p)

◆ FlushBuffers()

void FxMessageDispatch::FlushBuffers ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 235 of file fxmessagedispatchum.cpp.

239{
241 pIrp,
242 pFxContext);
243}
#define IRP_MJ_FLUSH_BUFFERS

◆ GetDeviceObject()

MdDeviceObject FxMessageDispatch::GetDeviceObject ( VOID  )
inline

Definition at line 231 of file fxmessagedispatchum.hpp.

234 {
235 return m_Device->GetDeviceObject();
236 }
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174

◆ GetDirectTransferThreshold()

ULONG FxMessageDispatch::GetDirectTransferThreshold ( VOID  )
virtual

Definition at line 283 of file fxmessagedispatchum.cpp.

286{
288}
__inline ULONG GetDirectTransferThreshold(VOID)
Definition: fxdevice.hpp:1986

◆ GetDriverObject()

PDRIVER_OBJECT_UM FxMessageDispatch::GetDriverObject ( VOID  )
inline

Definition at line 223 of file fxmessagedispatchum.hpp.

226 {
228 }
__inline FxDriver * GetDriver(VOID)
Definition: fxdevice.hpp:164
__inline MdDriverObject GetDriverObject(VOID)
Definition: fxdriver.hpp:252

◆ GetPreferredTransferMode()

VOID FxMessageDispatch::GetPreferredTransferMode ( _Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *  RetrievalMode,
_Out_ UMINT::WDF_DEVICE_IO_TYPE *  RWPreference,
_Out_ UMINT::WDF_DEVICE_IO_TYPE *  IoctlPreference 
)
virtual

Definition at line 270 of file fxmessagedispatchum.cpp.

275{
277 RetrievalMode,
278 (WDF_DEVICE_IO_TYPE*)RWPreference,
279 (WDF_DEVICE_IO_TYPE*)IoctlPreference);
280}
static VOID GetPreferredTransferMode(_In_ MdDeviceObject DeviceObject, _Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *RetrievalMode, _Out_ WDF_DEVICE_IO_TYPE *RWPreference, _Out_ WDF_DEVICE_IO_TYPE *IoctlPreference)
Definition: fxdeviceum.cpp:593
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE

◆ PoFxDevicePowerNotRequired()

void FxMessageDispatch::PoFxDevicePowerNotRequired ( VOID  )
virtual

Definition at line 341 of file fxmessagedispatchum.cpp.

344{
346}
static void PoFxDevicePowerNotRequired(_In_ MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:817

◆ PoFxDevicePowerRequired()

void FxMessageDispatch::PoFxDevicePowerRequired ( VOID  )
virtual

Definition at line 333 of file fxmessagedispatchum.cpp.

336{
338}
static void PoFxDevicePowerRequired(_In_ MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:808

◆ ProcessWmiPowerQueryOrSetData()

NTSTATUS FxMessageDispatch::ProcessWmiPowerQueryOrSetData ( _In_ RdWmiPowerAction  Action,
_Out_ BOOLEAN QueryResult 
)
virtual

Definition at line 291 of file fxmessagedispatchum.cpp.

295{
296 return m_Device->ProcessWmiPowerQueryOrSetData(Action, QueryResult);
297}
NTSTATUS ProcessWmiPowerQueryOrSetData(_In_ RdWmiPowerAction Action, _Out_ BOOLEAN *QueryResult)
Definition: fxdeviceum.cpp:699
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

◆ QueryInformationFile()

void FxMessageDispatch::QueryInformationFile ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 246 of file fxmessagedispatchum.cpp.

250{
253 pIrp,
254 pFxContext
255 );
256}
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48

◆ QueryInterface()

HRESULT FxMessageDispatch::QueryInterface ( _In_ REFIID  riid,
_Out_ LPVOID ppvObject 
)

Definition at line 120 of file fxmessagedispatchum.cpp.

124{
125 if ( NULL == ppv ) {
126 return E_INVALIDARG;
127 }
128
129 if ( iid == IID_IUnknown) {
130 *ppv = static_cast<IUnknown *> (this);
131 }
132 else if ( iid == IID_IFxMessageDispatch ) {
133 *ppv = static_cast<IFxMessageDispatch *> (this);
134 }
135 else if ( iid == IID_IFxMessageDispatch2 ) {
136 *ppv = static_cast<IFxMessageDispatch2 *> (this);
137 }
138 else if ( iid == IID_FxMessageDispatch ) {
139 *ppv = this;
140 }
141 else {
142 *ppv = NULL;
143 return E_NOINTERFACE;
144 }
145
146 this->AddRef();
147 return S_OK;
148}
const GUID IID_IUnknown
ULONG __stdcall AddRef()
#define E_INVALIDARG
Definition: ddrawi.h:101
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ReadFile()

void FxMessageDispatch::ReadFile ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 199 of file fxmessagedispatchum.cpp.

203{
204 GetDriverObject()->MajorFunction[IRP_MJ_READ](GetDeviceObject(), pIrp, pFxContext);
205}
#define IRP_MJ_READ
Definition: rdpdr.c:46

◆ Release()

ULONG FxMessageDispatch::Release ( )

Definition at line 96 of file fxmessagedispatchum.cpp.

97{
99
100 if (0 == cRefs) {
101 //
102 // The lifetime of this object is controlled by FxDevice
103 // object (the container object), and not by this ref count. FxDevice
104 // will delete this object in its destructior.
105 //
106 DO_NOTHING();
107 }
108
109 //
110 // This allows host to manage the lifetime of FxDevice. If this is the last
111 // release on FxDevice, FxDevice will e deleted and this object will be
112 // deleted as part of FxDevice destructor.
113 //
114 m_Device->RELEASE(this);
115
116 return cRefs;
117}
#define InterlockedDecrement
Definition: armddk.h:52
#define DO_NOTHING()
Definition: mxgeneral.h:32

Referenced by _GetObjFromItf().

◆ RemoteInterfaceArrival()

WUDF_INTERFACE_CONTEXT FxMessageDispatch::RemoteInterfaceArrival ( _In_ LPCGUID  pDeviceInterfaceGuid,
_In_ PCWSTR  pSymbolicLink 
)
virtual

Definition at line 300 of file fxmessagedispatchum.cpp.

304{
306 pDeviceInterfaceGuid,
307 pSymbolicLink);
308}
static WUDF_INTERFACE_CONTEXT RemoteInterfaceArrival(_In_ IWudfDevice *DeviceObject, _In_ LPCGUID DeviceInterfaceGuid, _In_ PCWSTR SymbolicLink)
Definition: fxdeviceum.cpp:762

◆ RemoteInterfaceRemoval()

void FxMessageDispatch::RemoteInterfaceRemoval ( _In_ WUDF_INTERFACE_CONTEXT  RemoteInterfaceID)
virtual

Definition at line 311 of file fxmessagedispatchum.cpp.

314{
316 RemoteInterfaceID);
317}
static void RemoteInterfaceRemoval(_In_ IWudfDevice *DeviceObject, _In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID)
Definition: fxdeviceum.cpp:778

◆ SetInformationFile()

void FxMessageDispatch::SetInformationFile ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 259 of file fxmessagedispatchum.cpp.

263{
265 pIrp,
266 pFxContext);
267}
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49

◆ TransportQueryID()

BOOL FxMessageDispatch::TransportQueryID ( _In_ DWORD  Id,
_In_ PVOID  DataBuffer,
_In_ SIZE_T  cbDataBufferSize 
)
virtual

Definition at line 320 of file fxmessagedispatchum.cpp.

325{
327 Id,
328 DataBuffer,
329 cbDataBufferSize);
330}
DWORD Id
static BOOL TransportQueryId(_In_ IWudfDevice *DeviceObject, _In_ DWORD Id, _In_ PVOID DataBuffer, _In_ SIZE_T cbDataBufferSize)
Definition: fxdeviceum.cpp:790

◆ WriteFile()

void FxMessageDispatch::WriteFile ( _In_ IWudfIoIrp *  pIrp,
_In_opt_ IUnknown pFxContext 
)
virtual

Definition at line 208 of file fxmessagedispatchum.cpp.

212{
213 GetDriverObject()->MajorFunction[IRP_MJ_WRITE](GetDeviceObject(), pIrp, pFxContext);
214}
#define IRP_MJ_WRITE
Definition: rdpdr.c:47

Member Data Documentation

◆ m_cRefs

LONG FxMessageDispatch::m_cRefs
private

Definition at line 246 of file fxmessagedispatchum.hpp.

Referenced by AddRef(), and Release().

◆ m_Device

FxDevice* FxMessageDispatch::m_Device
private

The documentation for this class was generated from the following files: