diff options
| author | Maraco91 <43787609+Maraco91@users.noreply.github.com> | 2026-11-23 00:21:59 +0100 |
|---|---|---|
| committer | Maraco91 <43787609+Maraco91@users.noreply.github.com> | 2026-11-23 00:21:59 +0100 |
| commit | 174b87c7e657fb9f18bc669849fa334212924391 (patch) | |
| tree | 47317b6e68fb6df5a164840a9d0776dba0c79903 /runtime/src/pe_loader.cpp | |
| parent | f53e22e87222c778c0417bd365ed876020e8ba15 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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) { | |||
| 451 | 451 | ||
| 452 | // The Xbox builds of the MSVC runtime import the same CRT the desktop does, so the host's own copies are used. | 452 | // The Xbox builds of the MSVC runtime import the same CRT the desktop does, so the host's own copies are used. |
| 453 | bool prefer_host_copy(const std::string& dll) { | 453 | bool prefer_host_copy(const std::string& dll) { |
| 454 | // The second row is the Debug builds of the same DLLs. A Debug build of a stand-in image (tiny_game) links them, | ||
| 455 | // and without them here its C++ exceptions were not redirected below: a throw caught inside the image ended the | ||
| 456 | // run with 0xE06D7363 (run_tiny_game_eh in a Debug build). | ||
| 454 | static const char* names[] = {"vcruntime140.dll", "vcruntime140_1.dll", "msvcp140.dll", "msvcp140_1.dll", | 457 | static const char* names[] = {"vcruntime140.dll", "vcruntime140_1.dll", "msvcp140.dll", "msvcp140_1.dll", |
| 455 | "msvcp140_2.dll", "msvcp140_atomic_wait.dll", "msvcp140_codecvt_ids.dll", | 458 | "msvcp140_2.dll", "msvcp140_atomic_wait.dll", "msvcp140_codecvt_ids.dll", |
| 456 | "concrt140.dll", "vccorlib140.dll", "vcomp140.dll"}; | 459 | "concrt140.dll", "vccorlib140.dll", "vcomp140.dll", |
| 460 | "vcruntime140d.dll", "vcruntime140_1d.dll", "msvcp140d.dll", "msvcp140_1d.dll", | ||
| 461 | "msvcp140_2d.dll", "msvcp140d_atomic_wait.dll", "msvcp140d_codecvt_ids.dll", | ||
| 462 | "concrt140d.dll", "vccorlib140d.dll", "vcomp140d.dll"}; | ||
| 457 | for (auto* n : names) | 463 | for (auto* n : names) |
| 458 | if (dll == n) return true; | 464 | if (dll == n) return true; |
| 459 | return false; | 465 | return false; |