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

Open
opened 2026-11-25 05:54:39 +00:00 by BastienRodz · 1 comment
BastienRodz commented 2026-11-25 05:54:39 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T05:54:39Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6598209049 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2140). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T05:54:39Z. --- ### 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.
Marvisak commented 2026-11-25 16:09:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:47:38Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167320107 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2140#issuecomment-7167320107). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:47:38Z. --- <!-- 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)_
Sign in to join this conversation.
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#2138
No description provided.