WMILIB_CONTEXT structure (wmilib.h)

The WMILIB_CONTEXT structure provides registration information for a driver's data blocks and event blocks and defines entry points for the driver's WMI library callback routines.

Syntax

typedef struct _WMILIB_CONTEXT {
  ULONG                 GuidCount;
  PWMIGUIDREGINFO       GuidList;
  PWMI_QUERY_REGINFO    QueryWmiRegInfo;
  PWMI_QUERY_DATABLOCK  QueryWmiDataBlock;
  PWMI_SET_DATABLOCK    SetWmiDataBlock;
  PWMI_SET_DATAITEM     SetWmiDataItem;
  PWMI_EXECUTE_METHOD   ExecuteWmiMethod;
  PWMI_FUNCTION_CONTROL WmiFunctionControl;
} WMILIB_CONTEXT, *PWMILIB_CONTEXT;

Members

GuidCount

Specifies the number of blocks registered by the driver.

GuidList

Pointer to an array of GuidCount WMIGUIDREGINFO structures that contain registration information for each block.

QueryWmiRegInfo

Pointer to the driver's DpWmiQueryReginfo routine, which is a required entry point for drivers that call WMI library support routines.

QueryWmiDataBlock

Pointer to the driver's DpWmiQueryDataBlock routine, which is a required entry point for drivers that call WMI library support routines.

SetWmiDataBlock

Pointer to the driver's DpWmiSetDataBlock routine, which is an optional entry point for drivers that call WMI library support routines. If the driver does not implement this routine, it must set this member to NULL. In this case, WMI returns STATUS_WMI_READ_ONLY to the caller in response to any IRP_MN_CHANGE_SINGLE_INSTANCE request.

SetWmiDataItem

Pointer to the driver's DpWmiSetDataItem routine, which is an optional entry point for drivers that call WMI library support routines. If the driver does not implement this routine, it must set this member to NULL. In this case, WMI returns STATUS_WMI_READ_ONLY to the caller in response to any IRP_MN_CHANGE_SINGLE_ITEM request.

ExecuteWmiMethod

Pointer to the driver's DpWmiExecuteMethod routine, which is an optional entry point for drivers that call WMI library support routines. If the driver does not implement this routine, it must set this member to NULL. In this case, WMI returns STATUS_INVALID_DEVICE_REQUEST to the caller in response to any IRP_MN_EXECUTE_METHOD request.

WmiFunctionControl

Pointer to the driver's DpWmiFunctionControl routine, which is an optional entry point for drivers that call WMI library support routines. If the driver does not implement this routine, it must set this member to NULL. In this case, WMI returns STATUS_SUCCESS to the caller in response to any IRP_MN_ENABLE_XXX or IRP_MN_DISABLE_XXX request.

Remarks

A driver that handles WMI IRPs by calling WMI library support routines stores an initialized WMILIB_CONTEXT structure (or a pointer to such a structure) in its device extension. A driver can use the same WMILIB_CONTEXT structure for multiple device objects if each device object supplies the same set of data blocks.

When the driver receives an IRP_MJ_SYSTEM_CONTROL request, it calls WmiSystemControl with a pointer to its WMILIB_CONTEXT structure, a pointer to its device object, and a pointer to the IRP. WmiSystemControl determines whether the IRP contains a WMI request and, if so, handles the request by calling the driver's appropriate DpWmiXxx routine.

Memory for this structure can be allocated from paged pool.

Requirements

Requirement Value
Header wmilib.h (include Wmilib.h)

See also

DpWmiExecuteMethod

DpWmiFunctionControl

DpWmiQueryDataBlock

DpWmiQueryReginfo

DpWmiSetDataBlock

DpWmiSetDataItem

WMIGUIDREGINFO

WmiSystemControl