HLE: implement IUnknown queries for COM objects #1576

Closed
github-bot wants to merge 2 commits from gh-pr/1576/head into gh-pr/1576/base
Owner

@⁠Calvix2k on GitHub · 2026-11-24 19:24 UTC · original
Calvix2k:codex/hle-iunknown-query-interface-032 → main · +348 −84 · 14 files · 2 commits · closed without merging

Addresses VIC-BT-032 from audit #1242.

Summary

  • Implement QueryInterface for the HLE COM objects in XAsync, XUser, XGameSave, DirectStorage, and the remaining runtime areas (display, speech, storage, xgame, xgameui, xnetworking, xpackage, xstore, xsystem).
  • Support the universal IUnknown IID, call the object's actual AddRef slot, and return E_NOINTERFACE with a cleared output pointer for unsupported IIDs.
  • Return E_POINTER for null required pointers.
  • Walk every runtime interface in a test and check both the IUnknown and unknown-IID paths.

Validation

  • cargo test -p victory-hle --locked -- --test-threads=1 — passed (97 unit tests and 1 integration test).
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings — passed.
  • cargo xtask policy — passed (154 files).
  • rustfmt --edition 2024 --check on changed files — passed.

This implements IUnknown identity behavior; object-specific interface IIDs remain unsupported unless separately implemented.

**@⁠Calvix2k** on GitHub · 2026-11-24 19:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1576) `Calvix2k:codex/hle-iunknown-query-interface-032` → `main` · +348 −84 · 14 files · 2 commits · closed without merging Addresses `VIC-BT-032` from [audit #1242](https://git.gtahub.st/github/Marvisak--VIctory/issues/1242). ## Summary - Implement `QueryInterface` for the HLE COM objects in XAsync, XUser, XGameSave, DirectStorage, and the remaining runtime areas (display, speech, storage, xgame, xgameui, xnetworking, xpackage, xstore, xsystem). - Support the universal `IUnknown` IID, call the object's actual `AddRef` slot, and return `E_NOINTERFACE` with a cleared output pointer for unsupported IIDs. - Return `E_POINTER` for null required pointers. - Walk every runtime interface in a test and check both the IUnknown and unknown-IID paths. ## Validation - `cargo test -p victory-hle --locked -- --test-threads=1` — passed (97 unit tests and 1 integration test). - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings` — passed. - `cargo xtask policy` — passed (154 files). - `rustfmt --edition 2024 --check` on changed files — passed. This implements IUnknown identity behavior; object-specific interface IIDs remain unsupported unless separately implemented.
The shared QueryInterface helper now backs slot 0 of the display, speech,
storage, xgame, xgameui, xnetworking, xpackage, xstore and xsystem COM
objects as well, so every runtime object answers IID_IUnknown with an
AddRef'd identity and clears the output pointer for unknown IIDs.

Add a test that walks every runtime interface and checks both paths.

Validation:
- cargo test -p victory-hle --locked -- --test-threads=1
- cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings
- cargo xtask policy
- rustfmt --edition 2024 --check on changed files
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:36:57 +00:00
github-bot closed this pull request 2026-11-26 04:36:57 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 22:18 UTC · original

Rebased onto 70564ae; only a formatting hunk in dstorage.rs conflicted (upstream added page_destinations to the trace line). Kept upstream's field and finished the rebase.

Validation: cargo test -p victory-hle --locked -- --test-threads=1 — 100 passed + 1 + 1, 0 failed; clippy -D warnings and cargo xtask policy (174 files) clean.

**@⁠Calvix2k** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7146075980) Rebased onto 70564ae; only a formatting hunk in `dstorage.rs` conflicted (upstream added `page_destinations` to the trace line). Kept upstream's field and finished the rebase. Validation: `cargo test -p victory-hle --locked -- --test-threads=1` — 100 passed + 1 + 1, 0 failed; clippy `-D warnings` and `cargo xtask policy` (174 files) clean.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:30 UTC · original

Automated triage for the maintainers.

Needs work. A shared query_interface in xgameruntime.rs replaces missing::<0> in every runtime vtable. It answers only IID_IUnknown and returns E_NOINTERFACE for everything else, including each object's own interface id, although COM requires a query for the object's own interface to succeed. The change also stops the "runtime method not implemented" log that would show when a title calls slot 0, and xuser.rs notes that no title has been seen calling these slots. Please answer the object's own interface id (from INTERFACES), keep a warning for other ids, and show that a title calls QueryInterface. Please also drop the unrelated reformatting in xasync.rs, dstorage.rs, xgamesave.rs and others. CI passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7151978128) <!-- victory-triage v1 head=b380544a8670335f32ba548cd4202baf87ef41cd verdict=needs-work at=2026-11-25T03:34:40Z --> Automated triage for the maintainers. **Needs work.** A shared `query_interface` in `xgameruntime.rs` replaces `missing::<0>` in every runtime vtable. It answers only IID_IUnknown and returns E_NOINTERFACE for everything else, including each object's own interface id, although COM requires a query for the object's own interface to succeed. The change also stops the "runtime method not implemented" log that would show when a title calls slot 0, and `xuser.rs` notes that no title has been seen calling these slots. Please answer the object's own interface id (from `INTERFACES`), keep a warning for other ids, and show that a title calls QueryInterface. Please also drop the unrelated reformatting in `xasync.rs`, `dstorage.rs`, `xgamesave.rs` and others. CI passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 08:38 UTC · original

Closing this one: as the triage says, the helper as written answers only IID_IUnknown and returns E_NOINTERFACE for each object's own id, which is not a correct COM object — it trades a logged "not implemented" for a wrong answer. Fixing it properly means threading each object's own id through the vtables, and the PR as it stands also carries formatting-only changes across a dozen modules, which makes it hard to review for that.

The trigger is also still unobserved: the note in xuser.rs says no title has been seen calling slot 0 on these tables, and this PR never shows one either. The GameInput objects, where a title does query, are covered by #1942.

If a trace turns up a title calling QueryInterface on one of these runtime vtables, the narrow change is: answer IID_IUnknown and the object's own id from its table, warn for any other id, and touch nothing else. I will do that then.

**@⁠Calvix2k** on GitHub · 2026-11-25 08:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7157279990) Closing this one: as the triage says, the helper as written answers only `IID_IUnknown` and returns `E_NOINTERFACE` for each object's own id, which is not a correct COM object — it trades a logged "not implemented" for a wrong answer. Fixing it properly means threading each object's own id through the vtables, and the PR as it stands also carries formatting-only changes across a dozen modules, which makes it hard to review for that. The trigger is also still unobserved: the note in `xuser.rs` says no title has been seen calling slot 0 on these tables, and this PR never shows one either. The GameInput objects, where a title does query, are covered by #1942. If a trace turns up a title calling `QueryInterface` on one of these runtime vtables, the narrow change is: answer `IID_IUnknown` and the object's own id from its table, warn for any other id, and touch nothing else. I will do that then.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1576
No description provided.