Skip to content

xgameruntime: XNetworkingImpl answers for IXNetworkingImpl2's id, as XCurl asks - #2999

Closed
Dom-in wants to merge 4 commits into
ItsNotRexed:mainfrom
Dom-in:xnetworking-iid
Closed

Dom-in wants to merge 4 commits into
ItsNotRexed:mainfrom
Dom-in:xnetworking-iid

Conversation

@Dom-in

@Dom-in Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Depends on: #2203 (it adds the inherited-interface list that RuntimeObject answers for). Follow-up to the merged XNetworkingImpl (5f5d6d1).

The bug

The merged XNetworkingImpl answers QueryInterface only for its class id and IUnknown. But XCurl.dll's thunks call QueryApiImpl with the class id in rcx and IXNetworkingImpl2's id (bf2346b2-39af-4658-b5ea-44713c7e83b3) in rdx. Measured in the package's XCurl.dll, every networking thunk (e.g. at +0x5400, +0x5477, +0x5502, +0x559f, +0x562a) does:

lea rdx, [IXNetworkingImpl2 id]
lea rcx, [XNetworkingImpl class id]
call QueryApiImpl

So on main each of XCurl's networking calls gets E_NOINTERFACE, and none of the served slots is reached. The existing tests only query with the class id as the interface id, so they didn't catch it.

The fix

g_networking lists IXNetworkingImpl2 among the interfaces it answers for. A new check asks exactly the way XCurl does.

Tested

Windows 11, MSVC Release, on main 77444fa + #2203:

  • xgameruntime_test: the new check passes. Negative control: the same test against the unfixed xgameruntime.cpp gives FAIL QueryApiImpl hands out XNetworkingImpl when asked with IXNetworkingImpl2's id.
  • ctest -R "xgameruntime|tiny_gdk": 2/2.

AI-assisted (Claude Code). Disassembly read locally, counts and addresses only, no game data.

🤖 Generated with Claude Code

Dom-in and others added 4 commits November 22, 2026 19:01
…ApiImpl

libHttpClient.GDK.dll asks QueryApiImpl for XSystemImpl with IXSystemImpl5's
interface id and calls slots 3-8 (thunks disassembled, no code run): three
(size, buffer, used) id queries, then two pointers, one pointer and a bool:
xgameruntime-docs' IXSystemImpl list (console id, Xbox Live sandbox id,
app-specific device id), IXSystemImpl3's (XSystemHandleTrack,
XSystemIsHandleValid) and IXSystemImpl4's (XSystemAllowFullDownloadBandwidth),
IXSystemImpl2 and 5 adding no known method.

Offline answers: the existing 39-byte console-id placeholder, sandbox
RETAIL, a 45-byte app-specific device-id placeholder (short buffers get
ERROR_INSUFFICIENT_BUFFER, null E_INVALIDARG), handle tracking accepted and
never called back, a non-null handle valid, bandwidth S_OK.

docs/runtime_imports.md: libHttpClient calls five classes through thunks
(not only an id table, as the table said): their slot ranges, with the
XSystemImpl and XPackageImpl rows. xgameruntime_test +5 checks (74).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…loadBandwidth void

Checked against Microsoft's reference pages: bool XSystemIsHandleValid(
XSystemHandle) and void XSystemAllowFullDownloadBandwidth(bool). Slot 7
returned an HRESULT, so S_OK (0) read as "not valid" to a conforming
caller. The test calls both with the documented types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x id needs 16 bytes

Review (@Flyander):
- QueryInterface accepted the class id and IXSystemImpl5 only. The IDL
  chain is IXSystemImpl5 : IXSystemImpl4 : IXSystemImpl3 : IXSystemImpl2 :
  IXSystemImpl (xgameruntime include/xsystem.idl), so every one of them is
  served by the same vtable. RuntimeObject now carries a null-terminated
  list of interface ids instead of one newer id (XNetworkingImpl's list is
  IXNetworkingImpl2).
- XSystemGetXboxLiveSandboxId requires sandboxIdSize >=
  XSystemXboxLiveSandboxIdMaxBytes (16); buffers of 7-15 bytes returned
  S_OK. copy_id takes the API minimum.

Tests: a 15-byte sandbox buffer is refused, 16 accepted; all five
IXSystemImpl ids give the same object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…XCurl asks

XCurl.dll's thunks call QueryApiImpl with the class id in rcx and
IXNetworkingImpl2's id (bf2346b2-...) in rdx; the object answered only for the
class id, so every XCurl networking call got E_NOINTERFACE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzEmmazz

Copy link
Copy Markdown
Contributor

Tested 94d2e3af, applied alone on main 16282101: pass. Windows 11 (26200), MSVC 14.50 (VS 2026), Ninja RelWithDebInfo.

  • Only the test change: xgameruntime_test reports "2 of 74 checks failed", so the new checks catch the old behaviour.
  • The whole PR: xgameruntime_test exits 0.

No game files: I did not run it against the package's XCurl.dll.

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 94d2e3a on Windows 11, RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1): ctest -R "xgameruntime|tiny_gdk" (MSVC, RelWithDebInfo, LEONIDA_VK_DEVICE set per run) — pass on both, 2/2 each (xgameruntime: "xgameruntime_test: OK (80 checks)"; run_tiny_gdk_load passed).
These two tests do not use the GPU, so the device setting makes no difference to them. No negative control was run.

AI-assisted.

@steamaze0

Copy link
Copy Markdown

Tested 94d2e3a on NVIDIA RTX 5060 Ti (Blackwell), NVIDIA 621.01 (Vulkan 1.4.357), Windows 11, VS Build Tools 2022 (MSVC) + Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0: pass.

  • xgameruntime and run_tiny_gdk_load: PASS (the XNetworkingImpl IID answer for IXNetworkingImpl2).
  • ctest --output-on-failure -j4: 121 passed, 0 failed (game-data/optional skipped) — same as main, no regression.

AI-assisted (Qoder): I built the full runtime with MSVC and ran ctest.

@FaKL-Code

Copy link
Copy Markdown
Contributor

Tested 94d2e3a (merged onto main 1628210) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass

  • Merges cleanly onto main.
  • ctest: 120 of 120 pass (same 8 skips as main). Loader test passes; validation run: 48 tests clean (2 skipped, as on main).
  • xgameruntime: "OK (80 checks)". The new checks pass: XNetworkingImpl answers for its class id and for IXNetworkingImpl2's id and is the same object both ways. Slots 11 to 15 resolve to the expected functions. XSystemImpl is handed out for IXSystemImpl5 and answers for every interface in its chain. Slots 3, 4 and 5 give the sizes the test expects, including the 16-byte sandbox buffer.
  • One new MSVC warning against main: runtime/test/xgameruntime_test.cpp(389,14): warning C4456: declaration of 'all' hides previous local declaration. The new bool all in the IXSystemImpl chain check shadows the one at line 185. It's harmless, but renaming it (e.g. chain_ok) keeps the build warning-free.

AI-assisted (Claude).

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing as already on main: 99e5a1d brought kNetworkingIids with IXNetworkingImpl2's id (from #2203's earlier branch), and xgameruntime_test already asks the way XCurl does ("QueryApiImpl hands out XNetworkingImpl for IXNetworkingImpl2"). Thanks @zzEmmazz and @Vonsek for testing it.

@mesterember104-cpu

Copy link
Copy Markdown

Tested 94d2e3a on Tiger Lake (Xe-LP) iGPU 0x9a78, driver 32.0.101.7088, Windows 11, MSVC 14.44: pass

Full ctest -C RelWithDebInfo: 110/112 pass — the 2 failures are the known Intel-main pair (d3d12_buffer_tiles, d3d12_descriptor), failing the same way on main, untouched by this PR (skips: shader_library_corpus, vk_sync_validation, d3d12_queue_wait, d3d12_rgb9e5_rtv, d3d12_first_light; gameinput Disabled).

The PR's own area: ctest -R "xgameruntime|tiny_gdk" 2/2; xgameruntime_test: OK (80 checks), including the new check exactly the way XCurl.dll asks it: PASS QueryApiImpl hands out XNetworkingImpl when asked with IXNetworkingImpl2's id, as XCurl.dll asks. The branch (built on the #2203 stack) shows the inherited-interface list answering correctly on Intel.

AI-assisted (GLM, operated by the account owner).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants