XGameRuntime: preserve failure HRESULTs in Win32 conversion #1129

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

@⁠anakatt on GitHub · 2026-11-24 12:10 UTC · original
anakatt:util/preserve-failure-hresults → main · +4 −2 · 2 files · 1 commits · open

I make hresult_from_win32 follow Windows' HRESULT_FROM_WIN32 contract: zero and existing failure HRESULTs pass through; positive Win32 errors are converted. Previously, the helper replaced an existing HRESULT's facility bits with FACILITY_WIN32.

What is in it

  • util.rs: preserve inputs that are nonpositive when interpreted as HRESULT, with a contract comment.
  • networking.rs: extend the existing certificate regression to check that win32_failure_hr preserves CERT_E_UNTRUSTEDROOT.

Tested

I ran debug tests on Windows 11 Pro ARM64 10.0.26100.1742 in UTM (4 GiB RAM, virtual virt-10.0 CPU, Red Hat VirtIO GPU DOD), using Rust 1.100.0 x86_64-pc-windows-msvc and Visual Studio 2022 Build Tools. The guest used main 47efa2ecea0a12934719ae69b81930cf02a4b1c3 plus the source changes committed as d6b6c50276f8a1e401692235718d2134c34cd5d5.

  • cargo test --locked -p xcl --lib cert_verification_fails_closed_on_malformed_pins_and_zero_win32_errors: before the fix, 0 passed, 1 failed, 0 ignored; afterward, 1 passed, 0 failed, 0 ignored. Both runs filtered out 718 tests. The regression exposed 0x800B0109 being changed to 0x80070109.
  • cargo test --locked -p xcl --lib util::tests -- --test-threads=4: 5 passed, 0 failed, 0 ignored, 714 filtered out.

No SKIPPED output.

Not tested

I have not run the full workspace suite, native x64 Windows hardware, D3D12 GPU execution, live TLS failure scenarios or a real game title. These tests cover conversion and the existing certificate validation regression, not a live certificate-chain failure.

Regression run

Not run. This remains a draft pending the required real-title xcl-smoke blocks from main and this PR's clean head, using the same title and duration.

AI use

I used omp (openai-codex/gpt-6-astra) to investigate, implement the fix and regression, run the Windows tests, and prepare this PR.

**@⁠anakatt** on GitHub · 2026-11-24 12:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1129) `anakatt:util/preserve-failure-hresults` → `main` · +4 −2 · 2 files · 1 commits · open I make `hresult_from_win32` follow Windows' [HRESULT_FROM_WIN32 contract](https://learn.microsoft.com/en-us/windows/win32/api/winerror/nf-winerror-hresult_from_win32): zero and existing failure HRESULTs pass through; positive Win32 errors are converted. Previously, the helper replaced an existing HRESULT's facility bits with `FACILITY_WIN32`. ## What is in it - `util.rs`: preserve inputs that are nonpositive when interpreted as HRESULT, with a contract comment. - `networking.rs`: extend the existing certificate regression to check that `win32_failure_hr` preserves `CERT_E_UNTRUSTEDROOT`. ## Tested I ran debug tests on Windows 11 Pro ARM64 10.0.26100.1742 in UTM (4 GiB RAM, virtual `virt-10.0` CPU, Red Hat VirtIO GPU DOD), using Rust 1.100.0 `x86_64-pc-windows-msvc` and Visual Studio 2022 Build Tools. The guest used main `47efa2ecea0a12934719ae69b81930cf02a4b1c3` plus the source changes committed as `d6b6c50276f8a1e401692235718d2134c34cd5d5`. - `cargo test --locked -p xcl --lib cert_verification_fails_closed_on_malformed_pins_and_zero_win32_errors`: before the fix, **0 passed, 1 failed, 0 ignored**; afterward, **1 passed, 0 failed, 0 ignored**. Both runs filtered out 718 tests. The regression exposed `0x800B0109` being changed to `0x80070109`. - `cargo test --locked -p xcl --lib util::tests -- --test-threads=4`: **5 passed, 0 failed, 0 ignored**, 714 filtered out. No `SKIPPED` output. ## Not tested I have not run the full workspace suite, native x64 Windows hardware, D3D12 GPU execution, live TLS failure scenarios or a real game title. These tests cover conversion and the existing certificate validation regression, not a live certificate-chain failure. ## Regression run Not run. This remains a draft pending the required real-title `xcl-smoke` blocks from main and this PR's clean head, using the same title and duration. ## AI use I used omp (`openai-codex/gpt-6-astra`) to investigate, implement the fix and regression, run the Windows tests, and prepare this PR.
HRESULT_FROM_WIN32 preserves inputs that are nonpositive when interpreted
as HRESULT. The shared helper instead remapped every nonzero input into
FACILITY_WIN32, corrupting an existing certificate failure HRESULT.

Match the Windows conversion rule and cover the certificate failure helper
in its existing regression test. Ordinary positive Win32 errors retain
their existing conversion.

Windows 11 ARM64 VM, x64 MSVC rustc 1.100.0: the certificate regression
failed before the fix and passed afterward (1 passed, 0 failed, 0 ignored).
util::tests passed 5 tests, 0 failed, 0 ignored. Full GPU suite, native x64
hardware and real-title smoke runs remain outstanding.

Assisted-by: omp (openai-codex/gpt-6-astra)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:24 +00:00
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 12:46 UTC · original

Hardware test report — commit d6b6c50

Verified clean merge with main (47efa2e) on d6b6c50276f8a1e401692235718d2134c34cd5d5: pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored (GPU tests skipped on this adapter: none), including hle::xgameruntime::networking::tests::cert_verification_fails_closed_on_malformed_pins_and_zero_win32_errors

Regression run
main (47efa2e):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14853 MB

PR (d6b6c50):

xcl-smoke v1
commit: d6b6c50276f8a1e401692235718d2134c34cd5d5
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14856 MB

Not tested

  • live TLS certificate-failure paths in online gameplay; gameplay past the menus

AI use: Antigravity (Google DeepMind), Gemini (exact version string not exposed in runtime environment) — ran the workspace test suite and 60 s retail smoke check on the hardware above and formatted this report.

**@⁠eizispark** on GitHub · 2026-11-24 12:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/1129#issuecomment-7131896761) ### Hardware test report — commit `d6b6c50` Verified clean merge with `main` (`47efa2e`) on `d6b6c50276f8a1e401692235718d2134c34cd5d5`: **pass**. **Tested** - Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `741 passed, 0 failed, 41 ignored` (GPU tests skipped on this adapter: `none`), including `hle::xgameruntime::networking::tests::cert_verification_fails_closed_on_malformed_pins_and_zero_win32_errors` **Regression run** `main` (`47efa2e`): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14853 MB ``` PR (`d6b6c50`): ``` xcl-smoke v1 commit: d6b6c50276f8a1e401692235718d2134c34cd5d5 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1679 (PresentX 1679) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14856 MB ``` **Not tested** - live TLS certificate-failure paths in online gameplay; gameplay past the menus **AI use**: Antigravity (Google DeepMind), Gemini (exact version string not exposed in runtime environment) — ran the workspace test suite and 60 s retail smoke check on the hardware above and formatted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:02 UTC · original

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!

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

Merge

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