HLE: registry lookups through kernelbase.dll miss the emulated ConsoleMode key #2140

Open
opened 2026-11-26 04:55:50 +00:00 by github-bot · 1 comment
Owner

@⁠BastienRodz on GitHub · 2026-11-25 05:54 UTC · original

What happens

The emulated HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM\ConsoleMode value (xsystem::device_type, 0x64 for Series X, 0x60 for Series S) is only reached when the title binds RegOpenKeyExW / RegQueryValueExW / RegCloseKey through advapi32.dll or an api-ms-win-core-registry-* import. device_type::module() lists:

dlls: &["advapi32.dll", "api-ms-win-core-registry-*"],

kernelbase.dll is missing, while the host policy lets kernelbase.dll through (host.rs) and kernel::module() / files::module() both list it next to their API sets.

That matters for lookups by name. GetProcAddress on a host module goes through kernel::host_override, which asks the registry with the host module's file name. On Windows the registry API set (LoadLibraryW("api-ms-win-core-registry-l1-1-0.dll")) and GetModuleHandleW("kernelbase.dll") both give kernelbase.dll, so registry::lookup("kernelbase.dll", "RegOpenKeyExW") misses and the title gets the host's own RegOpenKeyExW. The ConsoleMode read then goes to the host registry, which has no such value: the title sees a PC instead of the chosen console. A direct import from kernelbase.dll resolves to the host the same way (HleResolver::classify returns Host).

Expected

Registry lookups through kernelbase.dll, by import or by GetProcAddress, reach the device-type overrides, as they already do through advapi32.dll and the API set name.

Where

crates/victory-hle/src/modules/xsystem.rs, device_type::module().

AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.

**@⁠BastienRodz** on GitHub · 2026-11-25 05:54 UTC · [original](https://github.com/Marvisak/VIctory/issues/2140) ### What happens The emulated `HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM\ConsoleMode` value (`xsystem::device_type`, 0x64 for Series X, 0x60 for Series S) is only reached when the title binds `RegOpenKeyExW` / `RegQueryValueExW` / `RegCloseKey` through `advapi32.dll` or an `api-ms-win-core-registry-*` import. `device_type::module()` lists: ```rust dlls: &["advapi32.dll", "api-ms-win-core-registry-*"], ``` `kernelbase.dll` is missing, while the host policy lets `kernelbase.dll` through (`host.rs`) and `kernel::module()` / `files::module()` both list it next to their API sets. That matters for lookups by name. `GetProcAddress` on a host module goes through `kernel::host_override`, which asks the registry with the host module's **file name**. On Windows the registry API set (`LoadLibraryW("api-ms-win-core-registry-l1-1-0.dll")`) and `GetModuleHandleW("kernelbase.dll")` both give `kernelbase.dll`, so `registry::lookup("kernelbase.dll", "RegOpenKeyExW")` misses and the title gets the host's own `RegOpenKeyExW`. The `ConsoleMode` read then goes to the host registry, which has no such value: the title sees a PC instead of the chosen console. A direct import from `kernelbase.dll` resolves to the host the same way (`HleResolver::classify` returns `Host`). ### Expected Registry lookups through `kernelbase.dll`, by import or by `GetProcAddress`, reach the device-type overrides, as they already do through `advapi32.dll` and the API set name. ### Where `crates/victory-hle/src/modules/xsystem.rs`, `device_type::module()`. AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:50 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:47 UTC · original

Automated triage for the maintainers.

Confirmed on main (da82e44): device_type::module() in crates/victory-hle/src/modules/xsystem.rs lists only advapi32.dll and api-ms-win-core-registry-*, while host_override in crates/victory-hle/src/modules/kernel.rs looks overrides up by the host module's file name (kernelbase.dll for the registry API set), so those lookups miss the ConsoleMode override. Open PRs addressing it: #2141, #2285, #2343.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/2140#issuecomment-7167320107) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T05:54:39Z at=2026-11-25T15:47:29Z --> Automated triage for the maintainers. Confirmed on main (da82e44): `device_type::module()` in `crates/victory-hle/src/modules/xsystem.rs` lists only `advapi32.dll` and `api-ms-win-core-registry-*`, while `host_override` in `crates/victory-hle/src/modules/kernel.rs` looks overrides up by the host module's file name (`kernelbase.dll` for the registry API set), so those lookups miss the `ConsoleMode` override. Open PRs addressing it: #2141, #2285, #2343. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#2140
No description provided.