WMI_QUERY_DATABLOCK_CALLBACK - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wmilib.h

WMI_QUERY_DATABLOCK_CALLBACK WmiQueryDatablockCallback;

NTSTATUS WmiQueryDatablockCallback(
  [in]      PDEVICE_OBJECT DeviceObject,
  [in]      PIRP Irp,
  [in]      ULONG GuidIndex,
  [in]      ULONG InstanceIndex,
  [in]      ULONG InstanceCount,
  [in, out] PULONG InstanceLengthArray,
  [in]      ULONG BufferAvail,
  [out]     PUCHAR Buffer
)
{...}
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-wmilib-wmi_query_datablock_callback)

WMI_QUERY_DATABLOCK_CALLBACK callback function

Description

The DpWmiQueryDataBlock routine returns either a single instance or all instances of a data block. This routine is required.

Parameters

DeviceObject [in]

Pointer to the driver's WDM DEVICE_OBJECT structure.

Irp [in]

Pointer to the IRP.

GuidIndex [in]

Specifies the data block by supplying a zero-based index into the list of GUIDs that the driver provided in the WMILIB_CONTEXT structure it passed to WmiSystemControl.

InstanceIndex [in]

If DpWmiQueryDataBlock is called in response to an IRP_MN_QUERY_SINGLE_INSTANCE request, InstanceIndex specifies a zero-based index that indicates the instance of the specified data block to be queried. If DpWmiQueryDataBlock is called in response to an IRP_MN_QUERY_ALL_DATA request, InstanceIndex is zero.

InstanceCount [in]

If DpWmiQueryDataBlock is called in response to an IRP_MN_QUERY_SINGLE_INSTANCE request, InstanceCount is 1. If DpWmiQueryDataBlock is called in response to an IRP_MN_QUERY_ALL_DATA request, InstanceCount is the number of instances to be returned.

InstanceLengthArray [in, out]

Pointer to a caller-supplied, InstanceCount-sized array of ULONG elements. The driver fills in each array element to indicate the length of each instance that was returned. If BufferAvail is zero, InstanceLengthArray is NULL.

BufferAvail [in]

Specifies the maximum number of bytes that are available to receive data in the buffer at Buffer. If this value is zero, the caller is requesting that the driver specify the required buffer size in its call to WmiCompleteRequest. See the Remarks section for more information.

Buffer [out]

Pointer to the buffer to receive instance data. If the buffer is large enough to receive all of the data, the driver writes the instance data to the buffer with each instance aligned on an 8-byte boundary. If the buffer is too small to receive all of the data, the driver calls WmiCompleteRequest with BufferUsed set to the size required.

Return value

DpWmiQueryDataBlock returns STATUS_SUCCESS or an error status such as the following:

If the driver cannot complete the request immediately, it can return STATUS_PENDING.

Remarks

WMI calls a driver's DpWmiQueryDataBlock routine after the driver calls WmiSystemControl in response to an IRP_MN_QUERY_SINGLE_INSTANCE or IRP_MN_QUERY_ALL_DATA request. The driver must place the address of its DpWmiQueryDataBlock routine in the WMILIB_CONTEXT structure that it passes to WmiSystemControl.

The driver is responsible for validating all input arguments. Specifically, the driver must do the following:

After writing instance data to the buffer, the driver calls WmiCompleteRequest to complete the request. If the buffer described by Buffer and BufferAvail is zero, or is too small to receive all the requested data, the call to WmiCompleteRequest must specify STATUS_BUFFER_TOO_SMALL for the Status parameter and the required buffer size for the BufferUsed parameter.

This routine can be pageable.

For more information about implementing this routine, see Calling WmiSystemControl to Handle WMI IRPs.

See also

IRP_MN_QUERY_ALL_DATA

IRP_MN_QUERY_SINGLE_INSTANCE

WMILIB_CONTEXT

WmiCompleteRequest

WmiSystemControl