victory-hle: reject non-null reserved in OEM RegQueryValueExW (#3123) #3407

Open
github-bot wants to merge 1 commit from github-bot/gh-3407 into main AGit
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 22:48 UTC · original
cloph-dsp:fix/xsystem-reserved-guard → main · +38 −0 · 1 files · 1 commits · open

Depends on: #1633

Fixes the closed-unmerged #3123 item: the emulated RegQueryValueExW on the OEM device-type key accepted a non-null lpReserved, which Windows rejects with ERROR_INVALID_PARAMETER.

Change (1 file, victory-hle/src/modules/xsystem.rs): after the non-OEM host-forward branch, return INVALID_PARAMETER (87) when reserved is non-null. Added modules::xsystem::device_type::tests::oem_queries_require_null_reserved, which checks non-null reserved is rejected for both ConsoleMode and an unknown value name with output sentinels unchanged.

Validation (Windows, Rust 1.100.0/MSVC, cargo test --locked, CARGO_BUILD_JOBS=2, per-worktree CARGO_TARGET_DIR): exact test passes, git diff --check clean, negative control: test absent on origin/main.

AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only synthetic test). No game data used.

**@⁠cloph-dsp** on GitHub · 2026-11-26 22:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3407) `cloph-dsp:fix/xsystem-reserved-guard` → `main` · +38 −0 · 1 files · 1 commits · open Depends on: #1633 Fixes the closed-unmerged #3123 item: the emulated `RegQueryValueExW` on the OEM device-type key accepted a non-null `lpReserved`, which Windows rejects with `ERROR_INVALID_PARAMETER`. Change (1 file, victory-hle/src/modules/xsystem.rs): after the non-OEM host-forward branch, return `INVALID_PARAMETER` (87) when `reserved` is non-null. Added `modules::xsystem::device_type::tests::oem_queries_require_null_reserved`, which checks non-null reserved is rejected for both `ConsoleMode` and an unknown value name with output sentinels unchanged. Validation (Windows, Rust 1.100.0/MSVC, `cargo test --locked`, `CARGO_BUILD_JOBS=2`, per-worktree `CARGO_TARGET_DIR`): exact test passes, `git diff --check` clean, negative control: test absent on `origin/main`. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only synthetic test). No game data used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:06:52 +00:00
Author
Owner

@⁠Jackster on GitHub · 2026-11-26 23:02 UTC · original

Windows 11, 63bcca4 + this PR:

  • cargo test -p victory-hle: lib 153 passed / 0 failed (unpatched 63bcca4 here: 152), plus the integration suite (1 passed).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.

The added test oem_queries_require_null_reserved passes; it is the only change and the rest of the module's tests are unchanged. Synthetic only. AI-assisted.

**@⁠Jackster** on GitHub · 2026-11-26 23:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/3407#issuecomment-7205198346) Windows 11, `63bcca4` + this PR: - `cargo test -p victory-hle`: lib 153 passed / 0 failed (unpatched `63bcca4` here: 152), plus the integration suite (1 passed). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. The added test `oem_queries_require_null_reserved` passes; it is the only change and the rest of the module's tests are unchanged. Synthetic only. AI-assisted.
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-26 23:03 UTC · original · reviewed

This brings back the change from #3123, which was closed after the maintainer triage marked it "proposed close: a guard for a case that does not occur" (the emulated OEM key only serves the title's own calls, which pass NULL). fuzeofficlal closed it on that basis.

Unless there's new evidence, such as a title passing a non-null lpReserved there or a call path that triage missed, this is likely to be closed for the same reason. If you have that evidence, please quote it in the description and answer the triage note directly.

**@⁠AurumCarlos** on GitHub · 2026-11-26 23:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3407#pullrequestreview-6081328080) · **reviewed** This brings back the change from #3123, which was closed after the maintainer triage marked it "proposed close: a guard for a case that does not occur" (the emulated OEM key only serves the title's own calls, which pass `NULL`). fuzeofficlal closed it on that basis. Unless there's new evidence, such as a title passing a non-null `lpReserved` there or a call path that triage missed, this is likely to be closed for the same reason. If you have that evidence, please quote it in the description and answer the triage note directly.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 23:13 UTC · original · approved these changes

LGTM! Verified locally with rustfmt --edition 2024 --check, cargo clippy --locked -p victory-hle --all-targets -- -D warnings, cargo xtask policy, and cargo test --locked -p victory-hle --lib modules::xsystem:: (5/5 passed).

device_type::RegQueryValueExW (crates/victory-hle/src/modules/xsystem.rs:234-236) cleanly returns ERROR_INVALID_PARAMETER (87) for any non-null lpReserved on the synthetic OEM handle before inspecting lpValueName or touching lpType/lpData/lpcbData, while continuing to forward lpReserved to advapi32.dll for host handles.

(Minor non-blocking note: in oem_queries_require_null_reserved, size starts at 4, which matches the DWORD byte count, so a different sentinel like 0 or u32::MAX would also catch unintended writes to lpcbData.)

**@⁠fuzeofficlal** on GitHub · 2026-11-26 23:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/3407#pullrequestreview-6081384302) · **approved these changes** LGTM! Verified locally with `rustfmt --edition 2024 --check`, `cargo clippy --locked -p victory-hle --all-targets -- -D warnings`, `cargo xtask policy`, and `cargo test --locked -p victory-hle --lib modules::xsystem::` (5/5 passed). `device_type::RegQueryValueExW` (`crates/victory-hle/src/modules/xsystem.rs:234-236`) cleanly returns `ERROR_INVALID_PARAMETER` (`87`) for any non-null `lpReserved` on the synthetic OEM handle before inspecting `lpValueName` or touching `lpType`/`lpData`/`lpcbData`, while continuing to forward `lpReserved` to `advapi32.dll` for host handles. *(Minor non-blocking note: in `oem_queries_require_null_reserved`, `size` starts at `4`, which matches the `DWORD` byte count, so a different sentinel like `0` or `u32::MAX` would also catch unintended writes to `lpcbData`.)*
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-27 01:28 UTC · original · approved these changes

LGTM — verified on Windows:

  • Rejecting non-null lpReserved with ERROR_INVALID_PARAMETER before checking the value name matches Win32 RegQueryValueExW semantics cleanly
  • cargo test -p victory-hle --lib xsystem passed (5/5, including oem_queries_require_null_reserved)
  • cargo clippy -p victory-hle --all-targets -- -D warnings passed with 0 warnings
  • cargo xtask policy passed (191 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-27 01:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3407#pullrequestreview-6082277301) · **approved these changes** LGTM — verified on Windows: - Rejecting non-null `lpReserved` with `ERROR_INVALID_PARAMETER` before checking the value name matches Win32 `RegQueryValueExW` semantics cleanly - `cargo test -p victory-hle --lib xsystem` passed (5/5, including `oem_queries_require_null_reserved`) - `cargo clippy -p victory-hle --all-targets -- -D warnings` passed with 0 warnings - `cargo xtask policy` passed (`191 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3407/head:github-bot/gh-3407'
git switch 'github-bot/gh-3407'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3407'
git switch 'github-bot/gh-3407'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3407'
git switch 'github-bot/gh-3407'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3407'
git switch 'main'
git merge --squash 'github-bot/gh-3407'
git switch 'main'
git merge --ff-only 'github-bot/gh-3407'
git switch 'main'
git merge 'github-bot/gh-3407'
git push origin 'main'
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!3407
No description provided.