Repository navigation
Loader: resolve forwarders to shimmed modules through the shim registry - #191
Conversation
A forwarder target is resolved through game_dir and System32, but not through shims::find, so a forwarder to xmem or d3d12_xs became an unimplemented thunk. Check the normalized module name against the shim registry first, as a direct import already does. A synthetic shim table and a forwarder-to-shim test cover it.
02f76ca to
8d8ebee
Compare
|
Rebased onto Windows, MSVC 19.44.35229.0:
CI has not started because this is a first-time fork PR and the workflows need maintainer approval. |
|
Additional local check, not in the diff: I built a real MSVC DLL with |
|
Independent check at |
|
End-to-end check with real Microsoft forwarders, not just the synthetic fixtures: copied |
What and why
Fixes #180.
Loader::resolvechecksshims::findbefore bundled and host modules, butLoader::resolve_forwarderonly searchedgame_dirand System32. A forwarder whose target is a shimmed module, such asxmem.XMemAllocord3d12_xs.D3D12XboxCreateDevice, therefore became an unimplemented thunk instead of binding the shim.This normalizes the forwarder's target module to a shim key (append
.dllwhen absent) and checks the shim registry first, matching the order a direct import already uses. A forwarder to a module with no shim still follows the existing bundled/host path.Tested
Windows, Visual Studio 2022 BuildTools 17.14.60, MSVC 19.44.35229.0, CMake 4.4.4. Vulkan SDK absent; the GPU tools are not involved in this change. Rebased onto
mainat4e390e0; head8d8ebee.ctest: 10 of 10 passed.loader_test: 38 checks, 0 failed.testshim.F), so the loader test does not depend on the realxmemshim. It checks the import binding isShimand the IAT holds the shim function.resolve_forwarderlookup removed, the new case fails withthe import did not bind as a shim; restoring it passes.d76accb; it applied cleanly andloader_testpassed with 39 checks, 0 failed. Runtime: install static TLS for mapped images #93 and Runtime: register each mapped image's x64 unwind table (.pdata) #176 are nowCONFLICTINGwithmain; this PR isMERGEABLE.8d8ebee.AI-assisted: yes. The change was written and tested by an AI agent; the reproduction and negative control were run locally.
Checklist
docs/design.md.Coordination
Marked ready after the owner's comment on #180: it will be merged once out of draft and the Windows loader tests pass. #93 and #176 still change the same
pe_loader.cppand currently conflict withmain; this change is inresolve_forwarderand adds one test, so it does not overlap their hunks. Happy to rebase again ifmainmoves.