startup-runtime: answer the gaming runtime locally when it cannot initialize (X2W_RUNTIME_LOCAL) #1846

Merged
Leyukaka merged 8 commits from upstream-pr/1853 into main 2026-11-25 00:35:08 +00:00
Leyukaka commented 2026-11-24 19:38:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-24T19:38:11Z.


Change

The runtime proxy (src/startup_stubs/runtime_proxy.cpp) wraps the system gaming runtime. Under X2W_FAKE_USER, its local answers live on proxy objects that are created only after a successful real QueryApiImpl; the one exception is persistent local storage (f4faf4d4), which already gets a local object when the real query fails. When the system runtime cannot initialize, for example on a Windows host without Gaming Services, InitializeApiImpl* fails, the real QueryApiImpl fails for the providers below, and none of their local answers is reachable.

This adds an opt-in switch, X2W_RUNTIME_LOCAL=1, effective only together with X2W_RUNTIME_PROXY=1 and X2W_FAKE_USER=1:

  • InitializeApiImpl, InitializeApiImplEx and InitializeApiImplEx2 are wrapped. The real export runs first; a success passes through unchanged. The first failure is logged once and answered with S_OK, and later initialization calls return S_OK without the real export for the rest of the process.
  • After that, a failed QueryApiImpl for the user (01acd177, gamertag interface included), game-save (704c3f58), package (af406016), title (973a344e), connectivity (37e56907) and store (0dd112ac) providers returns a local object with no runtime object behind it. The existing local answers apply; calls that carry the local user or store handle fail as before; any other method returns E_NOTIMPL, logged once per provider and slot, instead of dereferencing a missing object. QueryInterface returns the same object (E_POINTER for a null out pointer); AddRef and Release return 1.
  • Once initialization has been answered locally, XUserAddAsync (user slot 7), and the async blocks the stand-in already completes on behalf of a local answer (complete_async), complete with S_OK through the XAsync provider (073b7dcb). That path needs the real QueryApiImpl to still return the XAsync provider; if it does not, or Begin fails, the call returns that failure. XUserAddResult already returns the local user.
  • Other providers keep the real failure. With the switch off, GetProcAddress returns the same pointers as before and every existing path is unchanged.

The switch is documented in the docs/startup-runtime.md switch table.

Verification

On b067a954 (based on main at 8e2923ae), Windows 11 build 26300, MSVC 14.44.35207:

ctest --preset dev --no-tests=error -R '^startup_runtime_local(_control)?$'

Both pass. tests/startup_runtime_local.cpp includes runtime_proxy.cpp in-process with fake runtime exports (known return codes and call counts) and a fake XAsync service that invokes the caller's completion callback. It checks the switch-off behaviour, the X2W_FAKE_USER gate, the latch and its single log line, the provider allow-list, an unlisted provider, the null-object guard, XUserAddAsync through to XUserAddResult in the completion callback, and complete_async for a local user object. startup_runtime_local_control runs the same binary with --control, which leaves the switch off where the test enables it; it must print FAIL:.

Each of these edits to runtime_proxy.cpp was applied one at a time; the test passed without them and failed or crashed under each:

  1. null-object guard in forward<N> disabled;
  2. latch removed (the real export is retried);
  3. local XUserAddAsync removed;
  4. package provider dropped from the allow-list;
  5. local completion status E_FAIL instead of S_OK;
  6. X2W_FAKE_USER gate removed from the wrapper selection;
  7. "initialization failed" gate removed from the local QueryApiImpl path;
  8. local branch of complete_async removed;
  9. E_POINTER for a null QueryInterface out pointer replaced by S_OK.

The whole ctest --preset dev --no-tests=error -R '^startup_' -j 8 run passes 233 of 239 tests; four are skipped (startup_view_heap_warp, startup_logical_view_warp, startup_root_heap_warp, startup_root_heap_hardware). The two others, startup_list_resubmit_hardware and startup_list_resubmit_untracked_hardware, crash (SegFault, after x2w-render list Close failed 0x80004005) on an NVIDIA GeForce RTX 5080, driver 32.0.16.2101, with the test's X2W_D3D12_DEBUG=1; they crash the same way without this change (measured at 813045b3), and their executable links d3d12_xs_shim, d3d12 and dxgi, none of which contains runtime_proxy.cpp. Their _warp variants pass.

Evidence and follow-up

  • The fixture is source-built (tests/startup_runtime_local.cpp, MIT); it uses no title, package or runtime binary.
  • Not covered: how the system XAsync provider behaves after a failed initialization on a real host. The fixture supplies its own service, so that path is an assumption the code reports on (it returns the failure) rather than a measured result.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6589878249 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-24T19:38:11Z. --- ## Change The runtime proxy (`src/startup_stubs/runtime_proxy.cpp`) wraps the system gaming runtime. Under `X2W_FAKE_USER`, its local answers live on proxy objects that are created only after a successful real `QueryApiImpl`; the one exception is persistent local storage (`f4faf4d4`), which already gets a local object when the real query fails. When the system runtime cannot initialize, for example on a Windows host without Gaming Services, `InitializeApiImpl*` fails, the real `QueryApiImpl` fails for the providers below, and none of their local answers is reachable. This adds an opt-in switch, `X2W_RUNTIME_LOCAL=1`, effective only together with `X2W_RUNTIME_PROXY=1` and `X2W_FAKE_USER=1`: - `InitializeApiImpl`, `InitializeApiImplEx` and `InitializeApiImplEx2` are wrapped. The real export runs first; a success passes through unchanged. The first failure is logged once and answered with `S_OK`, and later initialization calls return `S_OK` without the real export for the rest of the process. - After that, a failed `QueryApiImpl` for the user (`01acd177`, gamertag interface included), game-save (`704c3f58`), package (`af406016`), title (`973a344e`), connectivity (`37e56907`) and store (`0dd112ac`) providers returns a local object with no runtime object behind it. The existing local answers apply; calls that carry the local user or store handle fail as before; any other method returns `E_NOTIMPL`, logged once per provider and slot, instead of dereferencing a missing object. `QueryInterface` returns the same object (`E_POINTER` for a null out pointer); `AddRef` and `Release` return 1. - Once initialization has been answered locally, `XUserAddAsync` (user slot 7), and the async blocks the stand-in already completes on behalf of a local answer (`complete_async`), complete with `S_OK` through the XAsync provider (`073b7dcb`). That path needs the real `QueryApiImpl` to still return the XAsync provider; if it does not, or `Begin` fails, the call returns that failure. `XUserAddResult` already returns the local user. - Other providers keep the real failure. With the switch off, `GetProcAddress` returns the same pointers as before and every existing path is unchanged. The switch is documented in the `docs/startup-runtime.md` switch table. ## Verification On `b067a954` (based on `main` at `8e2923ae`), Windows 11 build 26300, MSVC 14.44.35207: ```text ctest --preset dev --no-tests=error -R '^startup_runtime_local(_control)?$' ``` Both pass. `tests/startup_runtime_local.cpp` includes `runtime_proxy.cpp` in-process with fake runtime exports (known return codes and call counts) and a fake XAsync service that invokes the caller's completion callback. It checks the switch-off behaviour, the `X2W_FAKE_USER` gate, the latch and its single log line, the provider allow-list, an unlisted provider, the null-object guard, `XUserAddAsync` through to `XUserAddResult` in the completion callback, and `complete_async` for a local user object. `startup_runtime_local_control` runs the same binary with `--control`, which leaves the switch off where the test enables it; it must print `FAIL:`. Each of these edits to `runtime_proxy.cpp` was applied one at a time; the test passed without them and failed or crashed under each: 1. null-object guard in `forward<N>` disabled; 2. latch removed (the real export is retried); 3. local `XUserAddAsync` removed; 4. package provider dropped from the allow-list; 5. local completion status `E_FAIL` instead of `S_OK`; 6. `X2W_FAKE_USER` gate removed from the wrapper selection; 7. "initialization failed" gate removed from the local `QueryApiImpl` path; 8. local branch of `complete_async` removed; 9. `E_POINTER` for a null `QueryInterface` out pointer replaced by `S_OK`. The whole `ctest --preset dev --no-tests=error -R '^startup_' -j 8` run passes 233 of 239 tests; four are skipped (`startup_view_heap_warp`, `startup_logical_view_warp`, `startup_root_heap_warp`, `startup_root_heap_hardware`). The two others, `startup_list_resubmit_hardware` and `startup_list_resubmit_untracked_hardware`, crash (`SegFault`, after `x2w-render list Close failed 0x80004005`) on an NVIDIA GeForce RTX 5080, driver 32.0.16.2101, with the test's `X2W_D3D12_DEBUG=1`; they crash the same way without this change (measured at `813045b3`), and their executable links `d3d12_xs_shim`, `d3d12` and `dxgi`, none of which contains `runtime_proxy.cpp`. Their `_warp` variants pass. ## Evidence and follow-up - The fixture is source-built (`tests/startup_runtime_local.cpp`, MIT); it uses no title, package or runtime binary. - Not covered: how the system XAsync provider behaves after a failed initialization on a real host. The fixture supplies its own service, so that path is an assumption the code reports on (it returns the failure) rather than a measured result. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
R0Y00 commented 2026-11-24 20:01:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T19:44:56Z.

Review: CHANGES_REQUESTED


The fallback returns a vtable for an unknown IID. proxy_query matches only the provider GUID's Data1 and does not validate the requested IID, and the local QueryInterface returns the same object for every IID whenever the output pointer is writable. That lets a caller interpret one provider's slots as an unrelated interface and treats a GUID with the same prefix as a supported provider.

Please validate full provider and IID pairs for the local fallback, and only report IUnknown and the exact interfaces each local object implements from QueryInterface. Refuse an unknown IID without publishing an object. Add controls for a known provider with an unknown IID, a different provider GUID with the same Data1, and QueryInterface on a supported local object with an unknown IID. The existing known-provider success and fake-user-off checks should remain.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046180121 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853#pullrequestreview-6046180121). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T19:44:56Z. **Review:** CHANGES_REQUESTED --- The fallback returns a vtable for an unknown IID. proxy_query matches only the provider GUID's Data1 and does not validate the requested IID, and the local QueryInterface returns the same object for every IID whenever the output pointer is writable. That lets a caller interpret one provider's slots as an unrelated interface and treats a GUID with the same prefix as a supported provider. Please validate full provider and IID pairs for the local fallback, and only report IUnknown and the exact interfaces each local object implements from QueryInterface. Refuse an unknown IID without publishing an object. Add controls for a known provider with an unknown IID, a different provider GUID with the same Data1, and QueryInterface on a supported local object with an unknown IID. The existing known-provider success and fake-user-off checks should remain.
tedin7 commented 2026-11-24 20:01:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:45:06Z.

Review: COMMENTED


Review of b067a954 (based on 8e2923ae; origin/main is now 8a61ae06). Comment only, not an approval.

Verdict

Careful and well fenced (opt-in, three-way gate, latch, one log line per event). I found no P1. Two P2 points and two P3 notes below. Clean-room and title-neutral: provider ids are hex prefixes only and the fixture is source-built.

P2: the headline case is not exercised

The feature is for a host where the system runtime cannot initialize. XUserAddAsync (and complete_async for a local user) then needs real_query to still return the XAsync provider (073b7dcb), and the PR says so. The fixture supplies its own XAsync service, and the description admits what a real host does after a failed init is an assumption. If the XAsync provider lives in the same runtime that failed to initialize, local_user_add returns the failure and the user never signs in, which is the case the switch exists for. I could not measure this. A short note in docs/startup-runtime.md (it says "must still return", not that this was seen on a host without Gaming Services) or a measurement on such a host would settle it.

P2: QueryInterface on a local user object ignores the iid

In forward<0> for a local object, QueryInterface stores self for any iid and returns S_OK. For the user provider, the gamertag interface (cef4fac0) is a separate proxy entry whose slot 3 is GetGamertag. A QueryInterface from the local user object for that iid returns the user object, whose slot 3 is XUserDuplicateHandle (user_call, case 3). A caller would get a duplicate-handle answer where it expects a name. Direct QueryApiImpl for the gamertag interface is fine (the key is swapped), so this only affects the QI route. Either refuse unknown iids with E_NOINTERFACE or route the gamertag iid to its own local object. The fixture has no case for it (grep gamertag tests/startup_runtime_local.cpp finds nothing).

P3: silent success paths (all logged once, none rejected)

  • Every initialization call after the first failure returns S_OK without calling the real export, including InitializeApiImplEx* when only the plain one failed. Documented, and the latch is shared across the three exports.
  • AddRef/Release always return 1, so a local object is never freed. Fine for a process-lifetime stand-in; worth a comment.
  • proxy_query replaces proxies[index] when real changes, as before, so a provider that succeeded earlier and fails later leaks the old proxy. Existing pattern, not new.

Thread safety

local_active is read with InterlockedCompareExchange and set with InterlockedExchange, the log fires once, and the unanswered counters use InterlockedIncrement. Two threads can both call the real init and both fail before the latch is set; both then return S_OK, so the result is the same. real_init[k] is written without a lock in hooked_get_proc_address before the wrapper is returned, which is the same pattern as real_query. I found no data race that changes behaviour.

Commands run (Linux)

  • git diff --check origin/main...HEAD: clean.
  • python -B tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 370 links.
  • python -B tests/bidi_controls_check.py: Self-test passed. Checked 1325 tracked source, script and build/CI files: no bidirectional controls.
  • x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_runtime_local.cpp: does not build here. local_log.h uses MSVC __try/__except, which this compiler does not accept, so I could not run the fixture or any mutation. Everything above about the C++ is from reading the diff, not from running it.

Not run

startup_runtime_local and startup_runtime_local_control (Windows/MSVC only), and the author's nine mutations. I did not check them and cannot confirm or dispute them.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046182489 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853#pullrequestreview-6046182489). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:45:06Z. **Review:** COMMENTED --- Review of `b067a954` (based on `8e2923ae`; `origin/main` is now `8a61ae06`). Comment only, not an approval. ## Verdict Careful and well fenced (opt-in, three-way gate, latch, one log line per event). I found no P1. Two P2 points and two P3 notes below. Clean-room and title-neutral: provider ids are hex prefixes only and the fixture is source-built. ## P2: the headline case is not exercised The feature is for a host where the system runtime cannot initialize. `XUserAddAsync` (and `complete_async` for a local user) then needs `real_query` to still return the XAsync provider (`073b7dcb`), and the PR says so. The fixture supplies its own XAsync service, and the description admits what a real host does after a failed init is an assumption. If the XAsync provider lives in the same runtime that failed to initialize, `local_user_add` returns the failure and the user never signs in, which is the case the switch exists for. I could not measure this. A short note in `docs/startup-runtime.md` (it says "must still return", not that this was seen on a host without Gaming Services) or a measurement on such a host would settle it. ## P2: QueryInterface on a local user object ignores the iid In `forward<0>` for a local object, `QueryInterface` stores `self` for any iid and returns S_OK. For the user provider, the gamertag interface (`cef4fac0`) is a separate proxy entry whose slot 3 is `GetGamertag`. A `QueryInterface` from the local user object for that iid returns the user object, whose slot 3 is `XUserDuplicateHandle` (`user_call`, case 3). A caller would get a duplicate-handle answer where it expects a name. Direct `QueryApiImpl` for the gamertag interface is fine (the key is swapped), so this only affects the QI route. Either refuse unknown iids with `E_NOINTERFACE` or route the gamertag iid to its own local object. The fixture has no case for it (`grep gamertag tests/startup_runtime_local.cpp` finds nothing). ## P3: silent success paths (all logged once, none rejected) - Every initialization call after the first failure returns S_OK without calling the real export, including `InitializeApiImplEx*` when only the plain one failed. Documented, and the latch is shared across the three exports. - `AddRef`/`Release` always return 1, so a local object is never freed. Fine for a process-lifetime stand-in; worth a comment. - `proxy_query` replaces `proxies[index]` when `real` changes, as before, so a provider that succeeded earlier and fails later leaks the old proxy. Existing pattern, not new. ## Thread safety `local_active` is read with `InterlockedCompareExchange` and set with `InterlockedExchange`, the log fires once, and the unanswered counters use `InterlockedIncrement`. Two threads can both call the real init and both fail before the latch is set; both then return S_OK, so the result is the same. `real_init[k]` is written without a lock in `hooked_get_proc_address` before the wrapper is returned, which is the same pattern as `real_query`. I found no data race that changes behaviour. ## Commands run (Linux) - `git diff --check origin/main...HEAD`: clean. - `python -B tests/docs_links_check.py`: Self-test passed. Checked 18 Markdown files and 370 links. - `python -B tests/bidi_controls_check.py`: Self-test passed. Checked 1325 tracked source, script and build/CI files: no bidirectional controls. - `x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_runtime_local.cpp`: does not build here. `local_log.h` uses MSVC `__try/__except`, which this compiler does not accept, so I could not run the fixture or any mutation. Everything above about the C++ is from reading the diff, not from running it. ## Not run `startup_runtime_local` and `startup_runtime_local_control` (Windows/MSVC only), and the author's nine mutations. I did not check them and cannot confirm or dispute them. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 01:00:48 +00:00
R0Y00 commented 2026-11-25 01:00:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:33:13Z.

Review: APPROVED


Reviewed the updated pair allowlist, QueryInterface boundaries, and the local fallback guards at 0bd04f44. The Windows Release fallback and control passed 2/2. The opt-in still requires an actual initialization failure and the real runtime remains the only XAsync provider.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049701519 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853#pullrequestreview-6049701519). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:33:13Z. **Review:** APPROVED --- Reviewed the updated pair allowlist, QueryInterface boundaries, and the local fallback guards at 0bd04f44. The Windows Release fallback and control passed 2/2. The opt-in still requires an actual initialization failure and the real runtime remains the only XAsync provider.
Leyukaka commented 2026-11-25 01:01:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-24T23:27:14Z.


Pushed 0cd4978a and 69d40272 for the change request.

Full pairs. The local fallback now compares the whole provider GUID and the whole IID against eight exact pairs: user, gamertag, both Store interfaces, connectivity, game save, title and package. The persistent-storage pair is a separate constant and keeps its fake-user gate. An unlisted pair keeps the real HRESULT and publishes nothing: provider_count is unchanged. XAsync has no local answer.

QueryInterface on a local object. It returns S_OK for IID_IUnknown and for the IID the object was created for. Any other IID gives *out = nullptr and E_NOINTERFACE, logged once per object; a null out gives E_POINTER. The two Store IIDs get separate local objects. The storage object follows the same rule.

Gamertag (tedin7, P2). QueryInterface on the local user object for the gamertag IID now returns E_NOINTERFACE. A direct QueryApiImpl for the exact gamertag pair still returns its own object.

Outside the opt-in. A failed query's output is cleared only when fake user is on and the initialization failure is latched, and only if out is writable. With X2W_FAKE_USER off, a failed real query returns exactly what the real query returned, *out included, for all nine pairs. With fake user on and X2W_RUNTIME_LOCAL off, the same holds except for the storage pair, which keeps its existing fake-user-only answer. The fixture asserts this in the switch-off and fake-user-off phases.

Controls added to startup_runtime_local:

  • a known provider with an unknown IID;
  • a different provider GUID with the same Data1, for the user and storage providers;
  • a listed provider with another listed provider's IID;
  • QueryInterface with an IID other than the object's own on the user and storage objects (an unknown IID), the gamertag object (the user IID) and the first Store object (the second Store IID);
  • the gamertag IID through QueryInterface on the user object.

QueryInterface outputs are preset to a sentinel before each checked call, and the fixture's real query leaves a non-null output on failure. The existing known-provider success checks, fake-user-off checks and --control remain.

Docs. The X2W_RUNTIME_LOCAL row now states:

  • the latched-failure condition;
  • full-pair matching;
  • the QueryInterface limits;
  • that the XAsync provider must still come from the real runtime.

That last point is a requirement, not a measurement on a host without Gaming Services; I have not measured it (tedin7's first P2).

Tests (Windows 11, MSVC, cmake --preset dev):

ctest --preset dev --no-tests=error -R '^startup_runtime_local(_control)?$'
100% tests passed, 0 tests failed out of 2

Each mutation below makes startup_runtime_local fail with the message shown:

Mutation in runtime_proxy.cpp First failure
compare only Data1 of provider and IID storage provider with matching Data1 returned a local object
local QueryInterface accepts any IID gamertag QueryInterface did not refuse the user IID
do not clear the output in local mode unlisted provider did not keep the real failure
clear the output on every failure (switches off too) switch off activated the fallback

Known limits, unchanged by this push:

  • The two Store interfaces share one provider index, so method dispatch (area_call) is per provider, not per IID.
  • The real-object path still matches by Data1: the gamertag key swap and the user/save provider indices.
  • AddRef/Release return 1; local objects live for the process. This is now commented in the code.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147417229 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853#issuecomment-7147417229). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-24T23:27:14Z. --- Pushed `0cd4978a` and `69d40272` for the change request. **Full pairs.** The local fallback now compares the whole provider GUID and the whole IID against eight exact pairs: user, gamertag, both Store interfaces, connectivity, game save, title and package. The persistent-storage pair is a separate constant and keeps its fake-user gate. An unlisted pair keeps the real HRESULT and publishes nothing: `provider_count` is unchanged. XAsync has no local answer. **QueryInterface on a local object.** It returns `S_OK` for `IID_IUnknown` and for the IID the object was created for. Any other IID gives `*out = nullptr` and `E_NOINTERFACE`, logged once per object; a null `out` gives `E_POINTER`. The two Store IIDs get separate local objects. The storage object follows the same rule. **Gamertag (tedin7, P2).** `QueryInterface` on the local user object for the gamertag IID now returns `E_NOINTERFACE`. A direct `QueryApiImpl` for the exact gamertag pair still returns its own object. **Outside the opt-in.** A failed query's output is cleared only when fake user is on and the initialization failure is latched, and only if `out` is writable. With `X2W_FAKE_USER` off, a failed real query returns exactly what the real query returned, `*out` included, for all nine pairs. With fake user on and `X2W_RUNTIME_LOCAL` off, the same holds except for the storage pair, which keeps its existing fake-user-only answer. The fixture asserts this in the switch-off and fake-user-off phases. **Controls added to `startup_runtime_local`:** - a known provider with an unknown IID; - a different provider GUID with the same `Data1`, for the user and storage providers; - a listed provider with another listed provider's IID; - `QueryInterface` with an IID other than the object's own on the user and storage objects (an unknown IID), the gamertag object (the user IID) and the first Store object (the second Store IID); - the gamertag IID through `QueryInterface` on the user object. `QueryInterface` outputs are preset to a sentinel before each checked call, and the fixture's real query leaves a non-null output on failure. The existing known-provider success checks, fake-user-off checks and `--control` remain. **Docs.** The `X2W_RUNTIME_LOCAL` row now states: - the latched-failure condition; - full-pair matching; - the `QueryInterface` limits; - that the XAsync provider must still come from the real runtime. That last point is a requirement, not a measurement on a host without Gaming Services; I have not measured it (tedin7's first P2). **Tests** (Windows 11, MSVC, `cmake --preset dev`): ``` ctest --preset dev --no-tests=error -R '^startup_runtime_local(_control)?$' 100% tests passed, 0 tests failed out of 2 ``` Each mutation below makes `startup_runtime_local` fail with the message shown: | Mutation in `runtime_proxy.cpp` | First failure | |---|---| | compare only `Data1` of provider and IID | `storage provider with matching Data1 returned a local object` | | local `QueryInterface` accepts any IID | `gamertag QueryInterface did not refuse the user IID` | | do not clear the output in local mode | `unlisted provider did not keep the real failure` | | clear the output on every failure (switches off too) | `switch off activated the fallback` | **Known limits, unchanged by this push:** - The two Store interfaces share one provider index, so method dispatch (`area_call`) is per provider, not per IID. - The real-object path still matches by `Data1`: the gamertag key swap and the user/save provider indices. - `AddRef`/`Release` return 1; local objects live for the process. This is now commented in the code. AI-assisted.
R0Y00 commented 2026-11-25 01:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:28:48Z.


The full GUID/IID pairs and QueryInterface restrictions address the previous review. I also added a fallback boundary check for inaccessible query arguments: a real failure returns without dereferencing an unreadable GUID or publishing through an unwritable output. The Windows Release fixture and its control passed 2/2. The provider and XAsync service in this test are synthetic. This PR still only activates after a real initialization failure.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148552130 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1853#issuecomment-7148552130). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:28:48Z. --- The full GUID/IID pairs and QueryInterface restrictions address the previous review. I also added a fallback boundary check for inaccessible query arguments: a real failure returns without dereferencing an unreadable GUID or publishing through an unwritable output. The Windows Release fixture and its control passed 2/2. The provider and XAsync service in this test are synthetic. This PR still only activates after a real initialization failure.
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
R0Y00/Xbox2Windows!1846
No description provided.