user: implement RegisterClassExW for Unicode window classes #1122

Open
Ivankiosan wants to merge 1 commit from upstream-pr/1131 into main
Ivankiosan commented 2026-11-24 12:13:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ivankiosan on 2026-11-24T12:13:13Z.


The console's minuserx.dll / ext-ms-win-rtcore-ntuser-window-* family implements window creation and class registration for console titles. XCL exports CreateWindowExA, RegisterClassExA and CreateWindowExW in crates/xcl/src/hle/user.rs (exports()).

While CreateWindowExW was exported to support titles creating Unicode windows directly, RegisterClassExW was previously missing from user.rs exports. Titles registering window classes via the Unicode API set would otherwise drop to fallback stubs or fail class lookup.

What is in it

  • crates/xcl/src/hle/user.rs:
    • Implements
      egister_class_ex_w: verifies cb_size against std::mem::size_of::<WndClassEx>(), sets ERROR_INVALID_PARAMETER on mismatch, and forwards directly to native RegisterClassExW without string conversion.
    • Adds RegisterClassExW to exports().
    • Adds unit test
      egister_class_ex_w_accepts_valid_class_and_rejects_invalid_size covering size rejection, parameter validation, and class registration/retrieval verification.

Tested

  • Windows 11 build 26100, AMD Radeon RX 7600 (8152 MiB VRAM), driver 32.0.12028.1005, rustc 1.100.0 MSVC, debug and release builds.
  • cargo test -p xcl --lib hle::user: 4 passed, 0 failed, 0 ignored.
  • cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored (0 SKIPPED).

Regression run

main:
xcl-smoke v1 commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 7754 MB

PR head:
xcl-smoke v1 commit: e50170cd52f3287b821a666207ac1d88ce0bba2b gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 7792 MB

Not tested

  • Games registering ANSI window classes with non-ASCII multi-byte class names (covered by existing RegisterClassExA tests).

AI use

  • Claude Code / Claude Opus 4.6 identified the API gap, implemented the validated entrypoint, added the unit test, and drafted the description; all tests and regression runs executed on local AMD hardware.
<!-- greyfinch-sync:ivall/xcl:issue:5471916635 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1131). Originally posted by [Ivankiosan](https://github.com/Ivankiosan) on 2026-11-24T12:13:13Z. --- The console's minuserx.dll / ext-ms-win-rtcore-ntuser-window-* family implements window creation and class registration for console titles. XCL exports CreateWindowExA, RegisterClassExA and CreateWindowExW in crates/xcl/src/hle/user.rs (exports()). While CreateWindowExW was exported to support titles creating Unicode windows directly, RegisterClassExW was previously missing from user.rs exports. Titles registering window classes via the Unicode API set would otherwise drop to fallback stubs or fail class lookup. **What is in it** - crates/xcl/src/hle/user.rs: - Implements egister_class_ex_w: verifies cb_size against std::mem::size_of::<WndClassEx<u16>>(), sets ERROR_INVALID_PARAMETER on mismatch, and forwards directly to native RegisterClassExW without string conversion. - Adds RegisterClassExW to exports(). - Adds unit test egister_class_ex_w_accepts_valid_class_and_rejects_invalid_size covering size rejection, parameter validation, and class registration/retrieval verification. **Tested** - Windows 11 build 26100, AMD Radeon RX 7600 (8152 MiB VRAM), driver 32.0.12028.1005, rustc 1.100.0 MSVC, debug and release builds. - cargo test -p xcl --lib hle::user: **4 passed, 0 failed, 0 ignored**. - cargo test --workspace -- --test-threads=4: **742 passed, 0 failed, 41 ignored** (0 SKIPPED). **Regression run** main: ` xcl-smoke v1 commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 7754 MB ` PR head: ` xcl-smoke v1 commit: e50170cd52f3287b821a666207ac1d88ce0bba2b gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 7792 MB ` **Not tested** - Games registering ANSI window classes with non-ASCII multi-byte class names (covered by existing RegisterClassExA tests). **AI use** - Claude Code / Claude Opus 4.6 identified the API gap, implemented the validated entrypoint, added the unit test, and drafted the description; all tests and regression runs executed on local AMD hardware.
futurepro62 commented 2026-11-24 15:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:25:24Z.


Full-suite run, since this PR has no test report yet. Tested exact head e50170c (on its base 47efa2e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: register_class_ex_w_accepts_valid_class_and_rejects_invalid_size.

Not tested

  • AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7134349465 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1131#issuecomment-7134349465). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:25:24Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `e50170c` (on its base `47efa2e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `register_class_ex_w_accepts_valid_class_and_rejects_invalid_size`. **Not tested** - AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
JoaoPauluu commented 2026-11-24 15:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T14:34:55Z.


A run on Linux under Wine.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. e50170c as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact). RegisterClassExW is Wine's user32 here.
  • hle::user::tests::register_class_ex_w_accepts_valid_class_and_rejects_invalid_size: ok, no SKIPPED.

Not tested

  • whether the new tests fail without the change on this stack; the rest of the suite on this head; a retail title; native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7134610189 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1131#issuecomment-7134610189). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T14:34:55Z. --- A run on Linux under Wine. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `e50170c` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine, one test per process (`--exact`). `RegisterClassExW` is Wine's user32 here. - `hle::user::tests::register_class_ex_w_accepts_valid_class_and_rejects_invalid_size`: **ok**, no SKIPPED. **Not tested** - whether the new tests fail without the change on this stack; the rest of the suite on this head; a retail title; native Windows. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
luckyteagirl commented 2026-11-25 04:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T03:32:47Z.


Tested

  • Exact PR head e50170cd52f3287b821a666207ac1d88ce0bba2b on Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC. This Win32 class registration suite did not exercise the RX 6800M GPU.
  • cargo test --locked -p xcl --lib -j 2 hle::user:: -- --test-threads=1 --show-output: 4 passed, 0 failed, 0 ignored, no explicit skips. The new Unicode class test passed its invalid-size check and native registration/retrieval path.
  • cargo build --locked --workspace -j 2: passed.

Not tested

  • A title registering a Unicode class, the full workspace suite, or Wine/Linux. The test invokes the exported wrapper and Win32 registration on this Windows host.

AI use

OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the focused suite and workspace build, checked the logs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7152014759 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1131#issuecomment-7152014759). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T03:32:47Z. --- **Tested** - Exact PR head `e50170cd52f3287b821a666207ac1d88ce0bba2b` on Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC. This Win32 class registration suite did not exercise the RX 6800M GPU. - `cargo test --locked -p xcl --lib -j 2 hle::user:: -- --test-threads=1 --show-output`: **4 passed, 0 failed, 0 ignored**, no explicit skips. The new Unicode class test passed its invalid-size check and native registration/retrieval path. - `cargo build --locked --workspace -j 2`: passed. **Not tested** - A title registering a Unicode class, the full workspace suite, or Wine/Linux. The test invokes the exported wrapper and Win32 registration on this Windows host. **AI use** OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the focused suite and workspace build, checked the logs, and drafted this report.
DavidM1911 commented 2026-11-25 08:08:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:02:19Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7156534168 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1131#issuecomment-7156534168). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:02:19Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 07:40:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:22Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252618286 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1131#issuecomment-7252618286). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:40:22Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:53:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:53:17Z.


Triage (#1607) – head e50170c

The change has no effect. Imports that hle/user.rs does not export fall back to Windows' user32 (HleModule::new(MINUSERX, ..., &["user32.dll"]); the resolver test console_user32_and_legacy_dlls_reach_the_pc_functions shows it for the ntuser API set), so titles already get user32's RegisterClassExW, not a stub. register_class_ex_w repeats the cbSize check that user32's RegisterClassExW already makes (the existing register_class_rejects_invalid_sizes_like_windows test relies on that) and then calls the same function.
Recommendation: close (bad: pass-through wrapper, no behaviour change).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301204271 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1131#issuecomment-7301204271). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:53:17Z. --- **Triage (#1607)** – head e50170c The change has no effect. Imports that `hle/user.rs` does not export fall back to Windows' user32 (`HleModule::new(MINUSERX, ..., &["user32.dll"])`; the resolver test `console_user32_and_legacy_dlls_reach_the_pc_functions` shows it for the ntuser API set), so titles already get user32's `RegisterClassExW`, not a stub. `register_class_ex_w` repeats the `cbSize` check that user32's `RegisterClassExW` already makes (the existing `register_class_rejects_invalid_sizes_like_windows` test relies on that) and then calls the same function. Recommendation: close (bad: pass-through wrapper, no behaviour change). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1131:upstream-pr/1131'
git switch 'upstream-pr/1131'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1131'
git switch 'upstream-pr/1131'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1131'
git switch 'upstream-pr/1131'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1131'
git switch 'main'
git merge --squash 'upstream-pr/1131'
git switch 'main'
git merge --ff-only 'upstream-pr/1131'
git switch 'main'
git merge 'upstream-pr/1131'
git push origin 'main'
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
xcl-dev/xcl!1122
No description provided.