ReactOS  0.4.15-dev-3165-gdf6fff7
fxwmiirphandler.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxWmiIrpHandler.hpp
8 
9 Abstract:
10 
11  This module implements the wmi IRP handler for the driver frameworks.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Both kernel and user mode
20 
21 Revision History:
22 
23 
24 --*/
25 
26 #ifndef _FXWMIIRPHANDLER_H_
27 #define _FXWMIIRPHANDLER_H_
28 
29 typedef
34  __in PIRP Irp,
37  );
38 
42 };
43 
44 class FxWmiIrpHandler : public FxPackage {
45  friend FxWmiProvider;
46 
47 public:
48 
50  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
53  );
54 
56 
58  NTSTATUS
60  VOID
61  );
62 
64  NTSTATUS
66  __in PIRP Irp,
68  );
69 
70  virtual
72  NTSTATUS
73  Dispatch(
74  __in PIRP Irp
75  );
76 
78  NTSTATUS
79  Register(
80  VOID
81  );
82 
83  VOID
84  Deregister(
85  VOID
86  );
87 
88  VOID
89  Cleanup(
90  VOID
91  );
92 
93  VOID
95  VOID
96  );
97 
99  NTSTATUS
100  AddProvider(
103  );
104 
106  NTSTATUS
108  __in PWDF_WMI_PROVIDER_CONFIG ProviderConfig,
111  );
112 
113 protected:
114  static
115  VOID
117  VOID
118  );
119 
121  NTSTATUS
124  __in KIRQL Irql,
126  );
127 
128  VOID
131  );
132 
133  VOID
136  );
137 
142  );
143 
147  __in LPGUID Guid,
148  __in PVOID Tag
149  );
150 
151 private:
152  static
154  NTSTATUS
157  __in PIRP Irp,
160  );
161 
162  static
164  NTSTATUS
167  __in PIRP Irp,
170  );
171 
172  static
174  NTSTATUS
177  __in PIRP Irp,
180  );
181 
182  static
184  NTSTATUS
187  __in PIRP Irp,
190  );
191 
192  static
194  NTSTATUS
197  __in PIRP Irp,
200  );
201 
202  static
204  NTSTATUS
205  _RegInfo(
207  __in PIRP Irp,
210  );
211 
212  static
214  NTSTATUS
217  __in PIRP Irp,
220  );
221 
222  VOID
224  __in PIRP Irp,
227  );
228 
229  VOID
231  __in PIRP Irp,
234  );
235 
236  VOID
238  __in PIRP Irp,
241  );
242 
244  NTSTATUS
246  __in PIRP Irp,
249  );
250 
251  BOOLEAN
254  );
255 
256  static
258 
259  VOID
260  UpdateGuids(
261  VOID
262  );
263 
264  VOID
266  LONG count;
267 
269  ASSERT(count > 1);
271  }
272 
273  VOID
275  LONG count;
276 
278  ASSERT(count >= 0);
279  if (count == 0) {
280  m_UpdateEvent.Set();
281  }
282  }
283 
284  VOID
286 
288 
290  }
291 
292 protected:
298  };
299 
300 protected:
302 
304 
306 
308 
310 
311  //
312  // count of references taken every time an update is needed
313  //
315 
316  //
317  // WMI unregister waits on this event to ensure no upadtes are allowed
318  // after unregister.
319  //
321 
323 
325 
326 
327 };
328 
329 #endif // _FXWMIIRPHANDLER_H_
_In_ ULONG _Out_ PULONG BufferUsed
Definition: wdfwmi.h:92
static MX_WORKITEM_ROUTINE _UpdateGuids
_Must_inspect_result_ FxWmiProvider * FindProviderLocked(__in LPGUID Guid)
WmiRegisteredState m_RegisteredState
#define __in_opt
Definition: dbghelp.h:38
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
VOID ResetStateForPdoRestart(VOID)
GLuint GLuint GLsizei count
Definition: gl.h:1545
_Must_inspect_result_ NTSTATUS AddProviderLocked(__in FxWmiProvider *Provider, __in KIRQL Irql, __out_opt PBOOLEAN Update=NULL)
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ FxWmiProvider * FindProviderReferenced(__in LPGUID Guid, __in PVOID Tag)
__in PFN_WMI_HANDLER_MINOR_DISPATCH Handler
IO_WORKITEM_ROUTINE MX_WORKITEM_ROUTINE
Definition: mxworkitemkm.h:26
_Must_inspect_result_ NTSTATUS HandleWmiTraceRequest(__in PIRP Irp, __in FxTraceInfo *Info)
VOID Set(VOID)
Definition: fxwaitlock.hpp:144
static _Must_inspect_result_ NTSTATUS _RegInfo(__in FxWmiIrpHandler *This, __in PIRP Irp, __in_opt FxWmiProvider *Provider, __in_opt FxWmiInstance *Instance)
_Out_ PKIRQL Irql
Definition: csq.h:179
__in BOOLEAN CheckInstance
_Must_inspect_result_ NTSTATUS AddProvider(__in FxWmiProvider *Provider, __out_opt PBOOLEAN Update=NULL)
static _Must_inspect_result_ NTSTATUS _QuerySingleInstance(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define __out_opt
Definition: dbghelp.h:65
_In_ PIRP Irp
Definition: csq.h:116
long LONG
Definition: pedump.c:60
VOID RemoveProviderLocked(__in FxWmiProvider *Provider)
NTSTATUS EnterCRAndWaitAndLeave(VOID)
Definition: fxwaitlock.hpp:87
unsigned char BOOLEAN
static _Must_inspect_result_ NTSTATUS _EnableDisableEventsAndCollection(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
static VOID CheckAssumptions(VOID)
Status
Definition: gdiplustypes.h:24
__in __drv_restoresIRQL KIRQL OldIrql
Definition: fxobject.hpp:1465
VOID CompleteWmiQuerySingleInstanceRequest(__in PIRP Irp, __in NTSTATUS Status, __in ULONG BufferUsed)
#define ASSERT(a)
Definition: mode.c:44
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:760
LIST_ENTRY m_ProvidersListHead
_Must_inspect_result_ NTSTATUS CompleteWmiRequest(__in PIRP Irp, __in NTSTATUS Status, __in ULONG BufferUsed)
VOID CompleteWmiExecuteMethodRequest(__in PIRP Irp, __in NTSTATUS Status, __in ULONG BufferUsed)
Type
Definition: Type.h:6
VOID UpdateGuids(VOID)
char * PBOOLEAN
Definition: retypes.h:11
#define InterlockedDecrement
Definition: armddk.h:52
#define NTSTATUS
Definition: precomp.h:20
PIO_WORKITEM m_WorkItem
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
#define __inout
Definition: dbghelp.h:50
Definition: typedefs.h:119
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
static _Must_inspect_result_ NTSTATUS _QueryAllData(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in_opt FxWmiInstance *Instance)
_Must_inspect_result_ NTSTATUS AddPowerPolicyProviderAndInstance(__in PWDF_WMI_PROVIDER_CONFIG ProviderConfig, __in FxWmiInstanceInternalCallbacks *Callbacks, __inout FxWmiInstanceInternal **Instance)
BOOLEAN DeferUpdateLocked(__in KIRQL OldIrql)
#define InterlockedIncrement
Definition: armddk.h:53
static const FxWmiMinorEntry m_WmiDispatchTable[]
_Must_inspect_result_ NTSTATUS Register(VOID)
USHORT WDFTYPE
Definition: fxtypes.h:29
VOID CompleteWmiQueryAllDataRequest(__in PIRP Irp, __in NTSTATUS Status, __in ULONG BufferUsed)
#define NULL
Definition: types.h:112
static _Must_inspect_result_ NTSTATUS _ChangeSingleItem(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
static _Must_inspect_result_ NTSTATUS _ExecuteMethod(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
unsigned int ULONG
Definition: retypes.h:1
VOID DecrementUpdateCountAndWait()
virtual _Must_inspect_result_ NTSTATUS Dispatch(__in PIRP Irp)
_Must_inspect_result_ NTSTATUS(* PFN_WMI_HANDLER_MINOR_DISPATCH)(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
FxWmiIrpHandler(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CfxDevice *Device, __in WDFTYPE Type=FX_TYPE_WMI_IRP_HANDLER)
#define __in
Definition: dbghelp.h:35
static _Must_inspect_result_ NTSTATUS _ChangeSingleInstance(__in FxWmiIrpHandler *This, __in PIRP Irp, __in FxWmiProvider *Provider, __in FxWmiInstance *Instance)
IN PVOID Instance
Definition: pci.h:361
VOID RemoveProvider(__in FxWmiProvider *Provider)