hle: return S_OK with null handle when PowerSetRequest returns ERROR_NOT_SUPPORTED #1663
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1664"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Satanyuga on 2026-11-24T20:34:29Z.
Fixes issue #727: program crashed on Windows
ERROR_NOT_SUPPORTED(0x32) fromPowerSetRequestinacquire_deferral.Changes:
map_power_set_request_error(hr, out):hr == NOT_SUPPORTED(0x8007_0032), writesnulltooutviaput()and returnsS_OK.outuntouched (COM rules).handle_power_set_request_failurecloses the request handle and delegates to the helper, passing theoutpointer — eliminates UB from uninitializedoutonS_OKreturn.acquire_deferralcalls the new helper onPowerSetRequestfailure.Tests added (all passing):
error_not_supported_returns_ok_with_null_handle— callsmap_power_set_request_error(NOT_SUPPORTED, &mut out)and assertshr == S_OK+out.is_null(), plus verifiesE_FAILleavesoutuntouched (sentinel preserved).close_deferral_safely_ignores_null_handle— verifiesclose_deferralno-ops on null handle.Verified:
cargo test -p victory-hle— 96 tests passcargo clippy -p victory-hle --all-targets -- -D warnings— 0 warnings, 0 errorsImported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:41:51Z.
Review: COMMENTED
Static review only: Windows-only code (D3D12/windows_sys/Win32/HLE) — nothing compiles or runs on macOS; source review of the diff.
PowerSetRequest failure handling: ERROR_NOT_SUPPORTED (0x8007_0032) now returns S_OK with a null handle so headless/Wine/VM titles proceed and close_deferral no-ops; other errors keep the HRESULT and leave 'out' untouched per COM rules. The handle is closed before mapping. The pure helper map_power_set_request_error makes the branch testable. Windows-only.
Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T22:10:38Z.
Heads-up: #1155 (opened about four hours earlier) also says it fixes #727, the
PowerSetRequestERROR_NOT_SUPPORTEDfailure inacquire_deferral. The two conflict indisplay.rs, so only one can land as-is.Tested on Windows 11 with the repo toolchain, merged into current
main(70564ae):cargo test -p victory-hlemainmain+ this PRcargo clippy --all-targets -- -D warnings, with and without--all-features: clean.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:23:54Z.
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1155. Same fix for #727 as #1155, but it hands the title S_OK with a null handle; #1155's non-null no-op handle is the safer form of the same idea.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed