HLE: reopen the emulated OEM key on a null or empty subkey #1430

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/1431 into main
fuzeofficlal commented 2026-11-24 17:58:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:58:05Z.


Fixes #765.

Summary

  • Handle null or empty ("") subkeys on the emulated oem() registry handle in xsystem::device_type::open: return ERROR_INVALID_PARAMETER (87) when out is null, otherwise write oem() and return ERROR_SUCCESS (0).

Verification

  • Added null_or_empty_subkey_reopens_the_oem_key covering RegOpenKeyW and RegOpenKeyExW with NULL / L"" subkeys, null output pointers, RegCloseKey safety on the reopened handle, and non-empty subkey FILE_NOT_FOUND.
  • cargo test --workspace, cargo clippy --workspace --all-targets --all-features, and cargo xtask policy: passed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6588131123 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1431). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:58:05Z. --- Fixes #765. ### Summary - Handle null or empty (`""`) subkeys on the emulated `oem()` registry handle in `xsystem::device_type::open`: return `ERROR_INVALID_PARAMETER` (`87`) when `out` is null, otherwise write `oem()` and return `ERROR_SUCCESS` (`0`). ### Verification - Added `null_or_empty_subkey_reopens_the_oem_key` covering `RegOpenKeyW` and `RegOpenKeyExW` with `NULL` / `L""` subkeys, null output pointers, `RegCloseKey` safety on the reopened handle, and non-empty subkey `FILE_NOT_FOUND`. - `cargo test --workspace`, `cargo clippy --workspace --all-targets --all-features`, and `cargo xtask policy`: passed.
acetonahard-code commented 2026-11-24 21:28:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T21:06:59Z.


Tested on Windows 11 with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-hle passed failed ignored
main 95 0 0
main + this PR 96 0 0
  • The new test passes.
  • cargo 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144496596 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1431#issuecomment-7144496596). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T21:06:59Z. --- Tested on Windows 11 with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 95 | 0 | 0 | | `main` + this PR | 96 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Marvisak commented 2026-11-25 04:06:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:27:26Z.


Automated triage for the maintainers.

Needs work. device_type::open in crates/victory-hle/src/modules/xsystem.rs now reopens the emulated OEM key when the subkey is null or empty, and returns 87 when the output pointer is null. This matches Microsoft's documentation for RegOpenKeyW/RegOpenKeyExW, and CI passes. However, the module comment and issue #765 both say the title only opens the full path and reads ConsoleMode, so nothing in the title reaches this path. Please show where the title, or code linked into it, reopens this key with a null or empty subkey. Without such a caller this is completeness for an unreachable case.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151931306 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1431#issuecomment-7151931306). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:27:26Z. --- <!-- victory-triage v1 head=04b68eea6043ece42b9d7cd758c9295bd39e0674 verdict=needs-work at=2026-11-25T03:28:20Z --> Automated triage for the maintainers. **Needs work.** `device_type::open` in `crates/victory-hle/src/modules/xsystem.rs` now reopens the emulated OEM key when the subkey is null or empty, and returns 87 when the output pointer is null. This matches Microsoft's documentation for `RegOpenKeyW`/`RegOpenKeyExW`, and CI passes. However, the module comment and issue #765 both say the title only opens the full path and reads `ConsoleMode`, so nothing in the title reaches this path. Please show where the title, or code linked into it, reopens this key with a null or empty subkey. Without such a caller this is completeness for an unreachable case. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 05:05:21 +00:00
fuzeofficlal commented 2026-11-25 05:06:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T04:32:48Z.


Agreed with the triage note — there is no observed caller reopening the ConsoleMode OEM handle with a null or empty subkey, so keeping device_type::open minimal is cleaner. Closing this PR.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152941604 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1431#issuecomment-7152941604). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T04:32:48Z. --- Agreed with the triage note — there is no observed caller reopening the `ConsoleMode` OEM handle with a null or empty subkey, so keeping `device_type::open` minimal is cleaner. Closing this PR.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1430
No description provided.