From 174b87c7e657fb9f18bc669849fa334212924391 Mon Sep 17 00:00:00 2001 From: Maraco91 <43787609+Maraco91@users.noreply.github.com> Date: Mon, 23 Nov 2026 00:21:59 +0100 Subject: loader: redirect RtlPcToFileHeader in the Debug MSVC runtime too prefer_host_copy() listed the release names of the MSVC runtime DLLs only. A Debug build of a stand-in image imports VCRUNTIME140D.dll, VCRUNTIME140_1D.dll and MSVCP140D.dll, so the loader did not redirect their RtlPcToFileHeader import, _CxxThrowException could not find the throwing image, and a C++ exception thrown and caught inside the image ended the run with 0xE06D7363 (run_tiny_game_eh in a Debug build). Co-Authored-By: Claude Fable 5.2 --- runtime/src/pe_loader.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime/src/pe_loader.cpp') diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index f4ecc0de2..7a8d10e51 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp @@ -451,9 +451,15 @@ void __cdecl on_host_thread_event(DWORD reason) { // The Xbox builds of the MSVC runtime import the same CRT the desktop does, so the host's own copies are used. bool prefer_host_copy(const std::string& dll) { + // The second row is the Debug builds of the same DLLs. A Debug build of a stand-in image (tiny_game) links them, + // and without them here its C++ exceptions were not redirected below: a throw caught inside the image ended the + // run with 0xE06D7363 (run_tiny_game_eh in a Debug build). static const char* names[] = {"vcruntime140.dll", "vcruntime140_1.dll", "msvcp140.dll", "msvcp140_1.dll", "msvcp140_2.dll", "msvcp140_atomic_wait.dll", "msvcp140_codecvt_ids.dll", - "concrt140.dll", "vccorlib140.dll", "vcomp140.dll"}; + "concrt140.dll", "vccorlib140.dll", "vcomp140.dll", + "vcruntime140d.dll", "vcruntime140_1d.dll", "msvcp140d.dll", "msvcp140_1d.dll", + "msvcp140_2d.dll", "msvcp140d_atomic_wait.dll", "msvcp140d_codecvt_ids.dll", + "concrt140d.dll", "vccorlib140d.dll", "vcomp140d.dll"}; for (auto* n : names) if (dll == n) return true; return false; -- cgit v1.2.3