Compartilhar via


IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 (Compact 2013)

3/26/2014

This I/O control message retrieves information for the GetSystemPowerStatusEx2 system call. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to the device
    DWORD dwIoControlCode,    // use IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned,  // number of bytes returned
    OVERLAPPED lpOverlapped   // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device. To obtain a device handle, call CreateFile.
  • dwIoControlCode
    [in] Control code for the operation. Use IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 for this operation.
  • lpInBuffer
    [in] Pointer to a BOOL, fUpdate.
  • nInBufferSize
    [in] Set to sizeof(BOOL).
  • nOutBufferSize
    [in] Set to sizeof(SYSTEM_POWER_STATUS_EX2).
  • lpBytesReturned
    [out] Long pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.
  • lpOverlapped
    [in] Not supported, set to NULL.

Return Values

Returns TRUE if successful; otherwise, returns FALSE. If the value is TRUE, pdwBytesTransferred will be sizeof(SYSTEM_POWER_STATUS_EX2).

Remarks

To get extended error information, call GetLastError. GetLastError may return other standard error messages as appropriate.

For more information about the data returned by using this I/O control, see BatteryPDDGetLevels and BatteryDrvrGetLevels.

If fUpdate is set to TRUE, this IOCTL gets the latest information from the battery PDD. Otherwise, it retrieves cached information that may be out of date by several seconds. For more information, see GetSystemPowerStatusEx2 and BatteryPDDGetStatus.

To return additional battery information, such as information about an extra battery, provide a data buffer larger than SYSTEM_POWER_STATUS_EX2 in the GetSystemPowerStatusEx2 function. Any extra information must be added after the BatteryChemistry member of the SYSTEM_POWER_STATUS_EX2 structure. There must be support for this implemented in the battery driver, and the implementation of this support varies depending on the hardware platform.

Requirements

Header

battery.h

See Also

Reference

Battery Driver IOCTLs
BatteryPDDGetStatus
DeviceIoControl

Other Resources

GetSystemPowerStatusEx2
SYSTEM_POWER_STATUS_EX2