ReactOS 0.4.16-dev-125-g798ea90
FxWmiProvider Class Reference

#include <fxwmiprovider.hpp>

Inheritance diagram for FxWmiProvider:
Collaboration diagram for FxWmiProvider:

Public Member Functions

 FxWmiProvider (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_WMI_PROVIDER_CONFIG Config, __in CfxDevice *Device)
 
 ~FxWmiProvider ()
 
CfxDeviceGetDevice (VOID)
 
GUIDGetGUID (VOID)
 
ULONG GetFlags (VOID)
 
ULONG GetMinInstanceBufferSize (VOID)
 
ULONG GetRegistrationFlagsLocked (VOID)
 
BOOLEAN IsEventOnly (VOID)
 
BOOLEAN IsEnabled (__in WDF_WMI_PROVIDER_CONTROL Control)
 
ULONGLONG GetTracingHandle (VOID)
 
VOID SetTracingHandle (__in ULONGLONG TracingHandle)
 
WDFWMIPROVIDER GetHandle (VOID)
 
BOOLEAN IsFunctionControlSupported (VOID)
 
_Must_inspect_result_ NTSTATUS FunctionControl (__in WDF_WMI_PROVIDER_CONTROL Control, __in BOOLEAN Enable)
 
_Must_inspect_result_ NTSTATUS AddInstance (__in FxWmiInstance *Instance, __in BOOLEAN NoErrorIfPresent=FALSE)
 
VOID RemoveInstance (__in FxWmiInstance *Instance)
 
ULONG GetInstanceIndex (__in FxWmiInstance *Instance)
 
_Must_inspect_result_ FxWmiInstanceGetInstanceReferenced (__in ULONG Index, __in PVOID Tag)
 
_Must_inspect_result_ FxWmiInstanceGetInstanceReferencedLocked (__in ULONG Index, __in PVOID Tag)
 
virtual BOOLEAN Dispose (VOID)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _Create (__in PFX_DRIVER_GLOBALS CallersGlobals, __in WDFDEVICE Device, __in_opt PWDF_OBJECT_ATTRIBUTES ProviderAttributes, __in PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig, __out WDFWMIPROVIDER *WmiProvider, __out FxWmiProvider **Provider)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Protected Types

enum  AddInstanceAction { AddInstanceToTail , AddInstanceToHead }
 

Protected Member Functions

_Must_inspect_result_ NTSTATUS AddInstanceLocked (__in FxWmiInstance *Instance, __in BOOLEAN NoErrorIfPresent, __out PBOOLEAN Update, __in AddInstanceAction Action=AddInstanceToTail)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 

Protected Attributes

LIST_ENTRY m_ListEntry
 
LIST_ENTRY m_InstanceListHead
 
ULONG m_NumInstances
 
FxWmiIrpHandlerm_Parent
 
GUID m_Guid
 
ULONGLONG m_TracingHandle
 
ULONG m_MinInstanceBufferSize
 
union {
   ULONG   m_Flags
 
   struct {
      ULONG   EventOnly: 1
 
      ULONG   Expensive: 1
 
      ULONG   Tracing: 1
 
   }   m_FlagsByName
 
}; 
 
FxWmiProviderFunctionControlCallback m_FunctionControl
 
BOOLEAN m_EventControlEnabled
 
BOOLEAN m_DataBlockControlEnabled
 
BOOLEAN m_RemoveGuid
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Private Attributes

friend FxWmiIrpHandler
 

Additional Inherited Members

- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 73 of file fxwmiprovider.hpp.

Member Enumeration Documentation

◆ AddInstanceAction

Enumerator
AddInstanceToTail 
AddInstanceToHead 

Definition at line 234 of file fxwmiprovider.hpp.

Constructor & Destructor Documentation

◆ FxWmiProvider()

FxWmiProvider::FxWmiProvider ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PWDF_WMI_PROVIDER_CONFIG  Config,
__in CfxDevice Device 
)

Definition at line 28 of file fxwmiprovider.cpp.

32 :
34 sizeof(FxWmiProvider),
35 FxDriverGlobals),
36 m_FunctionControl(FxDriverGlobals)
37{
41
42 m_Parent = Device->m_PkgWmi;
43
47
49
50 m_Flags = Config->Flags;
51 m_MinInstanceBufferSize = Config->MinInstanceBufferSize;
52 RtlCopyMemory(&m_Guid, &Config->Guid, sizeof(GUID));
53
54 if (Config->EvtWmiProviderFunctionControl != NULL) {
55 m_FunctionControl.m_Method = Config->EvtWmiProviderFunctionControl;
56 }
57
58 //
59 // Driver cannot call WdfObjectDelete on this handle
60 //
62
64}
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
LIST_ENTRY m_InstanceListHead
FxWmiIrpHandler * m_Parent
ULONGLONG m_TracingHandle
ULONG m_MinInstanceBufferSize
BOOLEAN m_EventControlEnabled
LIST_ENTRY m_ListEntry
BOOLEAN m_RemoveGuid
FxWmiProviderFunctionControlCallback m_FunctionControl
BOOLEAN m_DataBlockControlEnabled
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
@ ObjectDoNotLock
Definition: fxobject.hpp:128
@ FX_TYPE_WMI_PROVIDER
Definition: fxtypes.h:49
PFN_WDF_WMI_PROVIDER_FUNCTION_CONTROL m_Method
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_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

◆ ~FxWmiProvider()

FxWmiProvider::~FxWmiProvider ( )

Definition at line 66 of file fxwmiprovider.cpp.

67{
69}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ASSERT(a)
Definition: mode.c:44

Member Function Documentation

◆ _Create()

_Must_inspect_result_ NTSTATUS FxWmiProvider::_Create ( __in PFX_DRIVER_GLOBALS  CallersGlobals,
__in WDFDEVICE  Device,
__in_opt PWDF_OBJECT_ATTRIBUTES  ProviderAttributes,
__in PWDF_WMI_PROVIDER_CONFIG  WmiProviderConfig,
__out WDFWMIPROVIDER *  WmiProvider,
__out FxWmiProvider **  Provider 
)
static

Definition at line 88 of file fxwmiprovider.cpp.

96{
102 GUID zeroGuid;
103 BOOLEAN update;
104
105 FxObjectHandleGetPtrAndGlobals(CallersGlobals,
106 Device,
108 (PVOID*) &pDevice,
110
111 *Provider = NULL;
112 update = FALSE;
113
114 *WmiProvider = NULL;
115
119 if (!NT_SUCCESS(status)) {
120 return status;
121 }
122
123 if (WmiProviderConfig->Size != sizeof(WDF_WMI_PROVIDER_CONFIG)) {
125
128 "WmiProviderConfig Size 0x%x, expected size 0x%x, %!STATUS!",
130 status);
131
132 return status;
133 }
134
135 if ((WmiProviderConfig->Flags & ~WdfWmiProviderValidFlags) != 0) {
139 "Invalid flag(s) set, Flags 0x%x, valid mask 0x%x, %!STATUS!",
141 status);
142 return status;
143 }
144
148
151 "WdfWmiProviderTracing must be the only flag set, %!STATUS!",
152 status);
153
154 return status;
155 }
156
157 //
158 // Function control makes sense if it is expensive. Otherwise you will
159 // not be called back on it.
160 //
161 // The opposite, marking yourself as expensive but providing no callback is
162 // OK b/c the provider marks the enabled state and the driver can retrieve
163 // it at runtime.
164 //
165 // Function control also applies to tracing GUIDs since the tracing subsystem
166 // will call enable/disable events to start/stop tracing.
167 //
168 if (WmiProviderConfig->EvtWmiProviderFunctionControl != NULL &&
171
174 "EvtWmiProviderFunctionControl can only be set if Flags 0x%x has "
175 "WdfWmiProviderTracing (%d) or WdfWmiProviderExpensive (%d) bit "
176 "values set, %!STATUS!",
179
180 return status;
181 }
182
183 RtlZeroMemory(&zeroGuid, sizeof(zeroGuid));
184
186 &zeroGuid,
187 sizeof(GUID)) == sizeof(GUID)) {
189
192 "WmiProvider Guid filed is all zeros, %!STATUS!",
193 status);
194
195 return status;
196 }
197
198 pProvider = NULL;
199
202
203 if (pProvider == NULL) {
205
208 "Could not allocate memory for a WDFWMIPROVIDER, %!STATUS!",
209 status);
210
211 return status;
212 }
213
215
216 if (NT_SUCCESS(status)) {
218
219 if (!NT_SUCCESS(status)) {
221 }
222 else {
223 //
224 // NT_SUCCES(status) case
225 //
226 *WmiProvider = (WDFWMIPROVIDER) hProvider;
227 }
228 }
229
230 if (NT_SUCCESS(status)) {
232
233 if (update) {
235 }
236 }
237 else {
238 //
239 // AddProvider incremented update count on success however since we
240 // are not going to update registration due to this failure, decrement
241 // the count.
242 //
243 if (update) {
245 }
246
248 }
249
250 return status;
251}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
FxWmiIrpHandler * m_PkgWmi
Definition: fxdevice.hpp:672
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
VOID RemoveProvider(__in FxWmiProvider *Provider)
_Must_inspect_result_ NTSTATUS AddProvider(__in FxWmiProvider *Provider, __out_opt PBOOLEAN Update=NULL)
VOID UpdateGuids(VOID)
#define TRACINGPNP
Definition: dbgtrace.h:67
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
FxDevice * pDevice
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
PFX_DRIVER_GLOBALS pFxDriverGlobals
@ FX_TYPE_DEVICE
Definition: fxtypes.h:47
@ FX_VALIDATE_OPTION_PARENT_NOT_ALLOWED
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
FxWmiProvider * pProvider
Definition: fxwmiapi.cpp:54
WDFWMIPROVIDER hProvider
Definition: fxwmiapi.cpp:165
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
@ WdfWmiProviderValidFlags
Definition: wdfwmi.h:72
@ WdfWmiProviderExpensive
Definition: wdfwmi.h:70
@ WdfWmiProviderTracing
Definition: wdfwmi.h:71
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig
Definition: wdfwmi.h:358
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_PROVIDER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWMIPROVIDER * WmiProvider
Definition: wdfwmi.h:363
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_PROVIDER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES ProviderAttributes
Definition: wdfwmi.h:360

◆ AddInstance()

_Must_inspect_result_ NTSTATUS FxWmiProvider::AddInstance ( __in FxWmiInstance Instance,
__in BOOLEAN  NoErrorIfPresent = FALSE 
)

Definition at line 352 of file fxwmiprovider.cpp.

356{
358 KIRQL irql;
359 BOOLEAN update;
360
363
366 "WDFWMIINSTANCE %p cannot be added to tracing WDFWMIPROVIDER %p, "
367 "%!STATUS!", Instance->GetHandle(), GetHandle(), status);
368
369 return status;
370 }
371
372 m_Parent->Lock(&irql);
373 status = AddInstanceLocked(Instance, NoErrorIfPresent, &update);
374
375 if (update) {
377 }
379
380 if (update) {
382 }
383
384 return status;
385}
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
BOOLEAN DeferUpdateLocked(__in KIRQL OldIrql)
_Must_inspect_result_ NTSTATUS AddInstanceLocked(__in FxWmiInstance *Instance, __in BOOLEAN NoErrorIfPresent, __out PBOOLEAN Update, __in AddInstanceAction Action=AddInstanceToTail)
#define TRACINGDEVICE
Definition: dbgtrace.h:58
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define GetHandle(h)
Definition: treelist.c:116
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481

Referenced by if().

◆ AddInstanceLocked()

_Must_inspect_result_ NTSTATUS FxWmiProvider::AddInstanceLocked ( __in FxWmiInstance Instance,
__in BOOLEAN  NoErrorIfPresent,
__out PBOOLEAN  Update,
__in AddInstanceAction  Action = AddInstanceToTail 
)
protected

Definition at line 255 of file fxwmiprovider.cpp.

261{
263
264 *Update = FALSE;
265
266 if (!IsListEmpty(&Instance->m_ListEntry)) {
267 if (NoErrorIfPresent) {
268 return STATUS_SUCCESS;
269 }
270 else {
271 //
272 // Entry is already on a list, bad caller!
273 //
275
278 "WDFWMIINSTANCE %p already added, %!STATUS!",
279 Instance->GetHandle(), status);
280
281 return status;
282 }
283 }
284
285 //
286 // Check to see if we are in the process of
287 //
288 switch (m_Parent->m_RegisteredState) {
290 //
291 // The GUID will be reported when we do the initial registration
292 //
293 break;
294
296 //
297 // Either the GUID will be reported when we do the re-registration or
298 // we will clean it up when we goto the cleanup state.
299 //
300 break;
301
303 //
304 // Since we already registered we need to tell WMI the change in the
305 // number of instances on this provider.
306 //
307 *Update = TRUE;
308 break;
309
311 //
312 // Device is going away, registration is not allowed for the device
313 // anymore.
314 //
316
319 "WMI is being cleanedup, WDFWMIINSTANCE %p add failing, %!STATUS!",
320 Instance->GetHandle(), status);
321
322 return status;
323
324 default:
325 ASSERT(FALSE);
326 break;
327 }
328
329 if (Action == AddInstanceToTail) {
331 }
332 else {
334 }
335
336 //
337 // Since the count is increasing to at least one, we are not going to
338 // need to report this GUID as missing. We could check the
339 // m_Parent->m_RegisteredState and only set it when we are registered, but
340 // it does us no harm to always clear this value regardless of state.
341 //
343
346
347 return status;
348}
@ Update
Definition: registry.c:565
WmiRegisteredState m_RegisteredState
#define TRUE
Definition: types.h:120
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by AddInstance(), and FxWmiIrpHandler::AddPowerPolicyProviderAndInstance().

◆ Dispose()

BOOLEAN FxWmiProvider::Dispose ( VOID  )
virtual

Reimplemented from FxObject.

Definition at line 72 of file fxwmiprovider.cpp.

75{
76 //
77 // Object is being deleted, remove this object from the irp handler's list
78 // of providers. If we don't do this, the irp handler will have a list
79 // which contains entries which have been freed.
80 //
82
83 return FxNonPagedObject::Dispose(); // __super call
84}
virtual BOOLEAN Dispose(VOID)

◆ FunctionControl()

_Must_inspect_result_ NTSTATUS FxWmiProvider::FunctionControl ( __in WDF_WMI_PROVIDER_CONTROL  Control,
__in BOOLEAN  Enable 
)

Definition at line 508 of file fxwmiprovider.cpp.

512{
514 GetHandle(),
515 Control,
516 Enable);
517}
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
__inline CfxDevice * GetDevice(VOID)
Definition: fxpackage.hpp:46
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
_Must_inspect_result_ NTSTATUS Invoke(__in WDFDEVICE Device, __in WDFWMIPROVIDER WmiProvider, __in WDF_WMI_PROVIDER_CONTROL Control, __in BOOLEAN Enable)
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166

◆ GetDevice()

CfxDevice * FxWmiProvider::GetDevice ( VOID  )
inline

Definition at line 99 of file fxwmiprovider.hpp.

102 {
103 return m_Parent->GetDevice();
104 }

Referenced by FxWmiInstance::GetDevice().

◆ GetFlags()

ULONG FxWmiProvider::GetFlags ( VOID  )
inline

Definition at line 115 of file fxwmiprovider.hpp.

118 {
119 return m_Flags;
120 }

◆ GetGUID()

GUID * FxWmiProvider::GetGUID ( VOID  )
inline

Definition at line 107 of file fxwmiprovider.hpp.

110 {
111 return &m_Guid;
112 }

Referenced by FxWmiIrpHandler::AddPowerPolicyProviderAndInstance(), and FxWmiInstance::FireEvent().

◆ GetHandle()

WDFWMIPROVIDER FxWmiProvider::GetHandle ( VOID  )
inline

Definition at line 172 of file fxwmiprovider.hpp.

175 {
176 return (WDFWMIPROVIDER) GetObjectHandle();
177 }
return pObject GetObjectHandle()

Referenced by __drv_maxIRQL().

◆ GetInstanceIndex()

ULONG FxWmiProvider::GetInstanceIndex ( __in FxWmiInstance Instance)

Definition at line 441 of file fxwmiprovider.cpp.

444{
446 ULONG index;
447 KIRQL irql;
448
449 m_Parent->Lock(&irql);
450 for (index = 0, ple = m_InstanceListHead.Flink;
452 index++, ple = ple->Flink) {
454 break;
455 }
456 }
458
459 return index;
460}
#define index(s, c)
Definition: various.h:29
PSINGLE_LIST_ENTRY ple
GLuint index
Definition: glext.h:6031
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59

Referenced by FxWmiInstance::FireEvent().

◆ GetInstanceReferenced()

_Must_inspect_result_ FxWmiInstance * FxWmiProvider::GetInstanceReferenced ( __in ULONG  Index,
__in PVOID  Tag 
)

Definition at line 464 of file fxwmiprovider.cpp.

468{
470 KIRQL irql;
471
472 m_Parent->Lock(&irql);
475
476 return pInstance;
477}
_Must_inspect_result_ FxWmiInstance * GetInstanceReferencedLocked(__in ULONG Index, __in PVOID Tag)
FxWmiInstanceExternal * pInstance
Definition: fxwmiapi.cpp:113
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065

◆ GetInstanceReferencedLocked()

_Must_inspect_result_ FxWmiInstance * FxWmiProvider::GetInstanceReferencedLocked ( __in ULONG  Index,
__in PVOID  Tag 
)

Definition at line 481 of file fxwmiprovider.cpp.

485{
486 FxWmiInstance* pFound;
488 ULONG i;
489
490 pFound = NULL;
491
492 for (i = 0, ple = m_InstanceListHead.Flink;
494 ple = ple->Flink, i++) {
495
496 if (i == Index) {
498 pFound->ADDREF(Tag);
499 break;
500 }
501 }
502
503 return pFound;
504}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by FxWmiIrpHandler::Dispatch(), and GetInstanceReferenced().

◆ GetMinInstanceBufferSize()

ULONG FxWmiProvider::GetMinInstanceBufferSize ( VOID  )
inline

Definition at line 123 of file fxwmiprovider.hpp.

126 {
128 }

Referenced by __drv_maxIRQL().

◆ GetRegistrationFlagsLocked()

ULONG FxWmiProvider::GetRegistrationFlagsLocked ( VOID  )

Definition at line 520 of file fxwmiprovider.cpp.

523{
524 ULONG flags;
525
528
529 //
530 // Once tracing GUID is registered, we do not allow it to be unregistered
531 //
533 }
534 else {
536
539 }
540
543 }
544 }
545
546 if (m_RemoveGuid) {
547 //
548 // We have gone down to zero instances of this provider, report it as
549 // gone to WMI.
550 //
553
554 //
555 // Once reported as removed, we do not have not have to report ourselves
556 // as removed again.
557 //
559 }
560
561 return flags;
562}
GLbitfield flags
Definition: glext.h:7161
@ WdfWmiProviderEventOnly
Definition: wdfwmi.h:69
#define WMIREG_FLAG_INSTANCE_PDO
Definition: wmistr.h:69
#define WMIREG_FLAG_TRACE_CONTROL_GUID
Definition: wmistr.h:74
#define WMIREG_FLAG_REMOVE_GUID
Definition: wmistr.h:70
#define WMIREG_FLAG_EVENT_ONLY_GUID
Definition: wmistr.h:75
#define WMIREG_FLAG_EXPENSIVE
Definition: wmistr.h:66
#define WMIREG_FLAG_TRACED_GUID
Definition: wmistr.h:73

Referenced by FxWmiIrpHandler::_RegInfo().

◆ GetTracingHandle()

ULONGLONG FxWmiProvider::GetTracingHandle ( VOID  )
inline

Definition at line 156 of file fxwmiprovider.hpp.

159 {
160 return m_TracingHandle;
161 }

◆ IsEnabled()

BOOLEAN FxWmiProvider::IsEnabled ( __in WDF_WMI_PROVIDER_CONTROL  Control)
inline

Definition at line 144 of file fxwmiprovider.hpp.

147 {
148 switch (Control) {
151 default: ASSERT(FALSE); return FALSE;
152 }
153 }
@ WdfWmiEventControl
Definition: wdfwmi.h:52
@ WdfWmiInstanceControl
Definition: wdfwmi.h:53

Referenced by FxWmiInstance::IsEnabled().

◆ IsEventOnly()

BOOLEAN FxWmiProvider::IsEventOnly ( VOID  )
inline

Definition at line 136 of file fxwmiprovider.hpp.

139 {
141 }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125

◆ IsFunctionControlSupported()

BOOLEAN FxWmiProvider::IsFunctionControlSupported ( VOID  )
inline

Definition at line 180 of file fxwmiprovider.hpp.

183 {
185 }

◆ RemoveInstance()

VOID FxWmiProvider::RemoveInstance ( __in FxWmiInstance Instance)

Definition at line 388 of file fxwmiprovider.cpp.

391{
392 KIRQL irql;
393 BOOLEAN update;
394
395 update = FALSE;
396
397 m_Parent->Lock(&irql);
398
399 if (!IsListEmpty(&Instance->m_ListEntry)) {
400 //
401 // Instance is in the list of instances on this provider. Remove it.
402 //
403 RemoveEntryList(&Instance->m_ListEntry);
404 InitializeListHead(&Instance->m_ListEntry);
406
408 update = TRUE;
409
410 //
411 // When the count goes to zero, inform WMI that the GUID should be
412 // removed when we get requeried. We only need to do this once we have
413 // been registered. In all other states, we ignore this value.
414 //
415 if (m_NumInstances == 0 &&
418 }
419 }
420 }
421 else {
422 //
423 // The instance was explicitly removed and now the instance is trying
424 // to remove itself during dispose. Nothing to do.
425 //
426 DO_NOTHING();
427 }
428
429 if (update) {
431 }
432
434
435 if (update) {
437 }
438}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define DO_NOTHING()
Definition: mxgeneral.h:32

Referenced by FxWmiInstance::Dispose().

◆ SetTracingHandle()

VOID FxWmiProvider::SetTracingHandle ( __in ULONGLONG  TracingHandle)
inline

Definition at line 164 of file fxwmiprovider.hpp.

167 {
168 m_TracingHandle = TracingHandle;
169 }

Member Data Documentation

◆ 

union { ... } FxWmiProvider::@4819

◆ EventOnly

ULONG FxWmiProvider::EventOnly

Definition at line 280 of file fxwmiprovider.hpp.

◆ Expensive

ULONG FxWmiProvider::Expensive

Definition at line 281 of file fxwmiprovider.hpp.

◆ FxWmiIrpHandler

friend FxWmiProvider::FxWmiIrpHandler
private

Definition at line 75 of file fxwmiprovider.hpp.

◆ m_DataBlockControlEnabled

BOOLEAN FxWmiProvider::m_DataBlockControlEnabled
protected

Definition at line 290 of file fxwmiprovider.hpp.

Referenced by FxWmiProvider(), and IsEnabled().

◆ m_EventControlEnabled

BOOLEAN FxWmiProvider::m_EventControlEnabled
protected

Definition at line 288 of file fxwmiprovider.hpp.

Referenced by FxWmiProvider(), and IsEnabled().

◆ m_Flags

ULONG FxWmiProvider::m_Flags

◆ 

struct { ... } FxWmiProvider::m_FlagsByName

◆ m_FunctionControl

FxWmiProviderFunctionControlCallback FxWmiProvider::m_FunctionControl
protected

Definition at line 286 of file fxwmiprovider.hpp.

Referenced by FunctionControl(), FxWmiProvider(), and IsFunctionControlSupported().

◆ m_Guid

GUID FxWmiProvider::m_Guid
protected

◆ m_InstanceListHead

LIST_ENTRY FxWmiProvider::m_InstanceListHead
protected

◆ m_ListEntry

LIST_ENTRY FxWmiProvider::m_ListEntry
protected

◆ m_MinInstanceBufferSize

ULONG FxWmiProvider::m_MinInstanceBufferSize
protected

Definition at line 268 of file fxwmiprovider.hpp.

Referenced by FxWmiProvider(), and GetMinInstanceBufferSize().

◆ m_NumInstances

◆ m_Parent

◆ m_RemoveGuid

BOOLEAN FxWmiProvider::m_RemoveGuid
protected

◆ m_TracingHandle

ULONGLONG FxWmiProvider::m_TracingHandle
protected

Definition at line 266 of file fxwmiprovider.hpp.

Referenced by FxWmiProvider(), GetTracingHandle(), and SetTracingHandle().

◆ Tracing

ULONG FxWmiProvider::Tracing

Definition at line 282 of file fxwmiprovider.hpp.


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