runtime: answer XStoreCreateContext offline under the fake user #1463
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1470"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T12:12:55Z.
Change
With
X2W_RUNTIME_PROXY=1andX2W_FAKE_USER=1, store-interface method 3(
XStoreCreateContexton provider0dd112ac) writes one offline contexthandle for the local user and returns success. It no longer falls through to
E_FAIL. Other store methods are not answered, and any other family that isstill passed the local user handle still returns
0x80004005.The layout is the public GDK call (user, context out) at vtable slot 3, after
QueryInterface,AddRefandRelease. The offline success matches theVIctory runtime notes already cited in
runtime_proxy.cpp: one context, andcatalog, licence and purchase calls left unanswered.
tests/startup_stub_check.pydrives astorescenario on the source-builtconsumer. The answered call prints the context handle. The same call with the
provider id mutated prints
store refused 80004005and leaves the outputunchanged. No system
xgameruntime.dllis required.Refs #1147
Verification
Commit
ac0b5c8aonx2w-store-method-3, rebased ontoorigin/main(
c694231a). MSVC 19.42. Both presets reconfigured during the build and builtstartup_stub_consumer.ctest --preset dev --no-tests=error -R '^startup_stubs$' -VPassed (1.86 s). Exports, trap exits, the
noneandphysicalcontrols, thedstorage control,
dstorage page-array control: exit=0 okandstore context: exit=0 okall passed.ctest --preset release --no-tests=error -R '^startup_stubs$' -VPassed (0.89 s), with the same page-array and
store context: exit=0 oklines.No system
xgameruntime.dllwas installed. These checks do not load it.Evidence and follow-up
The new case is source-built. It compiles
runtime_proxy.cppinto theexisting stub consumer and calls the same
forwardpath the GameInputstand-in uses. There is no new binary fixture and no game data.
Assumption: method 3 of
XStoreImpl(0dd112ac-7c24-448c-b92b-3960fb5bd30c)is
XStoreCreateContext, from the public GDK signature and the public runtimeclass layout (first method after
IUnknown). A null context pointer returns0x80070057and is not written. A user other than the local user is notanswered by this change.
Other store methods (catalog, licence, purchase) still hit the existing
E_FAILfallback when they carry the local user handle. That is left for alater change.
Checklist
AI-assisted (Grok Build).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:57:36Z.
Review: COMMENTED
Reviewed at commit
c26c3733a435b5a827953911ebbda616dbfa029b:Code & Diff Audit
src/startup_stubs/api_trace.handsrc/startup_stubs/runtime_proxy.cpp: answeringXStoreCreateContext(0x0dd112acslot 3) only whenargs[0] == local_user_handleis clean, validatesout(args[1], 8)with0x80070057(E_INVALIDARG), and writesstore_context_handle.tests/startup_stub_consumer.cpp&tests/startup_stub_check.py: exercises the positive path underX2W_RUNTIME_PROXY=1andX2W_FAKE_USER=1, mutated provider ID refusal (0x80004005without modifying the output buffer), and null output pointer (0x80070057). Minor note:store_method3_check()does not include a negative control for a non-local user handle (args[0] != local_user_handle), though the guard inarea_call()is straightforward.git merge-tree --write-tree origin/main HEADreports a content merge conflict indocs/startup-runtime.mdagainst currentorigin/mainthat needs a rebase/merge resolution.Verification
tests/docs_links_check.py(16 files, 330 links),tests/bidi_controls_check.py(1,207 files), andgit diff --check origin/main..HEADall passed.--preset dev):startup_stubs1/1 passed (0.49s; build26.27s)./O2(--preset release):startup_stubs1/1 passed (0.57s; build39.97s).Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T13:24:46Z.
@tedin7 Thanks for the review. The docs/startup-runtime.md conflict was already resolved in
ac0b5c8a(rebased ontoc694231a).Added the non-local user control in
6a87f6a0: store_method3_check() now calls XStoreCreateContext with local_user_handle ^ 1 and requires 0x80004005 with the output left at 0x1111111111111111. area_call() now refuses a non-local user explicitly instead of falling through to the real method.Retested on Windows 11 26200, MSVC 19.42: startup_stubs passes in dev (1.15 s) and release (0.79 s), ctest exit 0 for both.
AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:51:17Z.
Maintainer update at
d8af3c18matches the full provider GUID. Windows Release source-built store control accepts the local context for that provider and refuses the same first GUID word with a different suffix, a foreign user, and a missing output pointer. Commerce and licensing remain outside the fixture scope.Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T15:27:36Z.
Both halves of the offline answer are covered — the user check and the handle itself
Independent reviewer, not the author. Reviewed the current head; nothing pushed to the branch. Mutations were made
locally in
src/startup_stubs/runtime_proxy.cpp, reverted between each; working tree is clean.Environment: Windows 11 build 26300.9974, MSVC 14.44.35207, SDK 10.0.26100.
xgameruntime_contractsandxgameruntime_preflight_stub_refusedalso pass on this head; I ran them because they sharethe shim surface.
Mutation 1 — the non-local user is no longer refused
The fixture prints the call trace and catches it, so "only the local user is answered" is asserted rather than described.
Note the trace also shows the non-local handle differing only in the last word, which is exactly the case a sloppy
pointer comparison would miss.
Mutation 2 — the answer writes a zero handle instead of the context
So the returned handle is checked, not only the
HRESULT: a success with a null context is still a failure here.What I did not drive
The
E_INVALIDARGpath for an unwritable output buffer. Forcing it means passing a bad pointer through the proxy, whichwould fault in the test process rather than exercise the guard, so I left it — if there is a way you test it that I am
missing, say so and I will run it.
Verdict
Reviewed the current head. Builds clean, the consumer passes, and two independent mutations are caught with distinct exit
codes (7 and 4). No objection from me.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T17:38:03Z.
@ChazY11 Thanks for the independent review and the two mutations. I don't drive the E_INVALIDARG path either: a bad output pointer faults before the guard can be observed, so it is only covered by reading the code.
AI-assisted (Grok Build)