Repository navigation
Conversation
|
Checked head New data: I ran the same
Fresh-thread behaviour is identical. The differences are all on a thread the host has already initialised. Two are intended and harmless: the first guest call returns No defect in what the tests cover. No game data. AI-assisted (Claude Code). |
|
Tested
AI-assisted (Gemini). |
illusionart453-max
left a comment
There was a problem hiding this comment.
Native Windows review of ced87bf, MSVC 19.44 / Windows SDK 10.0.26100 / RelWithDebInfo:
The supplied com_shim_test builds and passes 41 checks. I added a local native regression for a guest initialization outliving the host's earlier initialization; the result is 42 checks, one failure.
At runtime/shims/com_shim.cpp:62-65, absorbing RPC_E_CHANGED_MODE records host_inits_owned = 0. This borrows the host's STA without retaining any native COM initialization for the successful guest call. On a fresh std::thread:
- Host CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) returns S_OK.
- Shim CoInitializeEx(nullptr, COINIT_MULTITHREADED) returns S_OK.
- Host CoUninitialize balances its own successful call, while guest depth is still 1.
- Native CoGetApartmentType returns CO_E_NOTINITIALIZED (0x800401f0).
- Shim CoCreateInstance(GUID_NULL, ..., IID_IUnknown, &out) also returns CO_E_NOTINITIALIZED rather than reaching class lookup.
- Guest CoUninitialize cleans its logical state, but there was no owned native init keeping COM available.
Please retain an actual compatible host-apartment initialization for the guest lifetime when absorbing the mismatch, and balance only the reference the shim owns, or otherwise ensure the successful guest init remains usable when the host balances its separate ownership. Add this host-first teardown ordering alongside the current guest-first test. The current test only proves the host survives guest teardown.
This is an executed CPU/native-COM reproduction, no GPU or game files. Only the review test file was changed locally; production shim code remains this head. AI-assisted (Codex).
|
Tested
AI-assisted: Codex GPT-6.2 Sol ran the builds and tests, Claude Opus 5.5 reviewed the report. Synthetic fixtures only, no game data. |
|
Addressed feedback from @illusionart453-max and @milas6669: on RPC_E_CHANGED_MODE, co_initialize_ex now detects the thread's actual existing apartment (CoGetApartmentType) and acquires an owned host CoInitializeEx reference in that apartment so guest COM remains initialized even if host COM balances first, and subsequent guest requests matching the real thread apartment return S_FALSE. Added the host-first teardown regression in com_shim_test (42 check(s), 0 failure(s); 0 _Init_thread_header guards). |
|
Retested
AI-assisted: Codex GPT-6.2 Sol ran the builds and tests, Claude Opus 5.5 reviewed the report. Synthetic fixtures only. |
Claim: #9065 (comment)
Why
Mapped executables import
CoInitializeEx,CoUninitialize,CoCreateInstance,CoCreateGuid,CoTaskMemFree,PropVariantClear, andStringFromGUID2throughapi-ms-win-core-com-l1-1-0.dll. Bound directly to host COM:CoInitializeEx(nullptr, COINIT_MULTITHREADED)fails withRPC_E_CHANGED_MODE(0x80010106).CoUninitialize()calls that are unbalanced or paired with mismatched init can tear down host COM early.What changed
TlsAlloc()slot initialized viaInitOnceExecuteOnce(0_Init_thread_headerguards orthread_localdestructors).S_OKfor initial guest init under host COM while detecting the thread's real apartment viaCoGetApartmentTypeand retaining an owned hostCoInitializeExreference so guest COM outlives host-first teardown; matching calls on that real apartment returnS_FALSE, while true intra-guest mismatches still returnRPC_E_CHANGED_MODE).CoUninitialize(), validates null/invalid pointers inCoInitializeEx,CoCreateInstance,CoCreateGuid, andStringFromGUID2, and keepsole32.dllhost-owned (rt::shims::owns_dll("ole32.dll") == false).com_shim_test(com_shimCTest) covering fresh-thread balance, host-STA + guest-MTA isolation, host-first teardown ordering, intra-guest mismatch, helper validation, and zeroole32.dllpseudo-ownership.Verification (Windows 11, MSVC 19.44, CPU-only build — no Vulkan headers or SDL3)
powershell -ExecutionPolicy Bypass -File scripts/build_runtime.ps1-> exit0(0warnings)dumpbin /symbolsoncom_shim.cpp.obj->0_Init_thread_headerreferencesctest --test-dir runtime\build --output-on-failure -V -R "^com_shim$"->42 check(s), 0 failure(s)after commit464bb23d9python -I scripts/check_no_game_data.py ...&git diff --check-> exit0gta6rt.exe --dry-runverified all 7api-ms-win-core-com-l1-1-0.dllimports bind asshim.AI-assisted: yes (implemented and verified on Windows CPU suite; Vulkan/SDL3 GPU paths not built locally).