Repository navigation
Conversation
RegOpenKeyW and RegOpenKeyExW returned ERROR_FILE_NOT_FOUND for any path below our stand-in for HKLM\...\CurrentVersion\OEM, including a null or empty one. The documented behaviour, and the host's: RegOpenKeyW gives back the key it was passed, RegOpenKeyExW a handle to the same key. Other paths below it still are not found (it has no subkeys). Test: both functions with a null and an empty subkey, on our key and on a host key for comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a null phkResult and a subkey other than null or empty, open() returned ERROR_FILE_NOT_FOUND for our OEM key before it looked at the output pointer. The host checks the pointer first: on Windows 11 its RegOpenKeyW and RegOpenKeyExW return ERROR_INVALID_PARAMETER for a null phkResult whether the subkey is missing, empty or null. Microsoft's pages do not name the error for this case, so the test asks the host for the same calls on a host key and holds ours to the same answers. Test: nowhere_to_put_the_key_is_an_invalid_parameter, ours and the host's, for a missing, an empty and a null subkey. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent local verification (Windows, Rust 1.100.0/MSVC, head 7955705, no game data): |
Xvania7
left a comment
There was a problem hiding this comment.
Windows verification on real hardware: Windows 10 x64, Rust 1.98.1.
Checked out 7955705 into an isolated tree:
cargo test -p victory-hle device_type::tests: 4/4 passed:titles_read_the_chosen_model: okother_keys_reach_the_host: oknowhere_to_put_the_key_is_an_invalid_parameter: oka_null_or_empty_path_opens_the_key_itself: ok
cargo clippy -p victory-hle --target-dir ... -- -D warnings: 0 warnings, clean.cargo run -p xtask -- policy: clean (asset policy: 182 files ok).
Ordering the null phkResult check before the path validation accurately aligns with Win32 advapi32 behavior returning ERROR_INVALID_PARAMETER (87) across missing/null/empty subkeys. LGTM.
catminou4
left a comment
There was a problem hiding this comment.
HLE: null/empty subkey opens the emulated OEM key itself; null out-param checked first (host order). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
|
Automated triage for the maintainers. Merge candidate. As the description says, the title opens the full path, so this is API correctness rather than a visible fix. CI: Generated by Claude Code |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified against main (63bcca43) on Windows 11 — clean Win32 parity fix and ready to merge:
- Checking
out.is_null()(INVALID_PARAMETER) before path handling and returningoem()on null/empty subkey matches real WindowsRegOpenKeyExWbehavior, directly cross-checked againstSoftware\Microsoft\Windows NT\CurrentVersionin the new unit tests.
Local verification:
cargo test --locked -p victory-hle: 154/154 unit (xsystem6/6) + 2/2 integration tests passedcargo clippy --all-targets -p victory-hle -- -D warnings+cargo xtask policy(191 files ok): 0 warnings
…e emulated OEM key itself (Marvisak#765)
Fixes #765.
This carries Peppacodes' fix from the issue (branch
fix/oem-key-empty-subkey,8e9f9b3), cherry-picked unchanged onto currentmainwith their name kept on the commit, plus one commit of mine that settles the open point from the thread (a nullphkResultwith a non-empty subkey). The earlier PRs for this (#1431 and the bundle #1603) were closed without being merged, and no open PR covers it.Problem.
openincrates/victory-hle/src/modules/xsystem.rsreturnedERROR_FILE_NOT_FOUNDfor any open whose root is our emulated OEM key, including a null or empty subkey. Microsoft documents that case as opening the key itself: forRegOpenKeyW, "If this parameter is NULL or a pointer to an empty string, the function returns the same handle that was passed in"; forRegOpenKeyExW,phkResult"receives a new handle to the opened key" (the same handle for a predefined key).Change
c76edcc(Peppacodes): a null or empty subkey under the OEM key gives back the OEM key; any other subkey is still not found (the key has none).7955705(mine): the nullphkResultcheck now comes before the path check, so a non-empty subkey with nowhere to put the key returnsERROR_INVALID_PARAMETER, notERROR_FILE_NOT_FOUND. Microsoft's pages do not name the error for a nullphkResult, so the test asks the host'sadvapi32the same calls on a host key and holds ours to the host's answers. On Windows 11 (build 26200) the host returnsERROR_INVALID_PARAMETER(87) for a nullphkResultwhether the subkey is missing, empty or null.Tests (both in
device_type::tests, Windows only, like the module)a_null_or_empty_path_opens_the_key_itself(Peppacodes):RegOpenKeyWandRegOpenKeyExWwith a null and an empty subkey, on our key and on a host key for comparison.nowhere_to_put_the_key_is_an_invalid_parameter(new): a nullphkResultwith a missing, an empty and a null subkey, on our key and the host's, then a missing subkey with a realphkResultis stillERROR_FILE_NOT_FOUND.With
openas onmain, both fail:left: 2, right: 0andleft: 2, right: 87. With only Peppacodes' commit, the new test fails on the missing subkey (2, not 87). With both commits, both pass.Checked on Windows 11 x64,
main940d32f+ these two commits:cargo test -p victory-hle --locked: 145 passed, 0 failed (plus the 3 integration tests)cargo clippy --workspace --all-targets --locked -- -D warningsand the--all-featuresvariant: cleancargo xtask policy: asset policy, 182 files okrustfmt --edition 2024 --checkon the changed file: cleanNot covered: in-game behavior (the title opens the full path, as the issue says, so this does not change what it reads); a caller reopening an already-open OEM key with a null or empty subkey is exercised only by the unit test. #2285 (open) touches the same module's DLL list, not
open; the two do not overlap.No game data used. AI use: Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code