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

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

@⁠slopgobblercobbler on GitHub · 2026-11-24 15:56 UTC · original
slopgobblercobbler:fix/user-wnd-validation → main · +160 −9 · 1 files · 1 commits · open

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

**@⁠slopgobblercobbler** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1436) `slopgobblercobbler:fix/user-wnd-validation` → `main` · +160 −9 · 1 files · 1 commits · open ## 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
- In RegisterClassExA, validate cb_size == std::mem::size_of::<WNDCLASSEXA>() as u32 and validate null pointer returning ERROR_INVALID_PARAMETER (#106 item 4).
- In console_window, remove SWP_NOSIZE from SetWindowPos after subclassing and pass CONSOLE_W x CONSOLE_H to ensure top-level console windows are resized to 1920x1080 cleanly.
- In console_wndproc, update WM_GETMINMAXINFO to set ptMaxSize, ptMinTrackSize, and ptMaxTrackSize via MINMAXINFO to at least CONSOLE_W x CONSOLE_H.
- Add unit tests: register_class_rejects_null_descriptor, console_window_enforces_frameless_1920x1080_sizing, and console_window_unicode_enforces_frameless_1920x1080_sizing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:49 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 16:24 UTC · original

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.

**@⁠Anon64** on GitHub · 2026-11-24 16:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7137620091) 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.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 16:53 UTC · original · edited 2026-11-24 17:02 UTC

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.
**@⁠futurepro62** on GitHub · 2026-11-24 16:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7138368281) · edited 2026-11-24 17:02 UTC 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1436#issuecomment-7141272687) 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!
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/1436/head:github-bot/gh-1436'
git switch 'github-bot/gh-1436'

Merge

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