fix: resolve shim DLLs ahead of System32 for child-process boot #1

Manually merged
github merged 1 commit from gh-pr/1/head into gh-pr/1/base 2026-11-26 19:54:59 +00:00
Owner

@⁠AutoComput on GitHub · 2026-11-21 09:53 UTC · original
AutoComput:fix/child-boot-shim-search-order → main · +11 −3 · 2 files · 1 commits · merged 2026-11-22 09:58 UTC

TL;DR

  • Problem: On PCs where Windows has its own copy of one of the files the emulator replaces, games started the normal way crash immediately.
  • Fix: The emulator's folder is now searched first, so the game always gets the emulator's copy.

Without --in-process the guest only finds the shim DLLs through PATH, which Windows searches after System32. On a machine with its own C:\Windows\System32\xgameruntime.dll the guest loads that one and dies with 0xC0000139.

This sets the shim directory as the DLL directory around CreateProcessA. It gets searched before System32 and the child inherits it, so nothing needs copying into the package. In-process boot is untouched.

test_boot_hello_scarlett and test_boot_rt_showcase pass now, 22/23 on Release (MSVC 2022, Windows 11 26300). Didn't run Debug. README limitation updated, status files not regenerated.

**@⁠AutoComput** on GitHub · 2026-11-21 09:53 UTC · [original](https://github.com/Freminet/ScarlettX/pull/1) `AutoComput:fix/child-boot-shim-search-order` → `main` · +11 −3 · 2 files · 1 commits · merged 2026-11-22 09:58 UTC **TL;DR** - **Problem:** On PCs where Windows has its own copy of one of the files the emulator replaces, games started the normal way crash immediately. - **Fix:** The emulator's folder is now searched first, so the game always gets the emulator's copy. Without `--in-process` the guest only finds the shim DLLs through `PATH`, which Windows searches after System32. On a machine with its own `C:\Windows\System32\xgameruntime.dll` the guest loads that one and dies with `0xC0000139`. This sets the shim directory as the DLL directory around `CreateProcessA`. It gets searched before System32 and the child inherits it, so nothing needs copying into the package. In-process boot is untouched. `test_boot_hello_scarlett` and `test_boot_rt_showcase` pass now, 22/23 on Release (MSVC 2022, Windows 11 26300). Didn't run Debug. README limitation updated, status files not regenerated.
Without --in-process the guest found the shims only through PATH, which
Windows searches after the system directory. On hosts with their own
C:\Windows\System32\xgameruntime.dll the guest loaded that copy and exited
with 0xC0000139, failing test_boot_hello_scarlett and test_boot_rt_showcase.

Set the shim directory as the DLL directory around CreateProcess. Tests:
22/23 passing (was 20/23).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:54:58 +00:00
github manually merged commit 2b2810397c into gh-pr/1/base 2026-11-26 19:54:59 +00:00
Author
Owner

@⁠lukaskliuc on GitHub · 2026-11-21 13:17 UTC · original

Verified locally on Windows 11 build 26200.9974 with MSVC 19.29 and the Windows System32\xgameruntime.dll present. I ran all 23 synthetic CTest tests in Debug and Release.

Revision Debug Release
main (bda18b4) 20/23 20/23
#1 (2b28103) 22/23 22/23
#1 + #9 (ca58dd6) 22/23 22/23
#1 + #9 + #2 (16ebcc3, source change) 23/23 23/23

On main, both boot tests exited with 0xC0000139. With #1, both passed on the RTX 2080. Adding #9 also passed both on WARP, with a byte-identical rt_showcase frame. Adding #2 fixed the remaining guest texture failure. The README edits in #1 and #2 overlap, so the combined test used #1's README.

**@⁠lukaskliuc** on GitHub · 2026-11-21 13:17 UTC · [original](https://github.com/Freminet/ScarlettX/pull/1#issuecomment-7063169553) Verified locally on Windows 11 build 26200.9974 with MSVC 19.29 and the Windows `System32\xgameruntime.dll` present. I ran all 23 synthetic CTest tests in Debug and Release. | Revision | Debug | Release | |---|---:|---:| | `main` (`bda18b4`) | 20/23 | 20/23 | | #1 (`2b28103`) | 22/23 | 22/23 | | #1 + #9 (`ca58dd6`) | 22/23 | 22/23 | | #1 + #9 + #2 (`16ebcc3`, source change) | 23/23 | 23/23 | On `main`, both boot tests exited with `0xC0000139`. With #1, both passed on the RTX 2080. Adding #9 also passed both on WARP, with a byte-identical `rt_showcase` frame. Adding #2 fixed the remaining guest texture failure. The README edits in #1 and #2 overlap, so the combined test used #1's README.
This discussion has been locked. Commenting is limited to contributors.
No description provided.