ReactOS 0.4.15-dev-8222-g9164419
fxwmiinstance.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxWmiInstance.hpp
8
9Abstract:
10
11 This module implements the WMI instance object
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23
24
25--*/
26
27#ifndef _FXWMIINSTANCE_H_
28#define _FXWMIINSTANCE_H_
29
30
32
35
36public:
38 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
39 __in USHORT ObjectSize,
41 );
42
44
47 VOID
48 )
49 {
50 return m_Provider->GetDevice();
51 }
52
55 VOID
56 )
57 {
58 return m_Provider;
59 }
60
64 __in_bcount_opt(EventBufferSize) PVOID EventBuffer,
65 __inout ULONG EventBufferSize
66 );
67
71 )
72 {
74 }
75
76 WDFWMIINSTANCE
78 VOID
79 )
80 {
81 return (WDFWMIINSTANCE) GetObjectHandle();
82 }
83
84 virtual
87 VOID
88 ) =0;
89
90 virtual
95 QueryInstance(
99 ) =0;
100
101 virtual
102 BOOLEAN
104 VOID
105 ) =0;
106
107 virtual
112 SetInstance(
115 ) =0;
116
117 virtual
118 BOOLEAN
120 VOID
121 ) =0;
122
123 virtual
128 SetItem(
132 ) =0;
133
134 virtual
135 BOOLEAN
137 VOID
138 ) =0;
139
140 virtual
145 ExecuteMethod(
153 ) =0;
154
155 // begin FxObject overrides
156 virtual
157 BOOLEAN
158 Dispose(
159 VOID
160 );
161 // end FxObject overrides
162
163protected:
164 //
165 // List entry used by FxWmiProvider to hold the list of WMI instances
166 //
168
169 //
170 // Pointer to the parent provider
171 //
173};
174
176
178
180 __in PFX_DRIVER_GLOBALS FxDriverGlobals
181 ) :
182 FxCallback(FxDriverGlobals),
184 {
185 }
186
188 {
189 }
190
195 Invoke(
196 __in WDFDEVICE Device,
197 __in WDFWMIINSTANCE WmiInstance,
201 )
202 {
204
206
207 if (m_Method != NULL) {
211 OutBuffer,
212 BufferUsed);
213 CallbackEnd();
214 }
215 else {
217 }
218
219 return status;
220 }
221};
222
224
226
228 PFX_DRIVER_GLOBALS FxDriverGlobals
229 ) :
230 FxCallback(FxDriverGlobals),
232 {
233 }
234
236 {
237 }
238
243 Invoke(
244 __in WDFDEVICE Device,
245 __in WDFWMIINSTANCE WmiInstance,
248 )
249 {
251
253
254 if (m_Method != NULL) {
257 CallbackEnd();
258 }
259 else {
261 }
262
263 return status;
264 }
265};
266
268
270
272 PFX_DRIVER_GLOBALS FxDriverGlobals
273 ) :
274 FxCallback(FxDriverGlobals),
276 {
277 }
278
280 {
281 }
282
287 Invoke(
288 __in WDFDEVICE Device,
289 __in WDFWMIINSTANCE WmiInstance,
293 )
294 {
296
298
299 if (m_Method != NULL) {
304 InBuffer);
305 CallbackEnd();
306
307 }
308 else {
310 }
311
312 return status;
313 }
314};
315
317
319
321 PFX_DRIVER_GLOBALS FxDriverGlobals
322 ) :
323 FxCallback(FxDriverGlobals),
325 {
326 }
327
329 {
330 }
331
336 Invoke(
337 __in WDFDEVICE Device,
338 __in WDFWMIINSTANCE WmiInstance,
346 )
347 {
349
351
352 if (m_Method != NULL) {
355 MethodId,
358 Buffer,
359 BufferUsed);
360 CallbackEnd();
361 }
362 else {
364 }
365
366 return status;
367 }
368};
369
371public:
373 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
376 );
377
378 VOID
381 )
382 {
384 }
385
386 static
389 _Create(
390 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
392 __in PWDF_WMI_INSTANCE_CONFIG WmiInstanceConfig,
394 __out WDFWMIINSTANCE* WmiInstance,
396 );
397
398protected:
399 virtual
400 BOOLEAN
402 VOID
403 );
404
405 virtual
410 QueryInstance(
414 );
415
416 virtual
417 BOOLEAN
419 VOID
420 );
421
422 virtual
427 SetInstance(
430 );
431
432 virtual
433 BOOLEAN
435 VOID
436 );
437
438 virtual
443 SetItem(
447 );
448
449 virtual
450 BOOLEAN
452 VOID
453 );
454
455 virtual
460 ExecuteMethod(
468 );
469
470protected:
471 //
472 // Attributes associated with this instance
473 //
475
477
479
481
483
485};
486
487typedef
492(*PFN_FX_WMI_INSTANCE_QUERY_INSTANCE)(
498 );
499
500typedef
505(*PFN_FX_WMI_INSTANCE_SET_INSTANCE)(
510 );
511
512typedef
517(*PFN_FX_WMI_INSTANCE_SET_ITEM)(
523 );
524
525typedef
530(*PFN_FX_WMI_INSTANCE_EXECUTE_METHOD)(
540 );
541
544 VOID
545 )
546 {
547 RtlZeroMemory(this, sizeof(*this));
548 }
549
550 //
551 // Callback when caller wants to query the entire data item's buffer.
552 //
553 PFN_FX_WMI_INSTANCE_QUERY_INSTANCE QueryInstance;
554
555 //
556 // Callback when caller wants to set the entire data item's buffer.
557 //
558 PFN_FX_WMI_INSTANCE_SET_INSTANCE SetInstance;
559
560 //
561 // Callback when caller wants to set a single field in the data item's buffer
562 //
563 PFN_FX_WMI_INSTANCE_SET_ITEM SetItem;
564
565 //
566 // Callback when caller wants to execute a method on the data item.
567 //
568 PFN_FX_WMI_INSTANCE_EXECUTE_METHOD ExecuteMethod;
569};
570
572
573public:
575 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
578 );
579
580protected:
581 virtual
582 BOOLEAN
584 VOID
585 );
586
587 virtual
592 QueryInstance(
596 );
597
598 virtual
599 BOOLEAN
601 VOID
602 );
603
604 virtual
609 SetInstance(
612 );
613
614 virtual
615 BOOLEAN
617 VOID
618 );
619
620 virtual
625 SetItem(
629 );
630
631 virtual
632 BOOLEAN
634 VOID
635 );
636
637 virtual
642 ExecuteMethod(
650 );
651
652protected:
653 PFN_FX_WMI_INSTANCE_QUERY_INSTANCE m_QueryInstance;
654 PFN_FX_WMI_INSTANCE_SET_INSTANCE m_SetInstance;
655 PFN_FX_WMI_INSTANCE_SET_ITEM m_SetItem;
656 PFN_FX_WMI_INSTANCE_EXECUTE_METHOD m_ExecuteMethod;
657};
658
659#endif // _FXWMIINSTANCE_H_
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
Definition: bufpool.h:45
void __inline CallbackStart(VOID)
Definition: fxcallback.hpp:64
void __inline CallbackEnd(VOID)
Definition: fxcallback.hpp:74
VOID SetContextForQueryLength(__in ULONG ContextSize)
virtual BOOLEAN IsSetInstanceSupported(VOID)
virtual BOOLEAN IsQueryInstanceSupported(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS QueryInstance(__inout ULONG OutBufferSize
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS ExecuteMethod(__in ULONG MethodId
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __drv_when(InBufferSize >=OutBufferSize, __inout_bcount(InBufferSize)) __drv_when(InBufferSize< OutBufferSize
FxWmiInstanceSetItemCallback m_SetItemCallback
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetItem(__in ULONG DataItemId
virtual _Must_inspect_result_ __drv_sameIRQL __out_xcount(OutBuffer->size) PVOID OutBuffer
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __inout_bcount(OutBufferSize)) PVOID Buffer
FxWmiInstanceQueryInstanceCallback m_QueryInstanceCallback
FxWmiInstanceSetInstanceCallback m_SetInstanceCallback
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)
virtual BOOLEAN IsSetItemSupported(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __in_bcount(InBufferSize) PVOID InBuffer)
virtual BOOLEAN IsExecuteMethodSupported(VOID)
FxWmiInstanceExecuteMethodCallback m_ExecuteMethodCallback
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetInstance(__in ULONG InBufferSize
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxWmiProvider *Provider, __in PWDF_WMI_INSTANCE_CONFIG WmiInstanceConfig, __in_opt PWDF_OBJECT_ATTRIBUTES InstanceAttributes, __out WDFWMIINSTANCE *WmiInstance, __out FxWmiInstanceExternal **Instance)
virtual BOOLEAN IsSetInstanceSupported(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __in_bcount(InBufferSize) PVOID InBuffer)
PFN_FX_WMI_INSTANCE_EXECUTE_METHOD m_ExecuteMethod
virtual BOOLEAN IsQueryInstanceSupported(VOID)
PFN_FX_WMI_INSTANCE_SET_ITEM m_SetItem
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS ExecuteMethod(__in ULONG MethodId
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __inout_bcount(OutBufferSize)) PVOID Buffer
virtual BOOLEAN IsSetItemSupported(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __drv_when(InBufferSize >=OutBufferSize, __inout_bcount(InBufferSize)) __drv_when(InBufferSize< OutBufferSize
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetInstance(__in ULONG InBufferSize
virtual _Must_inspect_result_ __drv_sameIRQL __out_bcount(OutBufferSize) PVOID OutBuffer
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS QueryInstance(__inout ULONG OutBufferSize
PFN_FX_WMI_INSTANCE_QUERY_INSTANCE m_QueryInstance
virtual BOOLEAN IsExecuteMethodSupported(VOID)
PFN_FX_WMI_INSTANCE_SET_INSTANCE m_SetInstance
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetItem(__in ULONG DataItemId
virtual _Must_inspect_result_ __drv_sameIRQL __in_bcount(InBufferSize) PVOID InBuffer)=0
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)=0
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetInstance(__in ULONG InBufferSize
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __inout_bcount(OutBufferSize)) PVOID Buffer
WDFWMIINSTANCE GetHandle(VOID)
virtual BOOLEAN Dispose(VOID)
virtual BOOLEAN IsExecuteMethodSupported(VOID)=0
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS QueryInstance(__in ULONG OutBufferSize
LIST_ENTRY m_ListEntry
friend FxWmiProvider
friend FxWmiIrpHandler
virtual BOOLEAN IsQueryInstanceSupported(VOID)=0
CfxDevice * GetDevice(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS SetItem(__in ULONG DataItemId
FxWmiProvider * m_Provider
_Must_inspect_result_ NTSTATUS FireEvent(__in_bcount_opt(EventBufferSize) PVOID EventBuffer, __inout ULONG EventBufferSize)
virtual _Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS ExecuteMethod(__in ULONG MethodId
BOOLEAN IsEnabled(__in WDF_WMI_PROVIDER_CONTROL Control)
virtual BOOLEAN IsSetInstanceSupported(VOID)=0
virtual BOOLEAN IsSetItemSupported(VOID)=0
virtual _Must_inspect_result_ __drv_sameIRQL __out_bcount_part(OutBufferSize, *BufferUsed) PVOID OutBuffer
FxWmiProvider * GetProvider(VOID)
virtual _Must_inspect_result_ __drv_sameIRQL __in ULONG __inout ULONG __drv_when(InBufferSize >=OutBufferSize, __inout_bcount(InBufferSize)) __drv_when(InBufferSize< OutBufferSize
CfxDevice * GetDevice(VOID)
BOOLEAN IsEnabled(__in WDF_WMI_PROVIDER_CONTROL Control)
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define __in_bcount_opt(x)
Definition: dbghelp.h:44
#define NULL
Definition: types.h:112
#define NTSTATUS
Definition: precomp.h:21
#define __drv_sameIRQL
Definition: driverspecs.h:325
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
return pObject GetObjectHandle()
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __inout ULONG OutBufferSize
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __inout ULONG __out PULONG BufferUsed
_Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS(*PFN_FX_WMI_INSTANCE_QUERY_INSTANCE)(__in CfxDevice *Device
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG DataItemId
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal * Instance
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __inout ULONG __out_bcount(OutBufferSize) PVOID OutBuffer
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG MethodId
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG __in ULONG __inout ULONG __drv_when(InBufferSize >=OutBufferSize, __inout_bcount(InBufferSize)) __drv_when(InBufferSize< OutBufferSize
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG InBufferSize
_Must_inspect_result_ __drv_sameIRQL __in FxWmiInstanceInternal __in ULONG __in ULONG __inout ULONG __inout_bcount(OutBufferSize)) PVOID Buffer
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_WMI_GUID_NOT_FOUND
Definition: ntstatus.h:776
#define STATUS_WMI_READ_ONLY
Definition: ntstatus.h:818
unsigned short USHORT
Definition: pedump.c:61
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
PFN_WDF_WMI_INSTANCE_EXECUTE_METHOD m_Method
FxWmiInstanceExecuteMethodCallback(PFX_DRIVER_GLOBALS FxDriverGlobals)
_Must_inspect_result_ __drv_sameIRQL __in WDFWMIINSTANCE __in ULONG __in ULONG __inout ULONG __drv_when(InBufferSize >=OutBufferSize, __inout_bcount(InBufferSize)) __drv_when(InBufferSize< OutBufferSize
_Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS Invoke(__in WDFDEVICE Device
_Must_inspect_result_ __drv_sameIRQL __in WDFWMIINSTANCE __in ULONG __in ULONG __inout ULONG __inout_bcount(OutBufferSize)) PVOID Buffer
PFN_FX_WMI_INSTANCE_SET_ITEM SetItem
PFN_FX_WMI_INSTANCE_EXECUTE_METHOD ExecuteMethod
PFN_FX_WMI_INSTANCE_SET_INSTANCE SetInstance
PFN_FX_WMI_INSTANCE_QUERY_INSTANCE QueryInstance
FxWmiInstanceQueryInstanceCallback(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
_Must_inspect_result_ __drv_sameIRQL __in WDFWMIINSTANCE __inout ULONG __out_bcount(OutBufferSize) PVOID OutBuffer
PFN_WDF_WMI_INSTANCE_QUERY_INSTANCE m_Method
_Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS Invoke(__in WDFDEVICE Device
_Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS Invoke(__in WDFDEVICE Device
FxWmiInstanceSetInstanceCallback(PFX_DRIVER_GLOBALS FxDriverGlobals)
_Must_inspect_result_ __drv_sameIRQL __in WDFWMIINSTANCE __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)
PFN_WDF_WMI_INSTANCE_SET_INSTANCE m_Method
_Must_inspect_result_ __drv_sameIRQL __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS Invoke(__in WDFDEVICE Device
FxWmiInstanceSetItemCallback(PFX_DRIVER_GLOBALS FxDriverGlobals)
PFN_WDF_WMI_INSTANCE_SET_ITEM m_Method
_Must_inspect_result_ __drv_sameIRQL __in WDFWMIINSTANCE __in ULONG __in ULONG __in_bcount(InBufferSize) PVOID InBuffer)
Definition: typedefs.h:120
Definition: ps.c:97
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_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
_In_ ULONG OutBufferSize
Definition: wdfwmi.h:87
EVT_WDF_WMI_INSTANCE_EXECUTE_METHOD * PFN_WDF_WMI_INSTANCE_EXECUTE_METHOD
Definition: wdfwmi.h:154
_In_ ULONG _Out_ PULONG BufferUsed
Definition: wdfwmi.h:92
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166
EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE * PFN_WDF_WMI_INSTANCE_QUERY_INSTANCE
Definition: wdfwmi.h:94
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES InstanceAttributes
Definition: wdfwmi.h:478
EVT_WDF_WMI_INSTANCE_SET_INSTANCE * PFN_WDF_WMI_INSTANCE_SET_INSTANCE
Definition: wdfwmi.h:111
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481
WDF_EXTERN_C_START enum _WDF_WMI_PROVIDER_CONTROL WDF_WMI_PROVIDER_CONTROL
_Must_inspect_result_ _In_ WDFWMIINSTANCE WmiInstance
Definition: wdfwmi.h:514
_In_ ULONG InBufferSize
Definition: wdfwmi.h:106
EVT_WDF_WMI_INSTANCE_SET_ITEM * PFN_WDF_WMI_INSTANCE_SET_ITEM
Definition: wdfwmi.h:130