user: validate RegisterClassExA descriptor size #179

Manually merged
github merged 1 commit from gh-pr/179/head into gh-pr/179/base 2026-11-26 04:13:52 +00:00
Owner

@⁠BaggyALPHA on GitHub · 2026-11-23 19:12 UTC · original
BaggyALPHA:fix/register-class-size → main · +111 −0 · 1 files · 1 commits · merged 2026-11-23 21:08 UTC

The RegisterClassExA bridge replaces the caller's cbSize with the correct Unicode structure size before calling Windows. As a result, malformed ANSI descriptors that Windows rejects can register successfully through XCL, and the bridge reads their remaining fields before validating the declared size.

Check the caller's size before reading or converting the remaining fields. Return zero and set ERROR_INVALID_PARAMETER for an invalid size, matching native Windows. Valid descriptors retain the existing Unicode conversion.

Related to #106, item 4 (RegisterClassExA size validation).

Validation

On unchanged main (956a476bf738a098f39df4f4c8acef682e43030f), a direct native API comparison reproduced the mismatch for all five sizes: 0, 1, 79, 81, and u32::MAX (the x64 structure is 80 bytes). Windows returned zero/error 87 for each; XCL registered the class and left the last-error sentinel unchanged. Each successful registration was unregistered during the test.

After the fix:

  • cargo test --locked -p xcl --lib hle::user::tests -- --nocapture: 3 passed. Covers all five invalid sizes against native Windows, valid registration with preserved class attributes, and a short descriptor followed by an uncommitted page to check that rejection happens before reading the remaining fields.
  • cargo build --locked --workspace: passed.
  • cargo test --locked -p xcl --test e2e -- --nocapture --test-threads=1: 2 passed, as a synthetic-title smoke test.
  • git diff --check: passed.

Environment: Windows x64, Rust 1.96.0. No additional dependencies or external fixtures are required. This fixes an API contract mismatch; no affected retail title has been demonstrated. Console/retail fixtures remain unavailable, and the full workspace test suite was not run. Personal filesystem paths have been removed from the logs below.

Reference: Microsoft WNDCLASSEXA documentation.

Native comparison, regression tests, and build output
Original implementation: all five invalid sizes compared with native Windows
   Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl)
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33neqrb1skyy1\s-hofrekxoj2-0lfz5lf-working`

warning: `xcl` (lib test) generated 1 warning
    Finished `test` profile [unoptimized + debuginfo] target(s) in 11.52s
     Running unittests src\lib.rs (target\debug\deps\xcl-ad661056263beaf2.exe)

running 1 test
cbSize=0: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896
cbSize=1: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896
cbSize=79: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896
cbSize=81: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896
cbSize=4294967295: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896

thread 'hle::user::tests::register_class_rejects_invalid_sizes_like_windows' (37916) panicked at crates\xcl\src\hle\user.rs:233:17:
assertion `left == right` failed: XCL must reject cbSize=0
  left: 50200
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test hle::user::tests::register_class_rejects_invalid_sizes_like_windows ... FAILED

failures:

failures:
    hle::user::tests::register_class_rejects_invalid_sizes_like_windows

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 555 filtered out; finished in 0.00s

error: test failed, to rerun pass `-p xcl --lib`


Fixed implementation: three regression tests
   Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl)
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33neqrb1skyy1\s-hofrfafb1u-0scr1id-working`

warning: `xcl` (lib test) generated 1 warning
    Finished `test` profile [unoptimized + debuginfo] target(s) in 11.65s
     Running unittests src\lib.rs (target\debug\deps\xcl-ad661056263beaf2.exe)

running 3 tests
test hle::user::tests::register_class_checks_size_before_reading_remaining_fields ... ok
cbSize=0: Windows atom=0x0, error=87; XCL atom=0x0, error=87
cbSize=1: Windows atom=0x0, error=87; XCL atom=0x0, error=87
cbSize=79: Windows atom=0x0, error=87; XCL atom=0x0, error=87
cbSize=81: Windows atom=0x0, error=87; XCL atom=0x0, error=87
cbSize=4294967295: Windows atom=0x0, error=87; XCL atom=0x0, error=87
test hle::user::tests::register_class_accepts_valid_size_and_preserves_attributes ... ok
test hle::user::tests::register_class_rejects_invalid_sizes_like_windows ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 555 filtered out; finished in 0.00s



Workspace build
   Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl)
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33d8p3jg4g4ip\s-hofrfr5vuo-1kjm011-working`

warning: `xcl` (lib) generated 1 warning
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-2mihuwkkpe6tb\s-hofrfvlv74-0nskzbu-working`

warning: `xcl` (bin "xcl") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.33s
Synthetic-title smoke test output
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33d8p3jg4g4ip\s-hofrfr5vuo-1kjm011-working`

warning: `xcl` (lib) generated 1 warning
   Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl)
warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-2mihuwkkpe6tb\s-hofrfvlv74-0nskzbu-working`

warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\e2e-16epocv7amv0l\s-hofrfxb75k-11kal4m-working`

warning: `xcl` (bin "xcl") generated 1 warning
warning: `xcl` (test "e2e") generated 1 warning
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1.65s
     Running tests\e2e.rs (target\debug\deps\e2e-e6f852db9ead38e5.exe)

running 2 tests
test launcher_uses_configured_exe_in_an_ambiguous_folder ... ok
test test_title_runs_and_game_folder_is_untouched ... --- stdout ---
XCL 0.1.0 – starting 'XCL.TestTitle'
  exe:   <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game\xcl_testtitle.exe
  data:  <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle
  MicrosoftGame.Config: title memory Advanced, PLS 2048 MB
  console: imports kernelx.dll, xgameruntime.dll
  GPU: NVIDIA GeForce RTX 3080 (12091 MiB VRAM)
  NOTE: waves of 32–32 lanes: the console's 64-lane programs run as two 32-lane halves (slower; vertex / pixel shaders that read lanes 32–63 can differ)
  DXC: C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64
xcl_testtitle: start
[PASS] argv: command line belongs to the game
[PASS] static TLS: template on main thread
[PASS] static TLS: every new thread gets its own initialised copy
[PASS] C++-style exceptions: panic is caught (RtlPcToFileHeader)
[PASS] kernelx: GetConsoleType / XSystemGetDeviceType
[PASS] kernelx: XMemAlloc alignment + zeroing
[PASS] kernelx: XMemVirtualAlloc – graphics memory type in UMA, others from Windows
[PASS] xmem: working-set statistics, physical pages mapped and freed
[PASS] xmem: physical pages mapped into reserved address space keep their contents
[PASS] kernelx: graphics memory lives in the GPU-visible 4 GiB-aligned region (UMA)
[PASS] user32: a top-level window made either way (CreateWindowExW / A) is the hidden 1920x1080 console screen
[PASS] GameInput: GameInputCreate reaches the system GameInput (timestamps advance)
[PASS] kernelx: TitleMemoryStatus
[PASS] kernelx: SetThreadName / GetThreadName
[PASS] kernelx: unimplemented import becomes a stub and the title keeps running
[PASS] modules: GetModuleHandle(NULL) is the game image
[PASS] modules: LoadLibrary/GetProcAddress on an HLE module
[PASS] game DLL: static import + DllMain + TLS + its own kernelx import
[PASS] files: console paths G:\ and GAME: read from the game folder
[PASS] files: CRT fopen goes through the VFS too
[PASS] files: writes go to the overlay, game folder untouched
[PASS] files: delete hides the file without touching the original
[PASS] files: directory listing merges overlay and hides deleted files
[PASS] files: T:\ title scratch storage
[PASS] files: T:\ free space (the host volume behind the mount)
[PASS] XGameRuntime: initialize + package identity
[PASS] XTaskQueue: manual, delayed and thread-pool dispatch
[PASS] XUser: silent sign-in, device association, and no XSTS token offline
[PASS] XTaskQueue composite + XNetworking + advapi32legacy LSA fallback
[PASS] storage: save folder + persistent local storage
[PASS] XPersistentLocalStorage: a drive root, as on the console
[PASS] D3D12.X: queue + fence signal on the GPU
[PASS] D3D12.X: shaders captured; console shader gets a fallback PSO
[PASS] D3D12.X: retail-format console shader (XDAT/XBCH/FSSM) captured + fallback PSO
[PASS] D3D12.X: triangle rendered on the real GPU and read back (console + derived pipeline)
[PASS] D3D12.X: frame clock + PresentX of the title's back buffer
[PASS] D3D12.X: console device methods (placed title memory, DMA queue + list, page pools)
[PASS] D3D12.X: console command list memory methods (writes, timestamp, fill, copy, KickoffX, Wait32/64)
[PASS] D3D12.X: sparse VRAM buffer heaps (placed aliasing, persistent Map coherence, readback)
[PASS] D3D12.X: coherent window headroom (CUSTOM+WRITE_BACK & oversized READBACK in sparse VRAM)
[PASS] D3D12.X: async ring-buffered sparse uploads (80 MiB across 20 submits + reused-tile zeroing)
[PASS] D3D12.X: descriptor heaps still in window 0 after an 8 GiB+ graphics reservation
[PASS] D3D12.X: committed textures beyond the coherent room are created; a readback buffer still gets coherent memory
[PASS] D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94)
[PASS] D3D12.X: raytracing surface (OPTIONS5, AS SRV descriptor, #146/#148 BVH list slots)
[PASS] DirectStorage (xcrdapi): a file read into memory, status + D3D12 fence
[PASS] D3D12.X: a texture in title memory (XG layout, #44) follows CPU writes
[PASS] D3D12.X: a texture in a streaming pool gets its texels once pages are mapped in
[PASS] MFPlat: MFResetDXGIDeviceManagerX resets IMFDXGIDeviceManager with the d3d12_xs device
  (XMA2 buffer ended after 105 ms; Opus buffer ended after 105 ms)
[PASS] XAudio2: console flags/device, XMA2 & Opus voices decoded, PCM passes, callbacks
xcl_testtitle: done, failures: 0

Game exited with code 0x0 (0)
Imports: 219 (game-dll:testgame_mw.dll: 4, hle-cross:kernelx.dll: 4, hle:gameinput.dll: 1, hle:kernelx.dll: 21, hle:mfplat.dll: 1, hle:xaudio2_9.dll: 1, hle:xcrdapi.dll: 1, hle:xg_xs.dll: 1, hle:xgameruntime.dll: 24, stub: 1, system: 160)
Unimplemented functions called (2):
         1×  kernelx.dll!XclDefinitelyMissingFunction   (first call: xcl_testtitle.exe+0x34fce)
         1×  d3d12_xs.dll!ID3D12Device14::#47 (console extension)   (first call: xcl_testtitle.exe+0x61990)
Writes to game files redirected to the overlay: 5
Report: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\logs\report.json
Log:    <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\logs\xcl.log

--- stderr ---
xcl: XCL 0.1.0 – host for 'XCL.TestTitle'
xcl: game: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game\xcl_testtitle.exe (read-only folder: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game)
xcl: XCL data: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle
xcl: VFS: 30 file hooks active
xcl: loaded xcl_testtitle.exe @ 0x140000000 (size 0xfd000, preferred 0x140000000)
xcl: loaded testgame_mw.dll @ 0x180000000 (size 0x1f000, preferred 0x180000000)
xcl: VFS: CreateFileW(<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\cache) flags 0x2000000
xcl: TLS: testgame_mw.dll: template 96 B, block 96 B, index 13, threads initialized: 1
xcl: DllMain(testgame_mw.dll, PROCESS_ATTACH)
xcl: VFS: CreateFileW(<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\cache) flags 0x2000000
xcl: TLS: xcl_testtitle.exe: template 112 B, block 112 B, index 14, threads initialized: 1
xcl: TLS: xcl_testtitle.exe has slot 0 (as a process's executable); xcl.exe's own TLS is in slot 14 – 4 threads
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80
xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80
xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80
xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80
xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80
xcl: GetDiskFreeSpaceExA(\\?\<USERPROFILE>\appdata\locallow\NVIDIA\DXCache\): 267783 MiB available of 952861 MiB
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80
xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80
xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400
xcl: UMA: 3 sparse VRAM window(s) (12 GiB VA) + 512 MB coherent window at 0x400000000
xcl: D3D12.X: 3 sparse window(s) for the title's own memory (tiled buffers on video memory)
xcl: D3D12.X: UMA opened (3 sparse VRAM window(s), 512 MB coherent window), window 0 buffer at VA 0x300000000
xcl: D3D12.X: native dynamic depth bias (OPTIONS16): supported (ID3D12GraphicsCommandList9::RSSetDepthBias)
xcl: D3D12.X: ID3D12Device14 – 83 PC methods, 42 internal slots under the guard, +64 stubs (Device, PC vtable D3D12Core.dll+0x249078)
xcl: D3D12.X: backend 'real' – NVIDIA GeForce RTX 3080 (12091 MiB VRAM)
xcl: start xcl_testtitle.exe: entry point xcl_testtitle.exe+0xb7280 , stack 0x100000
xcl: C++ exception rust_panic "�@" thrown; on the stack: xcl_testtitle.exe+0xf02b0, xcl_testtitle.exe+0xf02b0, xcl_testtitle.exe+0xf02b0, VCRUNTIME140.dll+0x55f2, xcl_testtitle.exe+0x77020, xcl_testtitle.exe+0x22da4
xcl: D3D12.X: ID3D12Heap1 – 10 PC methods, 10 internal slots under the guard, +64 stubs (Heap, PC vtable D3D12Core.dll+0x247ce8)
xcl: user: the title's window 0xce0bf4 is the console's screen (1920x1080, no frame, cloaked)
xcl: user: the title's window 0x520b52 is the console's screen (1920x1080, no frame, cloaked)
xcl: GameInput: GameInputCreate – one gamepad (XInput controller / keyboard)
xcl: [STUB] kernelx.dll!XclDefinitelyMissingFunction first called from xcl_testtitle.exe+0x34fce → returning 0x0
xcl: GetProcAddress(kernelx.dll, XNoSuchApiAnywhere) → NULL (not implemented)
xcl: [VFS] write to a game file redirected to the overlay: data\hello.txt
xcl: [VFS] write to a game file redirected to the overlay: data\new_save.bin
xcl: [VFS] write to a game file redirected to the overlay: data\newdir\deeper
xcl: [VFS] write to a game file redirected to the overlay: data\renamed.bin
xcl: [VFS] write to a game file redirected to the overlay: data\delete_me.txt
xcl: GetDiskFreeSpaceExW(T:\) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\temp): 267727 MiB available of 952861 MiB
xcl: GetDiskFreeSpaceW(T:\) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\temp): 267727 MiB available of 952861 MiB
xcl: XGameRuntimeInitialize (XCL offline runtime)
xcl: XUserAddAsync(options=0x1) → local offline user 'Player1'
xcl: XUser: the local user reached the title (XUserAddResult); 0 device association callback(s)
xcl: XUser: token #0 for GET https://example.invalid/hotfix – none: no Xbox Live (0x80072EFD)
xcl: GetDiskFreeSpaceExW(<USERPROFILE>/games) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\pls\Users\xcl\games): 267784 MiB available of 952861 MiB
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: ID3D12CommandQueue – 19 PC methods, 23 internal slots under the guard, +64 stubs (CommandQueue, PC vtable D3D12Core.dll+0x24bab8)
xcl: D3D12.X: ID3D12Fence1 – 12 PC methods, 19 internal slots under the guard, +64 stubs (Fence, PC vtable D3D12Core.dll+0x2475c0)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: [SHADER] rootsig a6b4665d1ef3de87: 68 B, format dxbc, parts [RTS0]
xcl: D3D12.X: QueryInterface(0742a90b-c387-483f-b946-30a7e4e61458) – interface unknown on the PC (console-only?)
xcl: D3D12.X: ID3D12RootSignature – 8 PC methods, 17 internal slots under the guard, +64 stubs (RootSignature, PC vtable D3D12Core.dll+0x304ca0)
xcl: [SHADER] vs 59de38f958e2f013: 528 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT]
xcl: [SHADER] ps 8a5d1b6c5b50f11e: 56 B, format container-unknown, parts [XBOX]
xcl: [SHADER] 8a5d1b6c5b50f11e: RDNA2 code found – disassembly in <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\shaders\8a5d1b6c5b50f11e_ps.rdna2.txt
xcl: D3D12.X: ID3D12PipelineState – 9 PC methods, 0 internal slots under the guard, +64 stubs (PipelineState, PC vtable D3D12Core.dll+0x304d20)
xcl: D3D12.X: graphics PSO rejected by the driver (0x80004005) – fallback shaders used (#1)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: [SHADER] ps 44871e939431b2e3: 204 B, format xbox-native, parts [DXIL]
xcl: [SHADER] 44871e939431b2e3: console container PS SM 6.6, FSSM [PS], 2 RDNA2 instructions
xcl: D3D12.X: graphics PSO rejected by the driver (0x80070057) – fallback shaders used (#2)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: [SHADER] vs 04ef3b5b06edae7c: 688 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT]
xcl: [SHADER] ps 1eb6d31c9e4c3658: 452 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT]
xcl: D3D12.X: CreateDerivedPipelineStateX – unknown patch part 4
xcl: D3D12.X: video-memory arena for title addresses 0x700000000..0x708000000
xcl: D3D12.X: ID3D12Resource2 – 17 PC methods, 321 internal slots under the guard, +64 stubs (Resource, PC vtable D3D12Core.dll+0x2489d0)
xcl: D3D12.X: ID3D12DescriptorHeap – 11 PC methods, 1 internal slots under the guard, +64 stubs (DescriptorHeap, PC vtable D3D12Core.dll+0x24b838)
xcl: console buffers in UMA: Map = console address (0x700020000)
xcl: D3D12.X: ID3D12QueryHeap – 8 PC methods, 2 internal slots under the guard, +64 stubs (QueryHeap, PC vtable D3D12Core.dll+0x250898)
xcl: D3D12.X: ID3D12CommandAllocator – 9 PC methods, 246 internal slots under the guard, +64 stubs (CommandAllocator, PC vtable D3D12Core.dll+0x248c68)
xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (CommandList, PC vtable D3D12Core.dll+0x305830)
xcl: D3D12.X: nested occlusion query – the outer one ends there and reports visible, the inner one counts
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: frame interval 16667 µs (periodicity 1, flags 0x0)
xcl: D3D12.X: PresentX – the title presents its own frames (1 plane(s))
xcl: XCL window created (1280x720)
xcl: keyboard and mouse play as the gamepad (WASD left stick, mouse right stick, mouse buttons triggers, wheel bumpers)
xcl: D3D12.X: QueryInterface(54ec77fa-1377-44e6-8c32-88fd5f44c84c) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(b898d4fd-b5b3-4ffc-8694-0259864ffcf8) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(db6f6ddb-ac77-4e88-8253-819df9bbf140) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(9b7e4a00-342c-4106-a19f-4f2704f689f0) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(85611e73-70a9-490e-9614-a9e302777904) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(a2a9f815-4778-40d1-b179-d5d3a1a5f1bc) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(79cf2233-7536-4948-9d36-1e4692dc5760) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(cbe8c719-71a3-40ed-a3ad-a05161dcb833) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(433be922-0f1b-4078-850c-16630f94406f) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(0adf7d52-929c-4e61-addb-ffed30de66ef) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(aec22fb8-76f3-4639-9be0-28eb43a67a2e) – interface unknown on the PC (console-only?)
xcl: D3D12.X: QueryInterface(ffffffff-1bbe-4d12-afbf-8fdf7e0a87c7) – interface unknown on the PC (console-only?)
xcl: present: swap chain 640x360 DXGI_FORMAT(28) – the game image will appear in the XCL window
xcl: present: first game frame shown (640x360)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (CommandList, PC vtable D3D12Core.dll+0x306040)
xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (DmaList, PC vtable D3D12Core.dll+0x306040)
xcl: [STUB] d3d12_xs.dll!ID3D12Device14::#47 (console extension) first called from xcl_testtitle.exe+0x61990 → returning 0x0
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: heap 0x20828931a70 (0x40000 bytes) holds buffers: in sparse VRAM at 0x420010000
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: heap 0x2082892f030 (0x100000 bytes) holds buffers: in sparse VRAM at 0x420110000
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: sparse windows: 16 submits, 159 MB of CPU writes uploaded, 105 ms spent, 1280 tiles mapped
xcl: sparse windows timing: write-watch 6 ms (3098 dirty pages), lock wait 0 ms, chunk scan 45 ms, upload 59 ms (2371 runs)
xcl: sparse windows: 32 submits, 223 MB of CPU writes uploaded, 328 ms spent, 1280 tiles mapped
xcl: sparse windows timing: write-watch 8 ms (19482 dirty pages), lock wait 0 ms, chunk scan 262 ms, upload 66 ms (2387 runs)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: console descriptor heaps: one shader-visible PC heap of 1000000 view descriptors for all of them
xcl: console descriptor heap 0x207a0eb86b0: 442368 view slots at sparse VRAM 0x10000, shader visible
xcl: console descriptor heap 0x207a0eb8910: 512 sampler slots at sparse VRAM 0x10000, shader visible
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: [SHADER] vs a4b1ee9aee1ae591: 688 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT]
xcl: D3D12.X: CreatePlacedResourceX at 0x700120000 (dimension 3 64x64 format 28 flags 0x1) – aliases an earlier resource there (dimension 3 512x512 format 28 flags 0x0)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: CheckFeatureSupport(D3D12_OPTIONS5) → RaytracingTier 12 (host 12)
xcl: D3D12.X: CheckFeatureSupport(27) with the console's 16 bytes, the PC's 12 → 0x0
xcl: console descriptor heap 0x207a0eb8f00: 2 view slots at sparse VRAM 0x10000, shader visible
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: DirectStorage: request #0: options 0x0 (file source), destination 0x20827bcdf10 (512 bytes, page offset 0), source size 512, intermediate 0
xcl: DirectStorage: request #1: options 0x200000 (file source), destination 0x937d5fedb8 (physical pages) (512 bytes, page offset 128), source size 512, intermediate 0
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: CreatePlacedResourceX at 0x420010000 (dimension 3 80x40 format 28 flags 0x0) – aliases an earlier resource there (dimension 1 65536x1 format 0 flags 0x0)
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: D3D12.X: device 0x207a0c3d940 for the title
xcl: mfplat: MFResetDXGIDeviceManagerX bridged ResetDevice failed: 0x80070057 (direct was 0x80070057)
xcl: XAudio2: XAudio2Create – dropping console flags 0x41
xcl: XAudio2: engine created (system XAudio2 2.9, flags 0x0)
xcl: XAudio2: CreateMasteringVoice – dropping console flags 0x4
xcl: XAudio2: CreateMasteringVoice – console device id ignored (default device)
xcl: XAudio2: COM was not initialized on the title thread – CoInitializeEx(MTA) → 0x0
xcl: XAudio2: XMA2 voice (1 ch., 48000 Hz) → real PCM16 decoding via hle::xma2
xcl: XAudio2: Opus voice (1 ch., 48000 Hz) → real PCM16 decoding via MSOpusDecoder
xcl: process ends (thread 34476); on the stack: xcl_testtitle.exe+0xbd5a6, xcl_testtitle.exe+0xa6660, xcl_testtitle.exe+0xbd5a7, xcl_testtitle.exe+0xa667e, xcl_testtitle.exe+0xd12b8, xcl_testtitle.exe+0xce338, xcl_testtitle.exe+0x9a013, xcl_testtitle.exe+0xbea48, xcl_testtitle.exe+0x9f83b, xcl_testtitle.exe+0xf01c8, xcl_testtitle.exe+0xa2150, xcl_testtitle.exe+0xcfaa8, xcl_testtitle.exe+0xcfed0, xcl_testtitle.exe+0xa0a59, xcl_testtitle.exe+0xd0648, xcl_testtitle.exe+0xf0050

ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 12.74s
**@⁠BaggyALPHA** on GitHub · 2026-11-23 19:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/179) `BaggyALPHA:fix/register-class-size` → `main` · +111 −0 · 1 files · 1 commits · merged 2026-11-23 21:08 UTC The `RegisterClassExA` bridge replaces the caller's `cbSize` with the correct Unicode structure size before calling Windows. As a result, malformed ANSI descriptors that Windows rejects can register successfully through XCL, and the bridge reads their remaining fields before validating the declared size. Check the caller's size before reading or converting the remaining fields. Return zero and set `ERROR_INVALID_PARAMETER` for an invalid size, matching native Windows. Valid descriptors retain the existing Unicode conversion. Related to #106, item 4 (`RegisterClassExA` size validation). ### Validation On unchanged main (`956a476bf738a098f39df4f4c8acef682e43030f`), a direct native API comparison reproduced the mismatch for all five sizes: 0, 1, 79, 81, and `u32::MAX` (the x64 structure is 80 bytes). Windows returned zero/error 87 for each; XCL registered the class and left the last-error sentinel unchanged. Each successful registration was unregistered during the test. After the fix: - `cargo test --locked -p xcl --lib hle::user::tests -- --nocapture`: **3 passed**. Covers all five invalid sizes against native Windows, valid registration with preserved class attributes, and a short descriptor followed by an uncommitted page to check that rejection happens before reading the remaining fields. - `cargo build --locked --workspace`: **passed**. - `cargo test --locked -p xcl --test e2e -- --nocapture --test-threads=1`: **2 passed**, as a synthetic-title smoke test. - `git diff --check`: **passed**. Environment: Windows x64, Rust 1.96.0. No additional dependencies or external fixtures are required. This fixes an API contract mismatch; no affected retail title has been demonstrated. Console/retail fixtures remain unavailable, and the full workspace test suite was not run. Personal filesystem paths have been removed from the logs below. Reference: [Microsoft WNDCLASSEXA documentation](https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexa). <details> <summary>Native comparison, regression tests, and build output</summary> ```text Original implementation: all five invalid sizes compared with native Windows Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl) warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33neqrb1skyy1\s-hofrekxoj2-0lfz5lf-working` warning: `xcl` (lib test) generated 1 warning Finished `test` profile [unoptimized + debuginfo] target(s) in 11.52s Running unittests src\lib.rs (target\debug\deps\xcl-ad661056263beaf2.exe) running 1 test cbSize=0: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896 cbSize=1: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896 cbSize=79: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896 cbSize=81: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896 cbSize=4294967295: Windows atom=0x0, error=87; XCL atom=0xc418, error=305419896 thread 'hle::user::tests::register_class_rejects_invalid_sizes_like_windows' (37916) panicked at crates\xcl\src\hle\user.rs:233:17: assertion `left == right` failed: XCL must reject cbSize=0 left: 50200 right: 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace test hle::user::tests::register_class_rejects_invalid_sizes_like_windows ... FAILED failures: failures: hle::user::tests::register_class_rejects_invalid_sizes_like_windows test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 555 filtered out; finished in 0.00s error: test failed, to rerun pass `-p xcl --lib` Fixed implementation: three regression tests Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl) warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33neqrb1skyy1\s-hofrfafb1u-0scr1id-working` warning: `xcl` (lib test) generated 1 warning Finished `test` profile [unoptimized + debuginfo] target(s) in 11.65s Running unittests src\lib.rs (target\debug\deps\xcl-ad661056263beaf2.exe) running 3 tests test hle::user::tests::register_class_checks_size_before_reading_remaining_fields ... ok cbSize=0: Windows atom=0x0, error=87; XCL atom=0x0, error=87 cbSize=1: Windows atom=0x0, error=87; XCL atom=0x0, error=87 cbSize=79: Windows atom=0x0, error=87; XCL atom=0x0, error=87 cbSize=81: Windows atom=0x0, error=87; XCL atom=0x0, error=87 cbSize=4294967295: Windows atom=0x0, error=87; XCL atom=0x0, error=87 test hle::user::tests::register_class_accepts_valid_size_and_preserves_attributes ... ok test hle::user::tests::register_class_rejects_invalid_sizes_like_windows ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 555 filtered out; finished in 0.00s Workspace build Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl) warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33d8p3jg4g4ip\s-hofrfr5vuo-1kjm011-working` warning: `xcl` (lib) generated 1 warning warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-2mihuwkkpe6tb\s-hofrfvlv74-0nskzbu-working` warning: `xcl` (bin "xcl") generated 1 warning Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.33s ``` </details> <details> <summary>Synthetic-title smoke test output</summary> ```text warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-33d8p3jg4g4ip\s-hofrfr5vuo-1kjm011-working` warning: `xcl` (lib) generated 1 warning Compiling xcl v0.1.0 (<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl) warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\xcl-2mihuwkkpe6tb\s-hofrfvlv74-0nskzbu-working` warning: hard linking files in the incremental compilation cache failed. copying files instead. consider moving the cache directory to a file system which supports hard linking in session dir `\\?\<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\debug\incremental\e2e-16epocv7amv0l\s-hofrfxb75k-11kal4m-working` warning: `xcl` (bin "xcl") generated 1 warning warning: `xcl` (test "e2e") generated 1 warning Finished `test` profile [unoptimized + debuginfo] target(s) in 1.65s Running tests\e2e.rs (target\debug\deps\e2e-e6f852db9ead38e5.exe) running 2 tests test launcher_uses_configured_exe_in_an_ambiguous_folder ... ok test test_title_runs_and_game_folder_is_untouched ... --- stdout --- XCL 0.1.0 – starting 'XCL.TestTitle' exe: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game\xcl_testtitle.exe data: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle MicrosoftGame.Config: title memory Advanced, PLS 2048 MB console: imports kernelx.dll, xgameruntime.dll GPU: NVIDIA GeForce RTX 3080 (12091 MiB VRAM) NOTE: waves of 32–32 lanes: the console's 64-lane programs run as two 32-lane halves (slower; vertex / pixel shaders that read lanes 32–63 can differ) DXC: C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64 xcl_testtitle: start [PASS] argv: command line belongs to the game [PASS] static TLS: template on main thread [PASS] static TLS: every new thread gets its own initialised copy [PASS] C++-style exceptions: panic is caught (RtlPcToFileHeader) [PASS] kernelx: GetConsoleType / XSystemGetDeviceType [PASS] kernelx: XMemAlloc alignment + zeroing [PASS] kernelx: XMemVirtualAlloc – graphics memory type in UMA, others from Windows [PASS] xmem: working-set statistics, physical pages mapped and freed [PASS] xmem: physical pages mapped into reserved address space keep their contents [PASS] kernelx: graphics memory lives in the GPU-visible 4 GiB-aligned region (UMA) [PASS] user32: a top-level window made either way (CreateWindowExW / A) is the hidden 1920x1080 console screen [PASS] GameInput: GameInputCreate reaches the system GameInput (timestamps advance) [PASS] kernelx: TitleMemoryStatus [PASS] kernelx: SetThreadName / GetThreadName [PASS] kernelx: unimplemented import becomes a stub and the title keeps running [PASS] modules: GetModuleHandle(NULL) is the game image [PASS] modules: LoadLibrary/GetProcAddress on an HLE module [PASS] game DLL: static import + DllMain + TLS + its own kernelx import [PASS] files: console paths G:\ and GAME: read from the game folder [PASS] files: CRT fopen goes through the VFS too [PASS] files: writes go to the overlay, game folder untouched [PASS] files: delete hides the file without touching the original [PASS] files: directory listing merges overlay and hides deleted files [PASS] files: T:\ title scratch storage [PASS] files: T:\ free space (the host volume behind the mount) [PASS] XGameRuntime: initialize + package identity [PASS] XTaskQueue: manual, delayed and thread-pool dispatch [PASS] XUser: silent sign-in, device association, and no XSTS token offline [PASS] XTaskQueue composite + XNetworking + advapi32legacy LSA fallback [PASS] storage: save folder + persistent local storage [PASS] XPersistentLocalStorage: a drive root, as on the console [PASS] D3D12.X: queue + fence signal on the GPU [PASS] D3D12.X: shaders captured; console shader gets a fallback PSO [PASS] D3D12.X: retail-format console shader (XDAT/XBCH/FSSM) captured + fallback PSO [PASS] D3D12.X: triangle rendered on the real GPU and read back (console + derived pipeline) [PASS] D3D12.X: frame clock + PresentX of the title's back buffer [PASS] D3D12.X: console device methods (placed title memory, DMA queue + list, page pools) [PASS] D3D12.X: console command list memory methods (writes, timestamp, fill, copy, KickoffX, Wait32/64) [PASS] D3D12.X: sparse VRAM buffer heaps (placed aliasing, persistent Map coherence, readback) [PASS] D3D12.X: coherent window headroom (CUSTOM+WRITE_BACK & oversized READBACK in sparse VRAM) [PASS] D3D12.X: async ring-buffered sparse uploads (80 MiB across 20 submits + reused-tile zeroing) [PASS] D3D12.X: descriptor heaps still in window 0 after an 8 GiB+ graphics reservation [PASS] D3D12.X: committed textures beyond the coherent room are created; a readback buffer still gets coherent memory [PASS] D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94) [PASS] D3D12.X: raytracing surface (OPTIONS5, AS SRV descriptor, #146/#148 BVH list slots) [PASS] DirectStorage (xcrdapi): a file read into memory, status + D3D12 fence [PASS] D3D12.X: a texture in title memory (XG layout, #44) follows CPU writes [PASS] D3D12.X: a texture in a streaming pool gets its texels once pages are mapped in [PASS] MFPlat: MFResetDXGIDeviceManagerX resets IMFDXGIDeviceManager with the d3d12_xs device (XMA2 buffer ended after 105 ms; Opus buffer ended after 105 ms) [PASS] XAudio2: console flags/device, XMA2 & Opus voices decoded, PCM passes, callbacks xcl_testtitle: done, failures: 0 Game exited with code 0x0 (0) Imports: 219 (game-dll:testgame_mw.dll: 4, hle-cross:kernelx.dll: 4, hle:gameinput.dll: 1, hle:kernelx.dll: 21, hle:mfplat.dll: 1, hle:xaudio2_9.dll: 1, hle:xcrdapi.dll: 1, hle:xg_xs.dll: 1, hle:xgameruntime.dll: 24, stub: 1, system: 160) Unimplemented functions called (2): 1× kernelx.dll!XclDefinitelyMissingFunction (first call: xcl_testtitle.exe+0x34fce) 1× d3d12_xs.dll!ID3D12Device14::#47 (console extension) (first call: xcl_testtitle.exe+0x61990) Writes to game files redirected to the overlay: 5 Report: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\logs\report.json Log: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\logs\xcl.log --- stderr --- xcl: XCL 0.1.0 – host for 'XCL.TestTitle' xcl: game: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game\xcl_testtitle.exe (read-only folder: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\game) xcl: XCL data: <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle xcl: VFS: 30 file hooks active xcl: loaded xcl_testtitle.exe @ 0x140000000 (size 0xfd000, preferred 0x140000000) xcl: loaded testgame_mw.dll @ 0x180000000 (size 0x1f000, preferred 0x180000000) xcl: VFS: CreateFileW(<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\cache) flags 0x2000000 xcl: TLS: testgame_mw.dll: template 96 B, block 96 B, index 13, threads initialized: 1 xcl: DllMain(testgame_mw.dll, PROCESS_ATTACH) xcl: VFS: CreateFileW(<USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\cache) flags 0x2000000 xcl: TLS: xcl_testtitle.exe: template 112 B, block 112 B, index 14, threads initialized: 1 xcl: TLS: xcl_testtitle.exe has slot 0 (as a process's executable); xcl.exe's own TLS is in slot 14 – 4 threads xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80 xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80 xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80 xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80 xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80 xcl: GetDiskFreeSpaceExA(\\?\<USERPROFILE>\appdata\locallow\NVIDIA\DXCache\): 267783 MiB available of 952861 MiB xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x210400 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrsdb1.bin) flags 0x80 xcl: VFS: CreateFileW(<USERPROFILE>\documents\codex\2026-11-23\ar\work\xcl\target\debug\petromod_nvidia_profile_identifier.ogl) flags 0x80 xcl: VFS: CreateFileW(C:\ProgramData\NVIDIA Corporation\Drs\nvdrssel.bin) flags 0x210400 xcl: UMA: 3 sparse VRAM window(s) (12 GiB VA) + 512 MB coherent window at 0x400000000 xcl: D3D12.X: 3 sparse window(s) for the title's own memory (tiled buffers on video memory) xcl: D3D12.X: UMA opened (3 sparse VRAM window(s), 512 MB coherent window), window 0 buffer at VA 0x300000000 xcl: D3D12.X: native dynamic depth bias (OPTIONS16): supported (ID3D12GraphicsCommandList9::RSSetDepthBias) xcl: D3D12.X: ID3D12Device14 – 83 PC methods, 42 internal slots under the guard, +64 stubs (Device, PC vtable D3D12Core.dll+0x249078) xcl: D3D12.X: backend 'real' – NVIDIA GeForce RTX 3080 (12091 MiB VRAM) xcl: start xcl_testtitle.exe: entry point xcl_testtitle.exe+0xb7280 , stack 0x100000 xcl: C++ exception rust_panic "� @" thrown; on the stack: xcl_testtitle.exe+0xf02b0, xcl_testtitle.exe+0xf02b0, xcl_testtitle.exe+0xf02b0, VCRUNTIME140.dll+0x55f2, xcl_testtitle.exe+0x77020, xcl_testtitle.exe+0x22da4 xcl: D3D12.X: ID3D12Heap1 – 10 PC methods, 10 internal slots under the guard, +64 stubs (Heap, PC vtable D3D12Core.dll+0x247ce8) xcl: user: the title's window 0xce0bf4 is the console's screen (1920x1080, no frame, cloaked) xcl: user: the title's window 0x520b52 is the console's screen (1920x1080, no frame, cloaked) xcl: GameInput: GameInputCreate – one gamepad (XInput controller / keyboard) xcl: [STUB] kernelx.dll!XclDefinitelyMissingFunction first called from xcl_testtitle.exe+0x34fce → returning 0x0 xcl: GetProcAddress(kernelx.dll, XNoSuchApiAnywhere) → NULL (not implemented) xcl: [VFS] write to a game file redirected to the overlay: data\hello.txt xcl: [VFS] write to a game file redirected to the overlay: data\new_save.bin xcl: [VFS] write to a game file redirected to the overlay: data\newdir\deeper xcl: [VFS] write to a game file redirected to the overlay: data\renamed.bin xcl: [VFS] write to a game file redirected to the overlay: data\delete_me.txt xcl: GetDiskFreeSpaceExW(T:\) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\temp): 267727 MiB available of 952861 MiB xcl: GetDiskFreeSpaceW(T:\) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\temp): 267727 MiB available of 952861 MiB xcl: XGameRuntimeInitialize (XCL offline runtime) xcl: XUserAddAsync(options=0x1) → local offline user 'Player1' xcl: XUser: the local user reached the title (XUserAddResult); 0 device association callback(s) xcl: XUser: token #0 for GET https://example.invalid/hotfix – none: no Xbox Live (0x80072EFD) xcl: GetDiskFreeSpaceExW(<USERPROFILE>/games) (host <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\target\e2e\data\XCL.TestTitle\pls\Users\xcl\games): 267784 MiB available of 952861 MiB xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: ID3D12CommandQueue – 19 PC methods, 23 internal slots under the guard, +64 stubs (CommandQueue, PC vtable D3D12Core.dll+0x24bab8) xcl: D3D12.X: ID3D12Fence1 – 12 PC methods, 19 internal slots under the guard, +64 stubs (Fence, PC vtable D3D12Core.dll+0x2475c0) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: [SHADER] rootsig a6b4665d1ef3de87: 68 B, format dxbc, parts [RTS0] xcl: D3D12.X: QueryInterface(0742a90b-c387-483f-b946-30a7e4e61458) – interface unknown on the PC (console-only?) xcl: D3D12.X: ID3D12RootSignature – 8 PC methods, 17 internal slots under the guard, +64 stubs (RootSignature, PC vtable D3D12Core.dll+0x304ca0) xcl: [SHADER] vs 59de38f958e2f013: 528 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT] xcl: [SHADER] ps 8a5d1b6c5b50f11e: 56 B, format container-unknown, parts [XBOX] xcl: [SHADER] 8a5d1b6c5b50f11e: RDNA2 code found – disassembly in <USERPROFILE>\Documents\Codex\2026-11-23\ar\work\xcl\crates\xcl\..\..\target\e2e\data\XCL.TestTitle\shaders\8a5d1b6c5b50f11e_ps.rdna2.txt xcl: D3D12.X: ID3D12PipelineState – 9 PC methods, 0 internal slots under the guard, +64 stubs (PipelineState, PC vtable D3D12Core.dll+0x304d20) xcl: D3D12.X: graphics PSO rejected by the driver (0x80004005) – fallback shaders used (#1) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: [SHADER] ps 44871e939431b2e3: 204 B, format xbox-native, parts [DXIL] xcl: [SHADER] 44871e939431b2e3: console container PS SM 6.6, FSSM [PS], 2 RDNA2 instructions xcl: D3D12.X: graphics PSO rejected by the driver (0x80070057) – fallback shaders used (#2) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: [SHADER] vs 04ef3b5b06edae7c: 688 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT] xcl: [SHADER] ps 1eb6d31c9e4c3658: 452 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT] xcl: D3D12.X: CreateDerivedPipelineStateX – unknown patch part 4 xcl: D3D12.X: video-memory arena for title addresses 0x700000000..0x708000000 xcl: D3D12.X: ID3D12Resource2 – 17 PC methods, 321 internal slots under the guard, +64 stubs (Resource, PC vtable D3D12Core.dll+0x2489d0) xcl: D3D12.X: ID3D12DescriptorHeap – 11 PC methods, 1 internal slots under the guard, +64 stubs (DescriptorHeap, PC vtable D3D12Core.dll+0x24b838) xcl: console buffers in UMA: Map = console address (0x700020000) xcl: D3D12.X: ID3D12QueryHeap – 8 PC methods, 2 internal slots under the guard, +64 stubs (QueryHeap, PC vtable D3D12Core.dll+0x250898) xcl: D3D12.X: ID3D12CommandAllocator – 9 PC methods, 246 internal slots under the guard, +64 stubs (CommandAllocator, PC vtable D3D12Core.dll+0x248c68) xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (CommandList, PC vtable D3D12Core.dll+0x305830) xcl: D3D12.X: nested occlusion query – the outer one ends there and reports visible, the inner one counts xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: frame interval 16667 µs (periodicity 1, flags 0x0) xcl: D3D12.X: PresentX – the title presents its own frames (1 plane(s)) xcl: XCL window created (1280x720) xcl: keyboard and mouse play as the gamepad (WASD left stick, mouse right stick, mouse buttons triggers, wheel bumpers) xcl: D3D12.X: QueryInterface(54ec77fa-1377-44e6-8c32-88fd5f44c84c) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(b898d4fd-b5b3-4ffc-8694-0259864ffcf8) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(db6f6ddb-ac77-4e88-8253-819df9bbf140) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(9b7e4a00-342c-4106-a19f-4f2704f689f0) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(85611e73-70a9-490e-9614-a9e302777904) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(a2a9f815-4778-40d1-b179-d5d3a1a5f1bc) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(79cf2233-7536-4948-9d36-1e4692dc5760) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(cbe8c719-71a3-40ed-a3ad-a05161dcb833) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(433be922-0f1b-4078-850c-16630f94406f) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(0adf7d52-929c-4e61-addb-ffed30de66ef) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(aec22fb8-76f3-4639-9be0-28eb43a67a2e) – interface unknown on the PC (console-only?) xcl: D3D12.X: QueryInterface(ffffffff-1bbe-4d12-afbf-8fdf7e0a87c7) – interface unknown on the PC (console-only?) xcl: present: swap chain 640x360 DXGI_FORMAT(28) – the game image will appear in the XCL window xcl: present: first game frame shown (640x360) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (CommandList, PC vtable D3D12Core.dll+0x306040) xcl: D3D12.X: ID3D12GraphicsCommandList10 – 86 PC methods, 512 internal slots under the guard, +64 stubs (DmaList, PC vtable D3D12Core.dll+0x306040) xcl: [STUB] d3d12_xs.dll!ID3D12Device14::#47 (console extension) first called from xcl_testtitle.exe+0x61990 → returning 0x0 xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: heap 0x20828931a70 (0x40000 bytes) holds buffers: in sparse VRAM at 0x420010000 xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: heap 0x2082892f030 (0x100000 bytes) holds buffers: in sparse VRAM at 0x420110000 xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: sparse windows: 16 submits, 159 MB of CPU writes uploaded, 105 ms spent, 1280 tiles mapped xcl: sparse windows timing: write-watch 6 ms (3098 dirty pages), lock wait 0 ms, chunk scan 45 ms, upload 59 ms (2371 runs) xcl: sparse windows: 32 submits, 223 MB of CPU writes uploaded, 328 ms spent, 1280 tiles mapped xcl: sparse windows timing: write-watch 8 ms (19482 dirty pages), lock wait 0 ms, chunk scan 262 ms, upload 66 ms (2387 runs) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: console descriptor heaps: one shader-visible PC heap of 1000000 view descriptors for all of them xcl: console descriptor heap 0x207a0eb86b0: 442368 view slots at sparse VRAM 0x10000, shader visible xcl: console descriptor heap 0x207a0eb8910: 512 sampler slots at sparse VRAM 0x10000, shader visible xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: [SHADER] vs a4b1ee9aee1ae591: 688 B, format dxbc, parts [RDEF,ISGN,OSGN,SHEX,STAT] xcl: D3D12.X: CreatePlacedResourceX at 0x700120000 (dimension 3 64x64 format 28 flags 0x1) – aliases an earlier resource there (dimension 3 512x512 format 28 flags 0x0) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: CheckFeatureSupport(D3D12_OPTIONS5) → RaytracingTier 12 (host 12) xcl: D3D12.X: CheckFeatureSupport(27) with the console's 16 bytes, the PC's 12 → 0x0 xcl: console descriptor heap 0x207a0eb8f00: 2 view slots at sparse VRAM 0x10000, shader visible xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: DirectStorage: request #0: options 0x0 (file source), destination 0x20827bcdf10 (512 bytes, page offset 0), source size 512, intermediate 0 xcl: DirectStorage: request #1: options 0x200000 (file source), destination 0x937d5fedb8 (physical pages) (512 bytes, page offset 128), source size 512, intermediate 0 xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: CreatePlacedResourceX at 0x420010000 (dimension 3 80x40 format 28 flags 0x0) – aliases an earlier resource there (dimension 1 65536x1 format 0 flags 0x0) xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: D3D12.X: device 0x207a0c3d940 for the title xcl: mfplat: MFResetDXGIDeviceManagerX bridged ResetDevice failed: 0x80070057 (direct was 0x80070057) xcl: XAudio2: XAudio2Create – dropping console flags 0x41 xcl: XAudio2: engine created (system XAudio2 2.9, flags 0x0) xcl: XAudio2: CreateMasteringVoice – dropping console flags 0x4 xcl: XAudio2: CreateMasteringVoice – console device id ignored (default device) xcl: XAudio2: COM was not initialized on the title thread – CoInitializeEx(MTA) → 0x0 xcl: XAudio2: XMA2 voice (1 ch., 48000 Hz) → real PCM16 decoding via hle::xma2 xcl: XAudio2: Opus voice (1 ch., 48000 Hz) → real PCM16 decoding via MSOpusDecoder xcl: process ends (thread 34476); on the stack: xcl_testtitle.exe+0xbd5a6, xcl_testtitle.exe+0xa6660, xcl_testtitle.exe+0xbd5a7, xcl_testtitle.exe+0xa667e, xcl_testtitle.exe+0xd12b8, xcl_testtitle.exe+0xce338, xcl_testtitle.exe+0x9a013, xcl_testtitle.exe+0xbea48, xcl_testtitle.exe+0x9f83b, xcl_testtitle.exe+0xf01c8, xcl_testtitle.exe+0xa2150, xcl_testtitle.exe+0xcfaa8, xcl_testtitle.exe+0xcfed0, xcl_testtitle.exe+0xa0a59, xcl_testtitle.exe+0xd0648, xcl_testtitle.exe+0xf0050 ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 12.74s ``` </details>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:51 +00:00
github manually merged commit a3dedf1320 into gh-pr/179/base 2026-11-26 04:13:52 +00:00
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 20:50 UTC · original

Linux / Wine / GNU run of a3dedf13 (merge-base 956a476, the current main). Ubuntu 24.04, XCL cross-built for x86_64-pc-windows-gnu (mingw-w64 13, release, so no overflow checks), run under Wine 11.21 Staging (Kron4ek wow64 build). The control is this PR's head with only the production hunks reverse-applied, so the new tests stay in.

Under Wine, the test's "native" side is Wine's own user32.RegisterClassExA, so this also checks that the expected behaviour holds there.

hle::user::tests PR head Control (the 4-line size check reverted)
register_class_rejects_invalid_sizes_like_windows pass: Wine rejects cbSize 0, 1, 79, 81, u32::MAX with atom 0 / error 87, and XCL does the same FAIL: Wine rejects all five (87), XCL registers each (atom 0xc036, last error untouched)
register_class_checks_size_before_reading_remaining_fields pass the process dies: Unhandled page fault on read access (the conversion reads into the uncommitted page)
register_class_accepts_valid_size_and_preserves_attributes pass pass

Head: 3 passed, 0 failed. Wine 11.21 matches the Windows behaviour you measured, so the check is right on both. No findings from reading the diff.

Not covered: RegisterClassExW (untouched); any title.

**@⁠Kalmarv** on GitHub · 2026-11-23 20:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/179#issuecomment-7113631390) Linux / Wine / GNU run of `a3dedf13` (merge-base `956a476`, the current `main`). Ubuntu 24.04, XCL cross-built for `x86_64-pc-windows-gnu` (mingw-w64 13, release, so no overflow checks), run under Wine 11.21 Staging (Kron4ek wow64 build). The control is this PR's head with only the production hunks reverse-applied, so the new tests stay in. Under Wine, the test's "native" side is Wine's own `user32.RegisterClassExA`, so this also checks that the expected behaviour holds there. | `hle::user::tests` | PR head | Control (the 4-line size check reverted) | |---|---|---| | `register_class_rejects_invalid_sizes_like_windows` | pass: Wine rejects cbSize 0, 1, 79, 81, `u32::MAX` with atom 0 / error 87, and XCL does the same | FAIL: Wine rejects all five (87), XCL registers each (atom `0xc036`, last error untouched) | | `register_class_checks_size_before_reading_remaining_fields` | pass | the process dies: `Unhandled page fault on read access` (the conversion reads into the uncommitted page) | | `register_class_accepts_valid_size_and_preserves_attributes` | pass | pass | Head: 3 passed, 0 failed. Wine 11.21 matches the Windows behaviour you measured, so the check is right on both. No findings from reading the diff. **Not covered:** `RegisterClassExW` (untouched); any title.
Author
Owner

@⁠ivall on GitHub · 2026-11-23 21:09 UTC · original

Merged (main 6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).

**@⁠ivall** on GitHub · 2026-11-23 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/179#issuecomment-7114076314) Merged (main 6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).
This discussion has been locked. Commenting is limited to contributors.
No description provided.