https://bugs.winehq.org/show_bug.cgi?id=52831
Bug ID: 52831 Summary: Kernel32::GetSystemPowerStatus Returns Invalid Data if BAT0 is Missing Product: Wine Version: 7.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: root@kazwolfe.io Distribution: ---
Created attachment 72224 --> https://bugs.winehq.org/attachment.cgi?id=72224 Output from Wine, MCVE binary, and relevant information.
Currently, it appears as though Kernel32's GetSystemPowerStatus behaves inconsistently on modern systems and will return garbage or invalid information.
A precursory glance into this problem seems to be rooted in dlls/ntdll/unix/system.c#L3447 and `fill_battery_state`. This function only appears to check for the existence of `/sys/class/power_supply/AC` and `/sys/class/power_supply/BAT0`, which not all systems necessarily have. For example, my test computer runs on `AC0` and `BAT1`. A Steam Deck (where this bug originally was noticed) uses `ACAD` and `BAT1`.