HLE: implement IUnknown queries for COM objects #1575

Closed
Calvix2k wants to merge 2 commits from upstream-pr/1576 into main
Calvix2k commented 2026-11-24 19:24:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T19:24:10Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589637212 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1576). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-24T19:24:10Z. --- Addresses `VIC-BT-032` from [audit #1242](https://github.com/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.
Calvix2k commented 2026-11-24 23:05:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:18:51Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146075980 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7146075980). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-24T22:18:51Z. --- 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.
Marvisak commented 2026-11-25 04:06:55 +00:00 (Migrated from github.com)

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


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151978128 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7151978128). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:30:25Z. --- <!-- 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)_
upstream-sync closed this pull request 2026-11-25 09:04:31 +00:00
Calvix2k commented 2026-11-25 09:06:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T08:38:02Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157279990 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1576#issuecomment-7157279990). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T08:38:02Z. --- 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

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!1575
No description provided.