3#include <winpr/error.h>
4#include <winpr/sysinfo.h>
6int TestGetSystemPowerStatus(
int argc,
char* argv[])
15 if (!GetSystemPowerStatus(&status))
17 printf(
"GetSystemPowerStatus failed, error=%" PRIu32
"\n", GetLastError());
21 printf(
"SystemPowerStatus:\n");
22 printf(
"\tACLineStatus: %" PRIu8
"\n", status.ACLineStatus);
23 printf(
"\tBatteryFlag: 0x%02" PRIX8
"\n", status.BatteryFlag);
24 printf(
"\tBatteryLifePercent: %" PRIu8
"\n", status.BatteryLifePercent);
25 printf(
"\tBatteryLifeTime: %" PRIu32
"\n", status.BatteryLifeTime);
26 printf(
"\tBatteryFullLifeTime: %" PRIu32
"\n", status.BatteryFullLifeTime);
29 if ((status.BatteryLifePercent != BATTERY_PERCENTAGE_UNKNOWN) &&
30 (status.BatteryLifePercent > 100))
32 printf(
"BatteryLifePercent out of range: %" PRIu8
"\n", status.BatteryLifePercent);
mirrors the real Win32 SYSTEM_POWER_STATUS struct.