User: validate RegisterClassExA size and enforce console window sizing (#106) #1426

Open
slopgobblercobbler wants to merge 1 commit from upstream-pr/1436 into main
slopgobblercobbler commented 2026-11-24 15:56:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by slopgobblercobbler on 2026-11-24T15:56:57Z.


Summary

Fixes #106 Item 4:

  1. RegisterClassExA validation (crates/xcl/src/hle/user.rs):
    • Validates that descriptor pointer is not null (returning ERROR_INVALID_PARAMETER).
    • Validates that cb_size == std::mem::size_of::<WNDCLASSEXA>() as u32 to reject malformed or invalid structure sizes.
  2. Frameless console window sizing (console_window):
    • Removes SWP_NOSIZE from SetWindowPos after subclassing and passes CONSOLE_W x CONSOLE_H (1920x1080) so top-level console windows are resized cleanly regardless of PC display resolution or DPI scaling.
  3. Window tracking bounds (console_wndproc):
    • Updates WM_GETMINMAXINFO to set ptMaxSize, ptMinTrackSize, and ptMaxTrackSize via MINMAXINFO to at least CONSOLE_W x CONSOLE_H.
  4. Unit tests:
    • Added register_class_rejects_null_descriptor, console_window_enforces_frameless_1920x1080_sizing, and console_window_unicode_enforces_frameless_1920x1080_sizing.

Changes

  • crates/xcl/src/hle/user.rs:
    • RegisterClassExA: validate null descriptor pointer and cb_size.
    • console_window: enforce 1920x1080 frameless dimensions.
    • console_wndproc: enforce MINMAXINFO dimensions on WM_GETMINMAXINFO.
    • Unit tests: validation of class registration and window sizing.

Tested

  • Windows 11 x64, Rust 1.85+ stable (MSVC).
  • cargo test -p xcl -- user: 14 passed, 0 failed (100% pass rate).
  • Clean diff: zero trailing whitespace, GPL-2.0-only compliant, zero game data/keys.

Not Tested

  • Multi-monitor DPI change events.

AI Use

Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity

<!-- greyfinch-sync:ivall/xcl:issue:5475659849 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-11-24T15:56:57Z. --- ## Summary Fixes #106 Item 4: 1. **`RegisterClassExA` validation (`crates/xcl/src/hle/user.rs`)**: - Validates that descriptor pointer is not null (returning `ERROR_INVALID_PARAMETER`). - Validates that `cb_size == std::mem::size_of::<WNDCLASSEXA>() as u32` to reject malformed or invalid structure sizes. 2. **Frameless console window sizing (`console_window`)**: - Removes `SWP_NOSIZE` from `SetWindowPos` after subclassing and passes `CONSOLE_W` x `CONSOLE_H` (1920x1080) so top-level console windows are resized cleanly regardless of PC display resolution or DPI scaling. 3. **Window tracking bounds (`console_wndproc`)**: - Updates `WM_GETMINMAXINFO` to set `ptMaxSize`, `ptMinTrackSize`, and `ptMaxTrackSize` via `MINMAXINFO` to at least `CONSOLE_W` x `CONSOLE_H`. 4. **Unit tests**: - Added `register_class_rejects_null_descriptor`, `console_window_enforces_frameless_1920x1080_sizing`, and `console_window_unicode_enforces_frameless_1920x1080_sizing`. ## Changes - `crates/xcl/src/hle/user.rs`: - `RegisterClassExA`: validate null descriptor pointer and `cb_size`. - `console_window`: enforce 1920x1080 frameless dimensions. - `console_wndproc`: enforce MINMAXINFO dimensions on `WM_GETMINMAXINFO`. - Unit tests: validation of class registration and window sizing. ## Tested - Windows 11 x64, Rust 1.85+ stable (MSVC). - `cargo test -p xcl -- user`: 14 passed, 0 failed (100% pass rate). - Clean diff: zero trailing whitespace, GPL-2.0-only compliant, zero game data/keys. ## Not Tested - Multi-monitor DPI change events. ## AI Use Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity
Anon64 commented 2026-11-24 17:06:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T16:24:34Z.


Regression run for this PR: head 058d890, based on main cbea872. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s.

main cbea872:

xcl-smoke v1
commit: cbea87246bc4983a339caa152b2b5ad68697ec50
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1347 (PresentX 1347)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 76435 MB

this PR:

xcl-smoke v1
commit: 058d890da2f1ea2a29ba86b2f3691c5f939d5fae
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1585 (PresentX 1585)
presents per 2 s (last 3): 59 61 60
device removals: 0
crashes: 0
peak commit: 90539 MB

No device removals or crashes; 118 % of main's frames, 118 % of its peak commit.

Peak commit in both runs is mostly the pipeline preload's DXC compiles on this machine (#1035; 23 GB on main with XCL_PSO_PRELOAD=0), so it varies run to run.

Not tested: the whole suite; whether the title reaches the changed code in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

<!-- greyfinch-sync:ivall/xcl:comment:7137620091 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1436#issuecomment-7137620091). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T16:24:34Z. --- Regression run for this PR: head `058d890`, based on `main` `cbea872`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s. main `cbea872`: ``` xcl-smoke v1 commit: cbea87246bc4983a339caa152b2b5ad68697ec50 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1347 (PresentX 1347) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 76435 MB ``` this PR: ``` xcl-smoke v1 commit: 058d890da2f1ea2a29ba86b2f3691c5f939d5fae gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1585 (PresentX 1585) presents per 2 s (last 3): 59 61 60 device removals: 0 crashes: 0 peak commit: 90539 MB ``` No device removals or crashes; 118 % of main's frames, 118 % of its peak commit. Peak commit in both runs is mostly the pipeline preload's DXC compiles on this machine (#1035; 23 GB on `main` with `XCL_PSO_PRELOAD=0`), so it varies run to run. **Not tested:** the whole suite; whether the title reaches the changed code in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
futurepro62 commented 2026-11-24 17:06:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T16:53:34Z.


Full-suite run, since this PR has no test report yet. Tested exact head 058d890 (on its base cbea872).

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: 759 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_rejects_null_descriptor, console_window_enforces_frameless_1920x1080_sizing, console_window_unicode_enforces_frameless_1920x1080_sizing.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 759 passed, 0 failed, 41 ignored, no skips.

Not tested

  • 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:7138368281 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7138368281). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T16:53:34Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `058d890` (on its base `cbea872`). **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`: **759 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_rejects_null_descriptor`, `console_window_enforces_frameless_1920x1080_sizing`, `console_window_unicode_enforces_frameless_1920x1080_sizing`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **759 passed, 0 failed, 41 ignored**, no skips. **Not tested** - 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.
gut0to commented 2026-11-24 18:58:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:58:41Z.

Review: COMMENTED


CONTRIBUTING.md requires paired real-title scripts/smoke.ps1 runs for changes under crates/xcl/src, with main and this head tested on the same title and for the same duration. The current description has no regression blocks. Please add both smoke results before merge; a title that does not exercise this path still counts if documented. AI-assisted review; I checked the diff scope and description against the guide.

<!-- greyfinch-sync:ivall/xcl:review:6045463097 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436#pullrequestreview-6045463097). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:58:41Z. **Review:** COMMENTED --- CONTRIBUTING.md requires paired real-title `scripts/smoke.ps1` runs for changes under `crates/xcl/src`, with `main` and this head tested on the same title and for the same duration. The current description has no regression blocks. Please add both smoke results before merge; a title that does not exercise this path still counts if documented. AI-assisted review; I checked the diff scope and description against the guide.
DavidM1911 commented 2026-11-24 19:07:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:52:28Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141272687 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7141272687). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:52:28Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
github-actions[bot] commented 2026-11-27 21:26:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-27T21:26:26Z.


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:7228445436 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7228445436). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T21:26:26Z. --- 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 05:44:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:44:31Z.


Triage (#1607) – head 058d890

No open PR makes the same change. The RegisterClassExA size check is already on main (#179); comparing cb_size with size_of::() instead of WndClassEx changes nothing (both are 80 bytes), so only the SetLastError on a null descriptor is new there.
The real fix is in console_wndproc: main writes m[6]/m[7] (offset 24, ptMinTrackSize) under a comment saying ptMaxTrackSize, so the maximum track size is never raised; this PR uses MINMAXINFO fields and also resizes the window with SetWindowPos after subclassing. #794 touches the same SetWindowPos call for a different reason (showing the window when cloaking is unavailable), so the two will conflict.
Recommendation: keep open.

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:7302088138 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7302088138). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:44:31Z. --- **Triage (#1607)** – head 058d890 No open PR makes the same change. The RegisterClassExA size check is already on main (#179); comparing cb_size with size_of::<WNDCLASSEXA>() instead of WndClassEx<u8> changes nothing (both are 80 bytes), so only the SetLastError on a null descriptor is new there. The real fix is in console_wndproc: main writes m[6]/m[7] (offset 24, ptMinTrackSize) under a comment saying ptMaxTrackSize, so the maximum track size is never raised; this PR uses MINMAXINFO fields and also resizes the window with SetWindowPos after subclassing. #794 touches the same SetWindowPos call for a different reason (showing the window when cloaking is unavailable), so the two will conflict. Recommendation: keep open. 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/1436:upstream-pr/1436'
git switch 'upstream-pr/1436'

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/1436'
git switch 'upstream-pr/1436'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1436'
git switch 'upstream-pr/1436'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1436'
git switch 'main'
git merge --squash 'upstream-pr/1436'
git switch 'main'
git merge --ff-only 'upstream-pr/1436'
git switch 'main'
git merge 'upstream-pr/1436'
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!1426
No description provided.