BATTERY_QUERY_INFORMATION structure

Contains battery query information. This structure is used with the IOCTL_BATTERY_QUERY_INFORMATION control code to specify the type of information to return.

Syntax

typedef struct _BATTERY_QUERY_INFORMATION {
  ULONG                           BatteryTag;
  BATTERY_QUERY_INFORMATION_LEVEL InformationLevel;
  LONG                            AtRate;
} BATTERY_QUERY_INFORMATION, *PBATTERY_QUERY_INFORMATION;

Members

BatteryTag

The current battery tag for the battery. Only information for a battery matching the tag can be returned. Whenever this value does not match the battery's current tag, the IOCTL request will be completed with ERROR_FILE_NOT_FOUND. This indicates to the caller that the battery associated with the tag longer exists. The caller may opt to use the IOCTL_BATTERY_QUERY_TAG operation to determine the tag of the newly installed battery, if one exists. (See Battery Tags for more information.)

When a query information request is made, this value is verified. In addition, if the request is in progress while this value changes, the request is aborted with the status of ERROR_FILE_NOT_FOUND.

InformationLevel

The level of the battery information being queried. The data returned by the IOCTL depends on this value. This member can be one of the following values.

Value Meaning
BatteryDeviceName
4
Null-terminated Unicode string that contains the battery's name.
BatteryEstimatedTime
3
A ULONG that specifies the estimated battery run time, in seconds. If the rate of drain provided in the AtRate member of the BATTERY_QUERY_INFORMATION structure is zero, this calculation is based on the present rate of drain. If AtRate is nonzero, the time returned is the expected run time for the given rate. If the estimated time is unknown (for example, the battery is not discharging and the AtRate specified was zero), the return value is BATTERY_UNKNOWN_TIME. Note that this value is not very accurate on some battery systems, and may vary widely depending on present power usage, which could be affected by disk activity and other factors. There is no notification mechanism for changes in this value.
BatteryGranularityInformation
1
An array of BATTERY_REPORTING_SCALE structures, never more than four entries.
BatteryInformation
0
A BATTERY_INFORMATION structure.
BatteryManufactureDate
5
A BATTERY_MANUFACTURE_DATE structure.
BatteryManufactureName
6
Null-terminated Unicode string that specifies the name of the manufacturer of the battery.
BatterySerialNumber
8
Null-terminated Unicode string that specifies the battery's serial number.
BatteryTemperature
2
A ULONG that specifies the battery's current temperature, in 10ths of a degree Kelvin.
BatteryUniqueID
7
Null-terminated Unicode string that uniquely identifies the battery. This value can be used to track a specific battery. In the case of smart batteries, this ID would be the concatenation of the manufacturer's name, device name, date of manufacture, and a printable representation of the serial number.
This value is not intended to be displayed to the user.

AtRate

This member is used only if InformationLevel is BatteryEstimatedTime.

If this member is nonzero, it is a rate of drain that will be used to calculate the time until the battery is discharged for the BatteryEstimatedTime of an individual battery. It must be specified in mW, and must be a negative value to represent a battery discharge rate.

Remarks

Some information about batteries is optional or may be meaningless for some batteries. If the particular type of data requested is not available for the current battery, then ERROR_INVALID_FUNCTION is returned.

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Poclass.h;
Batclass.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP

See also

BATTERY_INFORMATION

BATTERY_MANUFACTURE_DATE

BATTERY_REPORTING_SCALE

IOCTL_BATTERY_QUERY_INFORMATION

IOCTL_BATTERY_QUERY_TAG