HLE: an unknown gamertag component is an invalid argument #2070

Open
0xkn0wh3r3 wants to merge 1 commit from upstream-pr/2072 into main
0xkn0wh3r3 commented 2026-11-25 04:22:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T04:22:56Z.


The problem

XUserGetGamertag documents E_INVALIDARG for an invalid gamertagComponent. The valid values (XUserGamertagComponent) are Classic 0, Modern 1, ModernSuffix 2 and UniqueModern 3.

VIctory's get_gamertag (crates/victory-hle/src/modules/xuser.rs) answered any value other than the modern suffix with the gamertag, so a title passing a bad component got a name back instead of an error.

The fix

  • Values past 3 are now refused with E_INVALIDARG.
  • Values 0-3 answer as before. The offline gamertag fits every documented size.

Testing

  • New unit test an_unknown_gamertag_component_is_an_invalid_argument: asks for components 4, 5 and u32::MAX through both slots that serve the call, and checks each returns E_INVALIDARG.
  • cargo test -p victory-hle: all pass. cargo clippy -p victory-hle --all-targets: clean.
  • With this and the other conformance fixes merged onto #2057's branch, its suite passes 151 of 152 checks (the remaining one, the console id, is #1717).
  • Not run with a title (no game data here).
  • Found by the conformance title in #2057, which lists this check as a known divergence. Whichever of the two merges second takes the entry off the test's KNOWN list (a listed check that passes fails that test).
<!-- greyfinch-sync:Marvisak/VIctory:issue:5485131536 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2072). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T04:22:56Z. --- ## The problem `XUserGetGamertag` documents `E_INVALIDARG` for an invalid `gamertagComponent`. The valid values (`XUserGamertagComponent`) are Classic 0, Modern 1, ModernSuffix 2 and UniqueModern 3. VIctory's `get_gamertag` (`crates/victory-hle/src/modules/xuser.rs`) answered any value other than the modern suffix with the gamertag, so a title passing a bad component got a name back instead of an error. ## The fix - Values past 3 are now refused with `E_INVALIDARG`. - Values 0-3 answer as before. The offline gamertag fits every documented size. ## Testing - New unit test `an_unknown_gamertag_component_is_an_invalid_argument`: asks for components 4, 5 and `u32::MAX` through both slots that serve the call, and checks each returns `E_INVALIDARG`. - `cargo test -p victory-hle`: all pass. `cargo clippy -p victory-hle --all-targets`: clean. - With this and the other conformance fixes merged onto #2057's branch, its suite passes 151 of 152 checks (the remaining one, the console id, is #1717). ## Not covered / Related - Not run with a title (no game data here). - Found by the conformance title in #2057, which lists this check as a known divergence. Whichever of the two merges second takes the entry off the test's `KNOWN` list (a listed check that passes fails that test).
catminou4 commented 2026-11-25 04:26:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:26:30Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

Unknown gamertag component returns invalid-argument — XUser error-code correctness; matches GDK behavior.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051851042 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2072#pullrequestreview-6051851042). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T04:26:30Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. Unknown gamertag component returns invalid-argument — XUser error-code correctness; matches GDK behavior.
DenRakEiw commented 2026-11-25 04:50:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:50:09Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle --lib xuser:: — 3 passed, 0 failed (including an_unknown_gamertag_component_is_an_invalid_argument)
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean E_INVALIDARG return for unknown gamertag components with unit test coverage. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6052018548 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2072#pullrequestreview-6052018548). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T04:50:09Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-hle --lib xuser::` — 3 passed, 0 failed (including `an_unknown_gamertag_component_is_an_invalid_argument`) - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean `E_INVALIDARG` return for unknown gamertag components with unit test coverage. Looks good. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 11:05:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:27:10Z.


Automated triage for the maintainers.

Merge candidate (a recommendation to look, not an approval). The new head is the same change rebased onto current main. get_gamertag in crates/victory-hle/src/modules/xuser.rs returns E_INVALIDARG for a component other than 0-3, and components 0-3 behave as before. The public reference for XUserGetGamertag supports this, and the conformance title in #2057 found the difference. The new test checks both vtable slots that serve the call (GAMERTAG_OBJECT 0x18 and OBJECT 0x78).

The branch merges cleanly. CI: check passing. Whichever of this PR and #2057 merges second must drop the entry from #2057's KNOWN list.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159714392 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2072#issuecomment-7159714392). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T10:27:10Z. --- <!-- victory-triage v1 head=bb907903e3f76fabe5fdb36cc8981c16f8e0de0f verdict=merge-candidate at=2026-11-26T01:20:49Z --> Automated triage for the maintainers. **Merge candidate** (a recommendation to look, not an approval). The new head is the same change rebased onto current `main`. `get_gamertag` in `crates/victory-hle/src/modules/xuser.rs` returns `E_INVALIDARG` for a component other than 0-3, and components 0-3 behave as before. The public reference for `XUserGetGamertag` supports this, and the conformance title in #2057 found the difference. The new test checks both vtable slots that serve the call (`GAMERTAG_OBJECT` 0x18 and `OBJECT` 0x78). The branch merges cleanly. CI: `check` passing. Whichever of this PR and #2057 merges second must drop the entry from #2057's `KNOWN` list. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 19:59:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:59:51Z.

Review: APPROVED


Verified locally merged onto origin/main (63bcca43) at PR head bb907903 (Windows 11 x64):

  • crates/victory-hle/src/modules/xuser.rs (get_gamertag, lines 160-179): explicitly matches XUserGamertagComponent 0..=3 (CLASSIC, MODERN, MODERN_SUFFIX, UNIQUE_MODERN) and returns xasync::E_INVALIDARG on any other value before calling put_string, leaving the caller's output buffer and written-length pointer untouched.
  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-hle --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • cargo test --locked -p victory-hle --lib modules::xuser::: 4/4 passed (including an_unknown_gamertag_component_is_an_invalid_argument exercising both (&GAMERTAG_OBJECT, 0x18) and (&OBJECT, 0x78) vtable slots).
  • Extra synthetic probe (not committed): confirmed components 4, 5, 100, and u32::MAX through both vtable slots return E_INVALIDARG, preserve caller-initialized buffer and used bytes, handle null output pointers without faulting, and keep components 0..=3 returning S_OK as before.

Synthetic tests only; looks ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6079892924 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2072#pullrequestreview-6079892924). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:59:51Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`63bcca43`) at PR head `bb907903` (Windows 11 x64): - `crates/victory-hle/src/modules/xuser.rs` (`get_gamertag`, lines 160-179): explicitly matches `XUserGamertagComponent` `0..=3` (`CLASSIC`, `MODERN`, `MODERN_SUFFIX`, `UNIQUE_MODERN`) and returns `xasync::E_INVALIDARG` on any other value before calling `put_string`, leaving the caller's output buffer and written-length pointer untouched. - `cargo xtask policy`: 191 files ok. - `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` (default and `--all-features`): 0 warnings. - `cargo test --locked -p victory-hle --lib modules::xuser::`: 4/4 passed (including `an_unknown_gamertag_component_is_an_invalid_argument` exercising both `(&GAMERTAG_OBJECT, 0x18)` and `(&OBJECT, 0x78)` vtable slots). - Extra synthetic probe (not committed): confirmed components `4`, `5`, `100`, and `u32::MAX` through both vtable slots return `E_INVALIDARG`, preserve caller-initialized `buffer` and `used` bytes, handle null output pointers without faulting, and keep components `0..=3` returning `S_OK` as before. Synthetic tests only; looks ready to merge.
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/2072:upstream-pr/2072'
git switch 'upstream-pr/2072'

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