upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.h
diff options
context:
space:
mode:
authorNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 17:53:08 -0700
committerNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 17:53:08 -0700
commitf95bea1d8869f3ce4a162897efcf009f1c6af4bf (patch)
treedbc23f57467a7bfbd68b729e523bc5e7c05d09a6 /runtime/src/pe_loader.h
parent309052ad31a1ab9d6728930ae782c790985a2f46 (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/src/pe_loader.h')
-rw-r--r--runtime/src/pe_loader.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.h b/runtime/src/pe_loader.h
index 8fb24349f..e73c36339 100644
--- a/runtime/src/pe_loader.h
+++ b/runtime/src/pe_loader.h
@@ -111,6 +111,10 @@ public:
111 void* load_runtime_module(const std::string& dll_lower, uint32_t flags, bool& handled); 111 void* load_runtime_module(const std::string& dll_lower, uint32_t flags, bool& handled);
112 void* resolve_module_export(void* module_handle, const std::string& sym, bool& owns_handle); 112 void* resolve_module_export(void* module_handle, const std::string& sym, bool& owns_handle);
113 bool owns_module_handle(void* module_handle) const; 113 bool owns_module_handle(void* module_handle) const;
114 // The first image load() mapped (the exe), for GetModuleHandle(nullptr); the path a mapped module was loaded
115 // from (nullptr for the main image), for GetModuleFileName. Null when the handle is not this loader's.
116 void* main_module() const;
117 const std::filesystem::path* module_path_for(void* module_handle) const;
114 118
115private: 119private:
116 void initialise(Module& m); 120 void initialise(Module& m);