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`.
https://bugs.winehq.org/show_bug.cgi?id=52831
--- Comment #1 from kazwolfe root@kazwolfe.io --- Created attachment 72225 --> https://bugs.winehq.org/attachment.cgi?id=72225 The source code used to build BatteryMCVE.exe
Attaching source code of used MCVE.
https://bugs.winehq.org/show_bug.cgi?id=52831
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase Summary|Kernel32::GetSystemPowerSta |Kernel32::GetSystemPowerSta |tus Returns Invalid Data if |tus returns invalid data if |BAT0 is Missing |/sys/class/power_supply/BAT | |0 is missing
https://bugs.winehq.org/show_bug.cgi?id=52831
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexhenrie24@gmail.com Fixed by SHA1| |89ec37871f6093d8336f636dc96 | |7d79579607dd3 Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Alex Henrie alexhenrie24@gmail.com --- Fixed by https://gitlab.winehq.org/wine/wine/-/commit/89ec37871f6093d8336f636dc967d79...
Thank you for the bug report! Your test program was especially useful :-)
https://bugs.winehq.org/show_bug.cgi?id=52831
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.11.
https://bugs.winehq.org/show_bug.cgi?id=52831
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |7.0.x
https://bugs.winehq.org/show_bug.cgi?id=52831
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|7.0.x |---
--- Comment #4 from Michael Stefaniuc mstefani@winehq.org --- Removing the 7.0.x milestone from bug fixes included in 7.0.2.