HLE: reach the ConsoleMode overrides through kernelbase.dll #2283

Closed
Calvix2k wants to merge 1 commit from upstream-pr/2285 into main
Calvix2k commented 2026-11-25 09:48:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T09:48:14Z.


Fixes #2140.

Problem

The emulated HKLM\…\OEM\ConsoleMode value is served by device_type's registry functions, listed only for advapi32.dll and api-ms-win-core-registry-*. On Windows the registry API set loads as kernelbase.dll, and the host policy lets kernelbase.dll through, so a title that imports the registry calls from that DLL (or reaches them through GetProcAddress on it) got the host's functions: the read went to the host registry, which has no ConsoleMode, and the title saw a PC instead of the chosen console.

Change

device_type::module lists kernelbase.dll next to the API set, as kernel and files already do.

Verification

New the_console_mode_lookups_are_reached_through_kernelbase: an HleResolver with HostPolicy::none() classifies RegOpenKeyExW, RegQueryValueExW and RegCloseKey as Hle from kernelbase.dll, advapi32.dll and api-ms-win-core-registry-l1-1-0.dll.

  • With the change: passes.
  • Without the kernelbase.dll entry (checked by removing it locally): fails on kernelbase.dll!RegOpenKeyExW (None vs Some(Hle)), so the test catches exactly this.

cargo test -p victory-hle: 144 lib tests pass; clippy -D warnings clean; cargo xtask policy 1 file ok. No game data.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6601683233 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T09:48:14Z. --- Fixes #2140. ## Problem The emulated `HKLM\…\OEM\ConsoleMode` value is served by `device_type`'s registry functions, listed only for `advapi32.dll` and `api-ms-win-core-registry-*`. On Windows the registry API set loads as `kernelbase.dll`, and the host policy lets `kernelbase.dll` through, so a title that imports the registry calls from that DLL (or reaches them through `GetProcAddress` on it) got the host's functions: the read went to the host registry, which has no `ConsoleMode`, and the title saw a PC instead of the chosen console. ## Change `device_type::module` lists `kernelbase.dll` next to the API set, as `kernel` and `files` already do. ## Verification New `the_console_mode_lookups_are_reached_through_kernelbase`: an `HleResolver` with `HostPolicy::none()` classifies `RegOpenKeyExW`, `RegQueryValueExW` and `RegCloseKey` as `Hle` from `kernelbase.dll`, `advapi32.dll` and `api-ms-win-core-registry-l1-1-0.dll`. - With the change: passes. - Without the `kernelbase.dll` entry (checked by removing it locally): fails on `kernelbase.dll!RegOpenKeyExW` (`None` vs `Some(Hle)`), so the test catches exactly this. `cargo test -p victory-hle`: 144 lib tests pass; clippy `-D warnings` clean; `cargo xtask policy` 1 file ok. No game data.
DenRakEiw commented 2026-11-25 10:07:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:02:43Z.

Review: APPROVED


Verified against origin/main (940d32f):

  • Adding kernelbase.dll to device_type::module() ensures RegOpenKey* / RegQueryValueExW / RegCloseKey imports resolved through kernelbase.dll still hit the ConsoleMode overrides.
  • cargo test -p victory-hle xsystem: 5/5 passed (including the_console_mode_lookups_are_reached_through_kernelbase).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6055466669 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285#pullrequestreview-6055466669). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T10:02:43Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`): - Adding `kernelbase.dll` to `device_type::module()` ensures `RegOpenKey*` / `RegQueryValueExW` / `RegCloseKey` imports resolved through `kernelbase.dll` still hit the `ConsoleMode` overrides. - `cargo test -p victory-hle xsystem`: 5/5 passed (including `the_console_mode_lookups_are_reached_through_kernelbase`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 11:04:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:06Z.

Review: COMMENTED


HLE: ConsoleMode registry overrides reachable through kernelbase.dll (API set name titles may import by). 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. Includes a PE-import-level test — good coverage for the shim path.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055711191 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285#pullrequestreview-6055711191). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:19:06Z. **Review:** COMMENTED --- HLE: ConsoleMode registry overrides reachable through kernelbase.dll (API set name titles may import by). 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. Includes a PE-import-level test — good coverage for the shim path.
Marvisak commented 2026-11-25 14:07:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:33:39Z.


Automated triage for the maintainers.

Proposed close: duplicate of #2141. This PR adds kernelbase.dll to device_type::module().dlls in crates/victory-hle/src/modules/xsystem.rs so the ConsoleMode registry overrides are reached through that DLL. The change is correct, but #2141 (opened earlier, also "Fixes #2140", merges cleanly, CI passing) makes the identical one-line change, and its test goes further: besides HleResolver::classify, it checks that GetProcAddress on kernelbase.dll and on the registry API set returns our functions and reads the chosen ConsoleMode through them. CI (check) passes here too. If something in this PR is not covered by #2141, a review comment there would be the best place for it.

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


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163953884 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285#issuecomment-7163953884). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:33:39Z. --- <!-- victory-triage v1 head=5ff13a057ce62e65c0f540f3f5f0c7b994bca797 verdict=proposed-close at=2026-11-25T13:54:00Z --> Automated triage for the maintainers. **Proposed close: duplicate of #2141.** This PR adds `kernelbase.dll` to `device_type::module().dlls` in `crates/victory-hle/src/modules/xsystem.rs` so the ConsoleMode registry overrides are reached through that DLL. The change is correct, but #2141 (opened earlier, also "Fixes #2140", merges cleanly, CI passing) makes the identical one-line change, and its test goes further: besides `HleResolver::classify`, it checks that `GetProcAddress` on `kernelbase.dll` and on the registry API set returns our functions and reads the chosen ConsoleMode through them. CI (`check`) passes here too. If something in this PR is not covered by #2141, a review comment there would be the best place for it. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
Calvix2k commented 2026-11-25 16:09:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T16:09:15Z.


Closing as a duplicate of the earlier #2141, as the triage proposes: the identical one-line change, with a test that goes further (GetProcAddress through the API set too). No objection to #2141 going in.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167640123 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285#issuecomment-7167640123). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T16:09:15Z. --- Closing as a duplicate of the earlier #2141, as the triage proposes: the identical one-line change, with a test that goes further (GetProcAddress through the API set too). No objection to #2141 going in.
upstream-sync closed this pull request 2026-11-25 17:03:50 +00:00
Calvix2k commented 2026-11-25 17:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T16:28:54Z.


Closing as a duplicate of the earlier #2141, as the triage proposes: the identical one-line change, with a test that goes further (GetProcAddress through the API set too). No objection to #2141 going in.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168049526 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2285#issuecomment-7168049526). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T16:28:54Z. --- Closing as a duplicate of the earlier #2141, as the triage proposes: the identical one-line change, with a test that goes further (`GetProcAddress` through the API set too). No objection to #2141 going in.

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!2283
No description provided.