BatteryClassQueryWmiDataBlock function (batclass.h)

The BatteryClassQueryWmiDataBlock routine is used by battery miniclass drivers inside their DpWmiQueryDataBlock routines to allow the battery class driver to process the WMI data block query requests it handles on behalf of the driver.

Syntax

NTSTATUS BATTERYCLASSAPI BatteryClassQueryWmiDataBlock(
  [in]            PVOID          ClassData,
  [in, out]       PDEVICE_OBJECT DeviceObject,
  [in, out]       PIRP           Irp,
  [in]            ULONG          GuidIndex,
  [out]           PULONG         InstanceLengthArray,
  [in]            ULONG          OutBufferSize,
  [out, optional] PUCHAR         Buffer
);

Parameters

[in] ClassData

Pointer to a battery class handle that was previously received from BatteryClassInitializeDevice.

[in, out] DeviceObject

Pointer to the driver's device object. The battery miniclass driver should pass the matching parameter it receives as input to its DpWmiQueryDataBlock routine.

[in, out] Irp

Pointer to the WMI query data block request. The battery miniclass driver should pass the matching parameter it receives as input to its DpWmiQueryDataBlock routine.

[in] GuidIndex

Specifies the WMI class by its index. The battery miniclass driver should pass the matching parameter it receives as input to its DpWmiQueryDataBlock routine.

[out] InstanceLengthArray

Pointer to an array of ULONG values that indicate the length of each instance to be returned. The battery miniclass driver should pass the matching parameter it receives as input to its DpWmiQueryDataBlock routine.

[in] OutBufferSize

Specifies the maximum number of bytes available to receive data in the buffer specified by the Buffer parameter. The battery miniclass driver should pass the value of the BufferAvail parameter it receives as input to its DpWmiQueryDataBlock routine.

[out, optional] Buffer

Pointer to the buffer to receive the instance data. If the buffer is too small to hold the data, BatteryClassQueryWmiDataBlock returns a status value of STATUS_BUFFER_TOO_SMALL. The battery miniclass driver should pass the matching parameter it receives as input to its DpWmiQueryDataBlock routine.

Return value

BatteryClassQueryWmiDataBlock returns an NT status code. Possible return values include:

Return code Description
STATUS_SUCCESS
The battery class driver successfully handled the request.
STATUS_BUFFER_TOO_SMALL
The battery class driver cannot handle the request because the buffer specified by the Buffer parameter is too small.
STATUS_WMI_GUID_NOT_FOUND
The battery class driver does not handle this WMI class.

Remarks

By design, a battery miniclass driver should call BatteryClassQueryWmiDataBlock inside its DpWmiQueryDataBlock routine before processing the request. The miniclass driver should pass the parameters it receives as input to its DpWmiQueryDataBlock routine. If the battery class driver returns any status other than STATUS_WMI_GUID_NOT_FOUND, the routine has handled the request on behalf of the miniclass driver. In that case, the class driver has already called WmiCompleteRequest, and miniclass driver must not call it again.

Requirements

Requirement Value
Target Platform Desktop
Header batclass.h (include Batclass.h)
Library Battc.lib

See also

BatteryClassSystemControl

DpWmiQueryDataBlock

WmiCompleteRequest