Implement the build 19041 xvcmgmt four-counter query #229

Closed
github-bot wants to merge 1 commit from gh-pr/229/head into gh-pr/229/base
Owner

@⁠bambermf on GitHub · 2026-11-23 06:14 UTC · original
bambermf:port/xvcmgmt-19041-counter-group → main · +43 −1 · 2 files · 1 commits · closed without merging

Library / area — console-sandbox, xvcmgmt system counter queries on build 19041.

Exports changed — none. Adds device request 0x150064 to the existing xvcmgmt dispatch path.

Source of behaviour — I traced the PIX tooling allocator in Fortnite's pixrt10.dll through headless IDA MCP. That allocator reads the existing single-counter request 0x150068. The adjacent request 0x150064 in the same build's xvcmgmt.sys reads four different SFR counters. This PR implements the four-counter request. I verified its handler at RVA 0x199d with IDA and ran its original instructions in Unicorn with a controlled XvioSfrCounterGet response.

What was wrong

The sandbox already allowed a caller to update individual counters and read them back. Reading the four counters together returned STATUS_INVALID_DEVICE_REQUEST on build 19041.

Measurements

Output capacity Original handler status Counter IDs read Bytes reported
0 or 32 STATUS_INVALID_PARAMETER none 0
33 success 40, 41, 42, 43 33
40 success 40, 41, 42, 43 33

On success the first 32 bytes contain the four 64-bit values in that order, byte 32 is zero, and the following guard byte is untouched. The failure path makes no reads and leaves output untouched.

The change

Handle the request on build 19041 using the same in-process SFR store that backs the individual reads and updates. The request accepts unaligned output and reports the driver's exact completion length. Newer driver versions were not measured.

Tests

The regression test sets four distinct 64-bit values through the update request and reads them through the public device dispatch. It checks the short-buffer error, completion event and byte count, all values, the trailing zero and both guards. Only Rust source and tests are included.

The full console-sandbox release suite passed on Windows x64 (39 tests). The local PR gate checked two files and found zero problems.

**@⁠bambermf** on GitHub · 2026-11-23 06:14 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/229) `bambermf:port/xvcmgmt-19041-counter-group` → `main` · +43 −1 · 2 files · 1 commits · closed without merging **Library / area** — console-sandbox, xvcmgmt system counter queries on build 19041. **Exports changed** — none. Adds device request 0x150064 to the existing xvcmgmt dispatch path. **Source of behaviour** — I traced the PIX tooling allocator in Fortnite's pixrt10.dll through headless IDA MCP. That allocator reads the existing single-counter request 0x150068. The adjacent request 0x150064 in the same build's xvcmgmt.sys reads four different SFR counters. This PR implements the four-counter request. I verified its handler at RVA 0x199d with IDA and ran its original instructions in Unicorn with a controlled XvioSfrCounterGet response. ### What was wrong The sandbox already allowed a caller to update individual counters and read them back. Reading the four counters together returned STATUS_INVALID_DEVICE_REQUEST on build 19041. ### Measurements | Output capacity | Original handler status | Counter IDs read | Bytes reported | |---:|---|---|---:| | 0 or 32 | STATUS_INVALID_PARAMETER | none | 0 | | 33 | success | 40, 41, 42, 43 | 33 | | 40 | success | 40, 41, 42, 43 | 33 | On success the first 32 bytes contain the four 64-bit values in that order, byte 32 is zero, and the following guard byte is untouched. The failure path makes no reads and leaves output untouched. ### The change Handle the request on build 19041 using the same in-process SFR store that backs the individual reads and updates. The request accepts unaligned output and reports the driver's exact completion length. Newer driver versions were not measured. ### Tests The regression test sets four distinct 64-bit values through the update request and reads them through the public device dispatch. It checks the short-buffer error, completion event and byte count, all values, the trailing zero and both guards. Only Rust source and tests are included. The full console-sandbox release suite passed on Windows x64 (39 tests). The local PR gate checked two files and found zero problems.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:14:50 +00:00
github-bot closed this pull request 2026-11-26 06:14:50 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:45 UTC · original

Applied locally on main with your authorship kept (cherry-picked, 32098a1); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:45 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/229#issuecomment-7102980937) Applied locally on main with your authorship kept (cherry-picked, 32098a1); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠kiwe147 on GitHub · 2026-11-23 18:57 UTC · original

Tested head cbfa7a9a49, applied with git apply (whitespace ignored, the line endings of my checkout differ) on main f89e410, together with #199, #232 (one tree; the PRs touch different files). It applied without conflicts and built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1.

run result
cargo test -p console-sandbox 42 passed, 0 failed

No new failure against main f89e410 in any of these. This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

**@⁠kiwe147** on GitHub · 2026-11-23 18:57 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/229#issuecomment-7110885118) Tested head `cbfa7a9a49`, applied with `git apply` (whitespace ignored, the line endings of my checkout differ) on `main` `f89e410`, together with #199, #232 (one tree; the PRs touch different files). It applied without conflicts and built. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1. | run | result | |---|---| | `cargo test -p console-sandbox` | 42 passed, 0 failed | No new failure against `main` `f89e410` in any of these. This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code)
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:09 UTC · original

Applied on main in 32098a1 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/229#issuecomment-7163365481) Applied on main in 32098a1 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.