diff options
| author | Nolan Cotter <186326284+NolanCotter@users.noreply.github.com> | 2026-11-22 17:53:08 -0700 |
|---|---|---|
| committer | Nolan Cotter <186326284+NolanCotter@users.noreply.github.com> | 2026-11-22 17:53:08 -0700 |
| commit | f95bea1d8869f3ce4a162897efcf009f1c6af4bf (patch) | |
| tree | dbc23f57467a7bfbd68b729e523bc5e7c05d09a6 /runtime/shims/registry.cpp | |
| parent | 309052ad31a1ab9d6728930ae782c790985a2f46 (diff) | |
shims/loader: GetModuleFileName answers for the mapped images
GetModuleFileName was host-bound, so a mapped image asking for its own
path got gta6rt.exe's. The bundled-module ops now expose the main image
and each module's load path: GetModuleFileNameA/W return the mapped
module's path (the exe for a null handle, any bundled module for its
base) and GetModuleFileName falls through to the host otherwise.
GetModuleHandle(nullptr) answers the mapped exe's base the same way.
A unix-absolute stored path is spelled Z:\... under Wine.
First use measured: the package's game_scarlett_master.exe (a payload
verification probe, not the engine) took its own module path as the
scan root and verified the full 1.0.2.1 payload through the file
layer — 104/104 files, 223,534,748,018 bytes, rpf 22/22, ttpf 57/57,
png 5/5, dll 16/16, bad magic 0 — verdict PASS, exit 0.
Tested: clang-cl 20 + xwin cross-build clean; loader_test 87 checks,
xs_proxy_mock_test PASS under Wine. AI-assisted.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Diffstat (limited to 'runtime/shims/registry.cpp')
| -rw-r--r-- | runtime/shims/registry.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/shims/registry.cpp b/runtime/shims/registry.cpp index 1f212983f..730c3cbf9 100644 --- a/runtime/shims/registry.cpp +++ b/runtime/shims/registry.cpp | |||
| @@ -461,6 +461,20 @@ bool owns_bundled_module_handle(void* module) { | |||
| 461 | return false; | 461 | return false; |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | void* bundled_main_module() { | ||
| 465 | for (const auto& entry : snapshot_bundled_loaders()) | ||
| 466 | if (entry.ops->main_module) | ||
| 467 | if (void* h = entry.ops->main_module(entry.ctx)) return h; | ||
| 468 | return nullptr; | ||
| 469 | } | ||
| 470 | |||
| 471 | const std::filesystem::path* bundled_module_path(void* module) { | ||
| 472 | for (const auto& entry : snapshot_bundled_loaders()) | ||
| 473 | if (entry.ops->module_path) | ||
| 474 | if (const std::filesystem::path* p = entry.ops->module_path(entry.ctx, module)) return p; | ||
| 475 | return nullptr; | ||
| 476 | } | ||
| 477 | |||
| 464 | Table::Table(const Entry* entries, size_t count) { | 478 | Table::Table(const Entry* entries, size_t count) { |
| 465 | for (size_t i = 0; i < count; ++i) table()[lower_ascii(entries[i].dll) + "!" + entries[i].name] = entries[i].fn; | 479 | for (size_t i = 0; i < count; ++i) table()[lower_ascii(entries[i].dll) + "!" + entries[i].name] = entries[i].fn; |
| 466 | } | 480 | } |