Repository navigation
Conversation
|
Further confirmation of the layout: |
Flyander
left a comment
There was a problem hiding this comment.
Slot 13 has an ABI mismatch that can corrupt the caller buffer. The documented result signature after the callback context is (XAsyncBlock*, size_t bufferByteCount, size_t* bufferByteCountUsed, uint8_t* buffer, XNetworkingSecurityInformation** information), but net_security_result currently orders the last three as buffer, information, used. See Microsoft's ANSI and UTF-16 contracts: https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/networking/xnetworking/functions/xnetworkingquerysecurityinformationforurlasyncresult?view=gdk-2604 and https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/networking/xnetworking/functions/xnetworkingquerysecurityinformationforurlutf16asyncresult?view=gdk-2510 .
With a conforming call that passes a non-null buffer and separate output pointers, the current body writes nullptr into the first pointer-sized bytes of the caller buffer, writes zero through the information output, and never initializes bufferByteCountUsed. This happens before XAsyncGetStatus returns the offline error. Please correct the thunk signature and test slot 13 with a sentinel buffer and distinct output values; slot 10 uses the same helper and needs the matching ANSI ABI too.
|
Tested
AI-assisted (Claude Code). |
|
@Flyander thanks, you're right. Fixed in 14391ff: slots 10 and 13 now take |
Flyander
left a comment
There was a problem hiding this comment.
The ABI correction is present in the current head: slots 10 and 13 now follow the documented argument order, and the added sentinel checks verify that the caller buffer remains untouched while both output parameters are initialized. The reported xgameruntime test and independent Windows run cover the fix. I found no remaining blocker.
XCurl.dll asks QueryApiImpl for XNetworkingImpl with IXNetworkingImpl2's interface id and calls slots 11-17 (measured with the ItsNotRexed#1877 thunk disassembly, docs/runtime_imports.md): the UTF-16 URL security-information async trio, the server certificate check, the connectivity hint and its change registration. QueryApiImpl refused the class, so each of those calls failed with class-not-provided. The class answers as a console without a network: the connectivity hint is initialized with level None; the preferred-port and URL security-info queries fail with HRESULT_FROM_WIN32(ERROR_NETWORK_UNREACHABLE), the *Async ones by completing their XAsyncBlock with it through XAsyncRun; the certificate check fails the same way; change registrations return tokens whose callbacks never fire; IXNetworkingImpl2's three additions are E_NOTIMPL. RuntimeObject gains an optional newer interface id so QueryInterface answers IXNetworkingImpl2 too. xgameruntime_test (+8 checks, 69): both interface ids, the hint, the async call completing with no network and its result size, the certificate check, register/unregister, the port query and slot 20. tiny_gdk_load's refused-class check uses an id no class has. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review (@Flyander): XNetworkingQuerySecurityInformationForUrl[Utf16]AsyncResult is (XAsyncBlock*, size_t bufferByteCount, size_t* bufferByteCountUsed, uint8_t* buffer, XNetworkingSecurityInformation** information); slots 10 and 13 had the last three as buffer, information, used, so a conforming caller got nullptr written into its buffer and its used count left unset. xgameruntime_test: both slots with a sentinel buffer and distinct outputs; the buffer stays untouched, used and information are zeroed in place (both checks fail with the old order). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14391ff to
42b177e
Compare
|
Closing: XNetworkingImpl was served on |
Claimed on #2078: #2078 (comment). A follow-up of #1877 (merged).
What and why
XCurl.dllasksQueryApiImplforXNetworkingImpl(class37e56907-…) withIXNetworkingImpl2's interface id (bf2346b2-…). It then calls slots 11–17, measured with the same thunk disassembly as #1877 (docs/runtime_imports.md, "Class layouts, measured"):XNetworkingVerifyServerCertificate;XNetworkingGetConnectivityHint;XNetworkingRegister/UnregisterConnectivityHintChanged.QueryApiImplrefused the class, so every one of those calls failed with "class not provided" instead of the answer an offline console gives.The change (
runtime/shims/xgameruntime.cpp)A 21-slot vtable: IUnknown,
IXNetworkingImpl's 15 methods in the documented order, thenIXNetworkingImpl2's 3. The signatures follow Microsoft's public XNetworking docs. It answers as a console with no network:networkInitialized = true, level None (1), cost unknown, no data-limit or roaming flags.HRESULT_FROM_WIN32(ERROR_NETWORK_UNREACHABLE). The*Asyncones start normally and complete theirXAsyncBlockwith that error throughXAsyncRun, so a caller waiting on the block gets it;*ResultSize/*Resultreturn it with zeroed outputs.VerifyServerCertificatefails the same way.E_NOTIMPL.RuntimeObjectgains an optional newer interface id, soQueryInterfaceanswersIXNetworkingImpl2as well as the class id. The threading and error objects are unchanged.Tests
xgameruntime_test: 8 new checks, 69 total. They cover both interface ids giving one object, the hint values, the slot-11 async call completing with no network (XAsyncGetStatus(…, true)) and slot 12's result size, slot 14, register/unregister via slots 16/17, the slot-3 port query, and slot 20 =E_NOTIMPL.run_tiny_gdk_load: its refused-class check now uses an id no runtime class has, sinceXNetworkingImplis served.ctest -R "xgameruntime|tiny_gdk|loader": 6/6 on Windows 11 / MSVC.Disclosure: written with an AI assistant (Claude Code). I reviewed it and ran the tests above.
🤖 Generated with Claude Code