ReactOS  0.4.15-dev-1636-gf634010
fxwmiapi.cpp File Reference
#include "fxwmipch.hpp"
#include "fxwmiapi.tmh"
Include dependency graph for fxwmiapi.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) NTSTATUS WDFEXPORT(WdfWmiProviderCreate)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice)
 
 FxPointerNotNull (GetFxDriverGlobals(DriverGlobals), WmiProviderConfig)
 
 FxPointerNotNull (GetFxDriverGlobals(DriverGlobals), WmiProvider)
 
 if (pDevice->m_PkgPnp->IsPowerPolicyOwner())
 
 FxPointerNotNull (pFxDriverGlobals, InstanceConfig)
 
 if (InstanceConfig->Size !=sizeof(WDF_WMI_INSTANCE_CONFIG))
 
 if (InstanceConfig->Provider==NULL &&InstanceConfig->ProviderConfig==NULL)
 
else if (InstanceConfig->Provider !=NULL &&InstanceConfig->ProviderConfig !=NULL)
 
 if (!NT_SUCCESS(status))
 
 if (NT_SUCCESS(status) &&InstanceConfig->Register)
 
 if (NT_SUCCESS(status))
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), WmiProvider, FX_TYPE_WMI_PROVIDER,(PVOID *) &pProvider)
 
return pProvider GetDevice () -> GetHandle()
 
return pProvider IsEnabled (ProviderControl)
 
return pProvider GetTracingHandle ()
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), WmiInstance, FX_TYPE_WMI_INSTANCE,(PVOID *) &pInstance)
 
return pProvider AddInstance (pInstance)
 
pProvider RemoveInstance (pInstance)
 
return pInstance GetProvider () -> GetHandle()
 
_Must_inspect_result_ __drv_maxIRQL (APC_LEVEL) NTSTATUS WDFEXPORT(WdfWmiInstanceFireEvent)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
_Must_inspect_result_ __in WDFWMIINSTANCE __in_opt ULONG __in_bcount_opt (EventDataSize) PVOID EventData)
 

Variables

_Must_inspect_result_ __in WDFDEVICE Device
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_PROVIDER_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES ProviderAttributes
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_PROVIDER_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFWMIPROVIDER * WmiProvider
 
FxPowerPolicyOwnerSettingsownerSettings
 
FxWmiProviderpProvider = pInstance->GetProvider()
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_INSTANCE_CONFIG InstanceConfig
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_INSTANCE_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES InstanceAttributes
 
_Must_inspect_result_ __in WDFDEVICE __in PWDF_WMI_INSTANCE_CONFIG __in_opt PWDF_OBJECT_ATTRIBUTES __out_opt WDFWMIINSTANCE * Instance
 
FxWmiInstanceExternalpInstance = NULL
 
WDFWMIINSTANCE hInstance
 
NTSTATUS status
 
 pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals)
 
 else
 
WDFWMIPROVIDER hProvider = NULL
 
__in WDFWMIPROVIDER __in WDF_WMI_PROVIDER_CONTROL ProviderControl
 
_Must_inspect_result_ __in WDFWMIINSTANCE WmiInstance
 
_Must_inspect_result_ __in WDFWMIINSTANCE __in_opt ULONG EventDataSize
 

Function Documentation

◆ __drv_maxIRQL() [1/2]

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( APC_LEVEL  )

◆ __in_bcount_opt()

_Must_inspect_result_ __in WDFWMIINSTANCE __in_opt ULONG __in_bcount_opt ( EventDataSize  )

Definition at line 405 of file fxwmiapi.cpp.

422 {
425 
427  WmiInstance,
429  (PVOID*) &pInstance);
430 
432  if (!NT_SUCCESS(status)) {
433  return status;
434  }
435 
436  return pInstance->FireEvent(EventData, EventDataSize);
437 }
_Must_inspect_result_ _In_ WDFWMIINSTANCE _In_opt_ ULONG EventDataSize
Definition: wdfwmi.h:615
LONG NTSTATUS
Definition: precomp.h:26
DriverGlobals
_Must_inspect_result_ _In_ WDFWMIINSTANCE WmiInstance
Definition: wdfwmi.h:514
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS status
Definition: fxwmiapi.cpp:115
FxWmiInstanceExternal * pInstance
Definition: fxwmiapi.cpp:113
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice)
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define APC_LEVEL
Definition: env_spec_w32.h:695
_Must_inspect_result_ NTSTATUS FireEvent(__in_bcount_opt(EventBufferSize) PVOID EventBuffer, __inout ULONG EventBufferSize)
Definition: ps.c:97

◆ AddInstance()

return pProvider AddInstance ( pInstance  )

◆ FxObjectHandleGetPtr() [1/3]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
Device  ,
FX_TYPE_DEVICE  ,
(PVOID *) &  pDevice 
)

Referenced by __in_bcount_opt().

◆ FxObjectHandleGetPtr() [2/3]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
WmiProvider  ,
FX_TYPE_WMI_PROVIDER  ,
(PVOID *) &  pProvider 
)

◆ FxObjectHandleGetPtr() [3/3]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
WmiInstance  ,
FX_TYPE_WMI_INSTANCE  ,
(PVOID *) &  pInstance 
)

◆ FxPointerNotNull() [1/3]

FxPointerNotNull ( GetFxDriverGlobals(DriverGlobals ,
WmiProviderConfig   
)

◆ FxPointerNotNull() [2/3]

FxPointerNotNull ( GetFxDriverGlobals(DriverGlobals ,
WmiProvider   
)

◆ FxPointerNotNull() [3/3]

FxPointerNotNull ( pFxDriverGlobals  ,
InstanceConfig   
)

◆ GetDevice()

return pProvider GetDevice ( ) -> GetHandle()

◆ GetProvider()

return pInstance GetProvider ( ) -> GetHandle()

◆ GetTracingHandle()

return pProvider GetTracingHandle ( )

◆ if() [1/7]

if ( pDevice->m_PkgPnp->  IsPowerPolicyOwner() = FALSE)

Definition at line 69 of file fxwmiapi.cpp.

69  {
71 
72  if ((FxIsEqualGuid(&WmiProviderConfig->Guid,
73  &GUID_POWER_DEVICE_ENABLE) &&
75 
77  &GUID_POWER_DEVICE_WAKE_ENABLE) &&
79 
81  TRACINGDEVICE, "WMI Guid already registered by "
82  "framework");
84  }
85  }
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig
Definition: wdfwmi.h:356
_Must_inspect_result_ BOOLEAN __inline FxIsEqualGuid(__in CONST GUID *Lhs, __in CONST GUID *Rhs)
Definition: fxglobals.h:977
FxPowerPolicyMachine m_PowerPolicyMachine
Definition: fxpkgpnp.hpp:4153
DriverGlobals
#define STATUS_WMI_GUID_DISCONNECTED
Definition: ntstatus.h:877
FxDevice * pDevice
FxPowerPolicyOwnerSettings * m_Owner
#define TRACINGDEVICE
Definition: dbgtrace.h:58
FxWmiInstanceInternal * WmiInstance
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
FxPowerPolicyOwnerSettings * ownerSettings
Definition: fxwmiapi.cpp:53
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597

◆ if() [2/7]

Definition at line 122 of file fxwmiapi.cpp.

122  {
125  "Expected InstanceConfig Size %d, got %d, %!STATUS!",
126  InstanceConfig->Size, sizeof(*InstanceConfig),
127  status);
128  return status;
129  }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
Definition: fxwmiapi.cpp:115
pFxDriverGlobals
Definition: fxwmiapi.cpp:117
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG InstanceConfig
Definition: wdfwmi.h:474
Definition: ps.c:97

◆ if() [3/7]

if ( InstanceConfig->  Provider = NULL && InstanceConfig->ProviderConfig == NULL)

Definition at line 131 of file fxwmiapi.cpp.

132  {
134 
137  "InstanceConfig %p Provider and ProviderConfig are both NULL, only "
138  "one can be, %!STATUS!", InstanceConfig, status);
139 
140  return status;
141  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
Definition: fxwmiapi.cpp:115
pFxDriverGlobals
Definition: fxwmiapi.cpp:117
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG InstanceConfig
Definition: wdfwmi.h:474
Definition: ps.c:97

◆ if() [4/7]

if ( InstanceConfig->Provider = NULL && InstanceConfig->ProviderConfig != NULL)

Definition at line 142 of file fxwmiapi.cpp.

143  {
145 
148  "InstanceConfig %p Provider %p and ProviderConfig %p are both not "
149  "NULL, only one can be, %!STATUS!", InstanceConfig,
150  InstanceConfig->Provider, InstanceConfig->ProviderConfig, status);
151 
152  return status;
153  }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TRACINGDEVICE
Definition: dbgtrace.h:58
NTSTATUS status
Definition: fxwmiapi.cpp:115
pFxDriverGlobals
Definition: fxwmiapi.cpp:117
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG InstanceConfig
Definition: wdfwmi.h:474
Definition: ps.c:97

◆ if() [5/7]

if ( NT_SUCCESSstatus)

Definition at line 204 of file fxwmiapi.cpp.

204  {
205  return status;
206  }
NTSTATUS status
Definition: fxwmiapi.cpp:115

◆ if() [6/7]

if ( NT_SUCCESS(status) &&InstanceConfig->  Register)

Definition at line 221 of file fxwmiapi.cpp.

221  {
223  }
FxWmiProvider * pProvider
Definition: fxwmiapi.cpp:54
FxWmiInstanceExternal * pInstance
Definition: fxwmiapi.cpp:113
_Must_inspect_result_ NTSTATUS AddInstance(__in FxWmiInstance *Instance, __in BOOLEAN NoErrorIfPresent=FALSE)
Definition: ps.c:97

◆ if() [7/7]

if ( NT_SUCCESS(status )

Definition at line 225 of file fxwmiapi.cpp.

225  {
226  if (Instance != NULL) {
227  *Instance = hInstance;
228  }
229  }
WDFWMIINSTANCE hInstance
Definition: fxwmiapi.cpp:114
#define NULL
Definition: types.h:112
IN PVOID Instance
Definition: pci.h:361

◆ IsEnabled()

◆ RemoveInstance()

pProvider RemoveInstance ( pInstance  )

Variable Documentation

◆ Device

Definition at line 43 of file fxwmiapi.cpp.

◆ else

else
Initial value:
{
FxDevice * pDevice

Definition at line 162 of file fxwmiapi.cpp.

◆ EventDataSize

Definition at line 402 of file fxwmiapi.cpp.

◆ hInstance

WDFWMIINSTANCE hInstance

Definition at line 114 of file fxwmiapi.cpp.

Referenced by if().

◆ hProvider

hProvider = NULL

◆ Instance

◆ InstanceAttributes

◆ InstanceConfig

◆ ownerSettings

FxPowerPolicyOwnerSettings * ownerSettings

Definition at line 53 of file fxwmiapi.cpp.

Referenced by if().

◆ pFxDriverGlobals

pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals)

Definition at line 117 of file fxwmiapi.cpp.

Referenced by if().

◆ pInstance

◆ pProvider

◆ ProviderAttributes

◆ ProviderControl

Initial value:
{
FxWmiProvider * pProvider
Definition: fxwmiapi.cpp:54

Definition at line 282 of file fxwmiapi.cpp.

◆ status

Initial value:
InstanceConfig->ProviderConfig,
FxWmiProvider * pProvider
Definition: fxwmiapi.cpp:54
WDFWMIPROVIDER hProvider
Definition: fxwmiapi.cpp:165
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
pFxDriverGlobals
Definition: fxwmiapi.cpp:117
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG InstanceConfig
Definition: wdfwmi.h:474
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)

Definition at line 115 of file fxwmiapi.cpp.

Referenced by __in_bcount_opt(), and if().

◆ WmiInstance

Initial value:

Definition at line 321 of file fxwmiapi.cpp.

◆ WmiProvider

__in WDFWMIPROVIDER WmiProvider
Initial value:
{
FxDevice * pDevice

Definition at line 51 of file fxwmiapi.cpp.

◆ WmiProviderConfig