EvtWmiInstanceQueryInstance

A driver's EvtWmiInstanceQueryInstance callback function copies a WMI provider's instance data into a buffer for delivery to a WMI client.

语法

EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE EvtWmiInstanceQueryInstance;

NTSTATUS EvtWmiInstanceQueryInstance(
  __in   WDFWMIINSTANCE WmiInstance,
  __in   ULONG OutBufferSize,
  __in   PVOID OutBuffer,
  __out  PULONG BufferUsed
)
{ ... }

参数

WmiInstance [in]

A handle to a WMI instance object.

OutBufferSize [in]

The size, in bytes, of the output buffer that OutBuffer points to.

OutBuffer [in]

A pointer to the output buffer.

BufferUsed [out]

A pointer to a location that receives the number of bytes that the driver places in the output buffer. If the output buffer size that the OutBufferSize parameter specifies is too small, the driver sets this location to the required buffer size.

返回值

The EvtWmiInstanceQueryInstance callback function must return STATUS_BUFFER_TOO_SMALL, if the value of the OutBufferSize parameter indicates that the output buffer is too small to receive the data. Otherwise, the callback function must copy data into the buffer and return STATUS_SUCCESS.

评论

To register an EvtWmiInstanceQueryInstance callback function, your driver must place the function's address in a WDF_WMI_INSTANCE_CONFIG structure before calling WdfWmiInstanceCreate.

Before the framework sends the driver-supplied instance data to the WMI client, it adds all of the necessary WMI header information to the data.

If your driver sets the UseContextForQuery member of the WMI instance object's WDF_WMI_INSTANCE_CONFIG structure to TRUE for a read-only data block, the driver does not provide an EvtWmiInstanceQueryInstance callback function.

If your driver must provide string data to a WMI client, the driver should call the WDF_WMI_BUFFER_APPEND_STRING function to format the string.

For more information about the EvtWmiInstanceQueryInstance callback function, see Supporting Read/Write WMI Data Blocks and Supporting Read-Only WMI Data Blocks.

The framework does not synchronize calls to a driver's WMI event callback functions with each other or with any of the driver's other event callback functions. If an EvtWmiInstanceQueryInstance callback function's data is dynamic and shared with other callback functions, your driver can use the framework's wait locks or spin locks to synchronize access to the data.

For more information about WMI, see Supporting WMI in Framework-Based Drivers.

示例

The function type is declared in WdfWMI.h, as follows.

typedef NTSTATUS
  (EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE)(
    IN WDFWMIINSTANCE  WmiInstance,
    IN ULONG  OutBufferSize,
    IN PVOID  OutBuffer,
    OUT PULONG  BufferUsed
    );

To define an EvtWmiInstanceQueryInstance callback function that is named MyWmiInstanceQueryInstance, you must first provide a function declaration that SDV and other verification tools require, as follows:

EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE  MyWmiInstanceQueryInstance;

Then, implement your callback function as follows:

NTSTATUS
 MyWmiInstanceQueryInstance (
    IN WDFWMIINSTANCE  WmiInstance,
    IN ULONG  OutBufferSize,
    IN PVOID  OutBuffer,
    OUT PULONG  BufferUsed
    )
  {...}

要求

版本

Supported by version 1.0 and later versions of KMDF.

标头

WdfWMI.h (包括Wdf.h)

IRQL

PASSIVE_LEVEL

另请参见

EvtWmiInstanceSetInstance
EvtWmiInstanceSetItem
EvtWmiInstanceExecuteMethod
EvtWmiProviderFunctionControl
WDF_WMI_BUFFER_APPEND_STRING
WDF_WMI_INSTANCE_CONFIG
WdfWmiInstanceCreate

 

 

社区附加资源

添加
显示:
© 2015 Microsoft