ReactOS  0.4.15-dev-3165-gdf6fff7
fxmessagedispatchum.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft. All rights reserved.
4 
5 Module Name:
6 
7  WudfDispatcher.h
8 
9 Abstract:
10 
11  This file contains the class definition of the WUDF dispatcher object.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  User mode only
20 
21 Revision History:
22 
23 
24 
25 --*/
26 #pragma once
27 
28 extern const GUID IID_FxMessageDispatch;
29 extern const GUID IID_FxMessageDispatch2;
30 
31 class FxMessageDispatch;
32 
34  public FxStump,
35  public IFxMessageDispatch2
36 {
37  //
38  // Manager functions.
39  //
40 private:
43  ) :
44  m_cRefs(1),
46  {
47  }
48 
49 public:
51  {
52  // SAFE_RELEASE(m_Device);
53  }
54 
55  static
56  NTSTATUS
60  _Out_ FxMessageDispatch ** ppWudfDispatcher
61  );
62 
63  //
64  // IUnknown
65  //
66 public:
67  HRESULT
68  __stdcall
72  );
73 
74  ULONG
75  __stdcall
76  AddRef();
77 
78  ULONG
79  __stdcall
80  Release();
81 
82  //
83  // IFxMessageDispatch
84  //
85 public:
86  virtual void __stdcall
88  _In_ IWudfIrp * pIrp
89  );
90 
91  virtual void __stdcall
92  CreateFile(
93  _In_ IWudfIoIrp * pCreateIrp
94  );
95 
96  virtual void __stdcall
98  _In_ IWudfIoIrp * pIrp,
99  _In_opt_ IUnknown * pFxContext
100  );
101 
102  virtual void __stdcall
103  ReadFile(
104  _In_ IWudfIoIrp * pIrp,
105  _In_opt_ IUnknown * pFxContext
106  );
107 
108  virtual void __stdcall
109  WriteFile(
110  _In_ IWudfIoIrp * pIrp,
111  _In_opt_ IUnknown * pFxContext
112  );
113 
114  virtual void __stdcall
115  CleanupFile(
116  _In_ IWudfIoIrp * pIrp,
117  _In_ IUnknown * pFxContext
118  );
119 
120  virtual void __stdcall
121  CloseFile(
122  _In_ IWudfIoIrp * pIrp,
123  _In_ IUnknown * pFxContext
124  );
125 
126  virtual
127  VOID
128  __stdcall
131  _Out_ UMINT::WDF_DEVICE_IO_TYPE *RWPreference,
132  _Out_ UMINT::WDF_DEVICE_IO_TYPE *IoctlPreference
133  );
134 
135  virtual void __stdcall
136  FlushBuffers(
137  _In_ IWudfIoIrp * pIrp,
138  _In_opt_ IUnknown * pFxContext
139  );
140 
141  virtual void __stdcall
143  _In_ IWudfIoIrp * pIrp,
144  _In_opt_ IUnknown * pFxContext
145  );
146 
147  virtual void __stdcall
149  _In_ IWudfIoIrp * pIrp,
150  _In_opt_ IUnknown * pFxContext
151  );
152 
153  virtual NTSTATUS __stdcall
155  _In_ RdWmiPowerAction Action,
156  _Out_ BOOLEAN *QueryResult
157  );
158 
159  //
160  // We should remove these methods from this interface.
161  //
164  _In_ LPCGUID pDeviceInterfaceGuid,
165  _In_ PCWSTR pSymbolicLink
166  );
167 
168  virtual void __stdcall
170  _In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID
171  );
172 
173  virtual BOOL __stdcall
175  _In_ DWORD Id,
176  _In_ PVOID DataBuffer,
177  _In_ SIZE_T cbDataBufferSize
178  );
179 
180  virtual ULONG __stdcall
182  VOID
183  );
184 
185  virtual void __stdcall
187  VOID
188  );
189 
190  virtual void __stdcall
192  VOID
193  );
194 
195  //
196  // Additional public functions.
197  //
198 public:
199  //
200  // Returns the Dispatcher object from the given interface without
201  // incrementing the refcount.
202  //
203  static
206  _In_ IFxMessageDispatch* pIFxMessageDispatch
207  );
208 
209  //
210  // Returns the specified interface from the given object without
211  // incrementing the refcount.
212  //
213  static
214  IFxMessageDispatch*
216  _In_ FxMessageDispatch* pWudfDispatcher
217  );
218 
219  //
220  // Returns a weak ref to the embedded user-mode driver object.
221  //
224  VOID
225  )
226  {
227  return m_Device->GetDriver()->GetDriverObject();
228  }
229 
232  VOID
233  )
234  {
235  return m_Device->GetDeviceObject();
236  }
237 
238  //
239  // Data members.
240  //
241 private:
242  //
243  // Reference count for debugging purposes. The lifetime is managed by
244  // FxDevice.
245  //
247 
248  //
249  // Device object associated with this dispatcher object.
250  //
252 };
253 
virtual void __stdcall DispatchPnP(_In_ IWudfIrp *pIrp)
const GUID IID_FxMessageDispatch
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define REFIID
Definition: guiddef.h:118
ULONG __stdcall Release()
#define _In_opt_
Definition: ms_sal.h:309
virtual void __stdcall SetInformationFile(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
#define _Out_
Definition: ms_sal.h:345
virtual void __stdcall WriteFile(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
REFIID riid
Definition: precomp.h:44
LONG NTSTATUS
Definition: precomp.h:26
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
virtual void __stdcall QueryInformationFile(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
virtual void __stdcall FlushBuffers(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
DriverGlobals
FxIrp * pIrp
const GUID IID_FxMessageDispatch2
virtual void __stdcall CreateFile(_In_ IWudfIoIrp *pCreateIrp)
DWORD Id
virtual void __stdcall CloseFile(_In_ IWudfIoIrp *pIrp, _In_ IUnknown *pFxContext)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static NTSTATUS _CreateAndInitialize(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ FxDevice *Device, _Out_ FxMessageDispatch **ppWudfDispatcher)
virtual void __stdcall RemoteInterfaceRemoval(_In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID)
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
PDRIVER_OBJECT_UM GetDriverObject(VOID)
FxMessageDispatch(_In_ FxDevice *Device)
virtual void __stdcall CleanupFile(_In_ IWudfIoIrp *pIrp, _In_ IUnknown *pFxContext)
virtual void __stdcall PoFxDevicePowerNotRequired(VOID)
virtual void __stdcall PoFxDevicePowerRequired(VOID)
LONG HRESULT
Definition: typedefs.h:79
enum _WDF_DEVICE_IO_BUFFER_RETRIEVAL WDF_DEVICE_IO_BUFFER_RETRIEVAL
Definition: mxum.h:117
virtual NTSTATUS __stdcall ProcessWmiPowerQueryOrSetData(_In_ RdWmiPowerAction Action, _Out_ BOOLEAN *QueryResult)
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG __stdcall AddRef()
#define __stdcall
Definition: typedefs.h:25
MdDeviceObject GetDeviceObject(VOID)
__inline FxDriver * GetDriver(VOID)
Definition: fxdevice.hpp:164
virtual WUDF_INTERFACE_CONTEXT __stdcall RemoteInterfaceArrival(_In_ LPCGUID pDeviceInterfaceGuid, _In_ PCWSTR pSymbolicLink)
HRESULT __stdcall QueryInterface(_In_ REFIID riid, _Out_ LPVOID *ppvObject)
virtual void __stdcall ReadFile(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
REFIID LPVOID * ppvObject
Definition: precomp.h:44
virtual void __stdcall DeviceControl(_In_ IWudfIoIrp *pIrp, _In_opt_ IUnknown *pFxContext)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
virtual BOOL __stdcall TransportQueryID(_In_ DWORD Id, _In_ PVOID DataBuffer, _In_ SIZE_T cbDataBufferSize)
virtual ULONG __stdcall GetDirectTransferThreshold(VOID)
__inline MdDriverObject GetDriverObject(VOID)
Definition: fxdriver.hpp:252
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static IFxMessageDispatch * _GetDispatcherItf(_In_ FxMessageDispatch *pWudfDispatcher)
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
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)
unsigned int ULONG
Definition: retypes.h:1
static FxMessageDispatch * _GetObjFromItf(_In_ IFxMessageDispatch *pIFxMessageDispatch)
UINT64 WUDF_INTERFACE_CONTEXT
Definition: mxum.h:111