HLE xsystem: reject non-null lpReserved in emulated RegQueryValueExW #3123

Closed
github-bot wants to merge 1 commit from github-bot/gh-3123 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 09:07 UTC · original
fuzeofficlal:fix/hle-xsystem-regquery-reserved → main · +47 −0 · 1 files · 1 commits · closed without merging

Summary

  • In crates/victory-hle/src/modules/xsystem.rs (device_type::RegQueryValueExW), validate reserved.is_null() at the start of the emulated oem() key path and return ERROR_INVALID_PARAMETER (87) before inspecting value names or writing output buffers (kind, size, data), matching Win32 RegQueryValueExW behavior.
  • Host-forwarded keys remain untouched and pass reserved through to advapi32.dll.
  • Added unit test device_type::tests::oem_queries_require_null_reserved verifying non-null reserved is rejected for both "ConsoleMode" and unknown value names without mutating output sentinels, while null reserved succeeds.

Verification

  • cargo test -p victory-hle --locked -- modules::xsystem::: 5 passed, 0 failed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean.
  • rustfmt --check --edition 2024 --config skip_children=true crates/victory-hle/src/modules/xsystem.rs: clean.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 09:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/3123) `fuzeofficlal:fix/hle-xsystem-regquery-reserved` → `main` · +47 −0 · 1 files · 1 commits · closed without merging ## Summary - In `crates/victory-hle/src/modules/xsystem.rs` (`device_type::RegQueryValueExW`), validate `reserved.is_null()` at the start of the emulated `oem()` key path and return `ERROR_INVALID_PARAMETER` (`87`) before inspecting value names or writing output buffers (`kind`, `size`, `data`), matching Win32 `RegQueryValueExW` behavior. - Host-forwarded keys remain untouched and pass `reserved` through to `advapi32.dll`. - Added unit test `device_type::tests::oem_queries_require_null_reserved` verifying non-null `reserved` is rejected for both `"ConsoleMode"` and unknown value names without mutating output sentinels, while null `reserved` succeeds. ## Verification - `cargo test -p victory-hle --locked -- modules::xsystem::`: 5 passed, 0 failed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings`: clean. - `rustfmt --check --edition 2024 --config skip_children=true crates/victory-hle/src/modules/xsystem.rs`: clean. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: 1 passed, 0 failed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:07:56 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 09:17 UTC · original

Automated triage for the maintainers.

Proposed close: a guard for a case that does not occur. This adds a non-null reserved check to the emulated path of device_type::RegQueryValueExW (crates/victory-hle/src/modules/xsystem.rs) and returns ERROR_INVALID_PARAMETER before the value name is read. As the module comment says, the only caller that reaches the emulated OEM key is the title reading ConsoleMode, and it passes NULL there. Every other key already goes to advapi32.dll with reserved passed through. The check order the test asserts (reserved before the value name, outputs untouched) also comes with no reference. Evidence that a title passes a non-null lpReserved here, together with the host's actual return value and check order, would change this.

CI: check passing.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3123#issuecomment-7187744112) <!-- victory-triage v1 head=06bd75795d1dd62f36d7d9f5000019e4dbce4a31 verdict=proposed-close at=2026-11-26T09:18:00Z --> Automated triage for the maintainers. **Proposed close: a guard for a case that does not occur.** This adds a non-null `reserved` check to the emulated path of `device_type::RegQueryValueExW` (`crates/victory-hle/src/modules/xsystem.rs`) and returns `ERROR_INVALID_PARAMETER` before the value name is read. As the module comment says, the only caller that reaches the emulated `OEM` key is the title reading `ConsoleMode`, and it passes `NULL` there. Every other key already goes to `advapi32.dll` with `reserved` passed through. The check order the test asserts (reserved before the value name, outputs untouched) also comes with no reference. Evidence that a title passes a non-null `lpReserved` here, together with the host's actual return value and check order, would change this. CI: `check` passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 09:27 UTC · original

Independent local verification of head 06bd757 on Windows 11, Rust 1.100.0/MSVC:

  • cargo test --locked -p victory-hle --lib modules::xsystem:: — 5 passed, 0 failed (including oem_queries_require_null_reserved and other_keys_reach_the_host).
  • git diff --check origin/main HEAD — clean.

Synthetic registry queries only; no game assets or DRM material used. AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-26 09:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3123#issuecomment-7188022729) Independent local verification of head `06bd757` on Windows 11, Rust 1.100.0/MSVC: - `cargo test --locked -p victory-hle --lib modules::xsystem::` — 5 passed, 0 failed (including `oem_queries_require_null_reserved` and `other_keys_reach_the_host`). - `git diff --check origin/main HEAD` — clean. Synthetic registry queries only; no game assets or DRM material used. AI-assisted (Hy4 flash).
github-bot closed this pull request 2026-11-26 16:28:05 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 16:27 UTC · original

Closing per triage feedback — the emulated OEM key path only serves valid NULL lpReserved callers, so this extra guard is unnecessary.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3123#issuecomment-7197669467) Closing per triage feedback — the emulated `OEM` key path only serves valid `NULL` `lpReserved` callers, so this extra guard is unnecessary.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3123
No description provided.