user: implement UnregisterClassA and UnregisterClassW #1138

Open
github-bot wants to merge 1 commit from github-bot/gh-1138 into main AGit
Owner

@⁠Ivankiosan on GitHub · 2026-11-24 12:24 UTC · original
Ivankiosan:user-unregister-class → main · +77 −1 · 1 files · 1 commits · open

The console's minuserx.dll / ext-ms-win-rtcore-ntuser-window-* family implements window creation, window procedures, and class lifecycle for console titles. While RegisterClassExA was implemented in crates/xcl/src/hle/user.rs, the corresponding unregistration entrypoints (UnregisterClassA and UnregisterClassW) were not implemented. Titles or engine sub-frameworks unregistering window classes during teardown or re-initialization would drop to fallback stubs or fail unexpectedly.

What is in it

  • crates/xcl/src/hle/user.rs:
    • Implements UnregisterClassA: validates class_name pointer (reporting ERROR_INVALID_PARAMETER when null, matching native Win32 semantics), converts ANSI class/atom name via
      ame(), and forwards to UnregisterClassW.
    • Implements unregister_class_w: validates class_name pointer (reporting ERROR_INVALID_PARAMETER when null) and invokes native UnregisterClassW.
    • Exports UnregisterClassA and UnregisterClassW in exports().
    • Unit test unregister_class_unregisters_registered_classes_and_rejects_null: verifies null pointer handling with ERROR_INVALID_PARAMETER, registers both ANSI and Unicode classes, and verifies clean unregistration.

Tested

  • Windows 11 build 26100, AMD Radeon RX 7600 (8152 MiB VRAM), driver 32.0.12028.1005, rustc 1.100.0 MSVC.
  • 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: e640169179815062df69db38f997336a18c26851 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: 8172 MB

Not tested

  • Unregistering window classes created in separate processes or invalid hInstance boundaries.

AI use

  • Claude Code / Claude Opus 4.6 identified the missing unregister entrypoints, implemented both ANSI and Unicode functions with Win32 parameter validation, added unit tests, and drafted the PR description; tests and regression runs executed on AMD Radeon hardware.
**@⁠Ivankiosan** on GitHub · 2026-11-24 12:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1138) `Ivankiosan:user-unregister-class` → `main` · +77 −1 · 1 files · 1 commits · open The console's minuserx.dll / ext-ms-win-rtcore-ntuser-window-* family implements window creation, window procedures, and class lifecycle for console titles. While RegisterClassExA was implemented in crates/xcl/src/hle/user.rs, the corresponding unregistration entrypoints (UnregisterClassA and UnregisterClassW) were not implemented. Titles or engine sub-frameworks unregistering window classes during teardown or re-initialization would drop to fallback stubs or fail unexpectedly. **What is in it** - crates/xcl/src/hle/user.rs: - Implements UnregisterClassA: validates class_name pointer (reporting ERROR_INVALID_PARAMETER when null, matching native Win32 semantics), converts ANSI class/atom name via ame(), and forwards to UnregisterClassW. - Implements unregister_class_w: validates class_name pointer (reporting ERROR_INVALID_PARAMETER when null) and invokes native UnregisterClassW. - Exports UnregisterClassA and UnregisterClassW in exports(). - Unit test unregister_class_unregisters_registered_classes_and_rejects_null: verifies null pointer handling with ERROR_INVALID_PARAMETER, registers both ANSI and Unicode classes, and verifies clean unregistration. **Tested** - Windows 11 build 26100, AMD Radeon RX 7600 (8152 MiB VRAM), driver 32.0.12028.1005, rustc 1.100.0 MSVC. - 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: e640169179815062df69db38f997336a18c26851 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: 8172 MB ` **Not tested** - Unregistering window classes created in separate processes or invalid hInstance boundaries. **AI use** - Claude Code / Claude Opus 4.6 identified the missing unregister entrypoints, implemented both ANSI and Unicode functions with Win32 parameter validation, added unit tests, and drafted the PR description; tests and regression runs executed on AMD Radeon hardware.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:47 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 12:57 UTC · original

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X; Rust stable MSVC, debug.

  • cargo test -p xcl --lib user::: 4 passed, 0 failed — includes the new unregister_class_unregisters_registered_classes_and_rejects_null plus the existing register-class validation tests.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 12:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1138#issuecomment-7132153191) Independent verification on current `main` `384f7f7` (branch already contains it — clean). **Machine:** Windows 11, Ryzen 9 7900X; Rust stable MSVC, debug. - `cargo test -p xcl --lib user::`: **4 passed, 0 failed** — includes the new `unregister_class_unregisters_registered_classes_and_rejects_null` plus the existing register-class validation tests. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 14:34 UTC · original

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. e640169 as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact). RegisterClass* / UnregisterClass* are Wine's user32 here.
  • hle::user::tests::unregister_class_unregisters_registered_classes_and_rejects_null: 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.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 14:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1138#issuecomment-7134610962) 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`. `e640169` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine, one test per process (`--exact`). `RegisterClass*` / `UnregisterClass*` are Wine's user32 here. - `hle::user::tests::unregister_class_unregisters_registered_classes_and_rejects_null`: **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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1138/head:github-bot/gh-1138'
git switch 'github-bot/gh-1138'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1138'
git switch 'github-bot/gh-1138'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1138'
git switch 'github-bot/gh-1138'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1138'
git switch 'main'
git merge --squash 'github-bot/gh-1138'
git switch 'main'
git merge --ff-only 'github-bot/gh-1138'
git switch 'main'
git merge 'github-bot/gh-1138'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.