Skip to content

HLE: implement IUnknown queries for COM objects - #1576

Closed
Calvix2k wants to merge 2 commits into
Marvisak:mainfrom
Calvix2k:codex/hle-iunknown-query-interface-032
Closed

Calvix2k wants to merge 2 commits into
Marvisak:mainfrom
Calvix2k:codex/hle-iunknown-query-interface-032

Conversation

@Calvix2k

@Calvix2k Calvix2k commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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
Calvix2k force-pushed the codex/hle-iunknown-query-interface-032 branch 2 times, most recently from f32980a to 29dd901 Compare November 25, 2026 00:48
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
@Calvix2k
Calvix2k force-pushed the codex/hle-iunknown-query-interface-032 branch from 29dd901 to b380544 Compare November 25, 2026 02:17

Copy link
Copy Markdown
Owner

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

@Calvix2k

Copy link
Copy Markdown
Contributor Author

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 Calvix2k closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants