upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-21 17:38:46 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-21 17:38:46 -0500
commite28fe7281b5094bba2fb279f3b37e8e49b82184d (patch)
tree4ebd5723afb5cd809f43c6fcf5360eabb7cb4fad /runtime/src/pe_loader.cpp
parentfafcc4197b48ae13fa6ca59d38c16ef7432ae0de (diff)
parent8d8ebee38415c28abcf29d23710be7c57b3e268b (diff)
Merge pull request #191 from Dea7hsmiles
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index a0198c033..c04594c27 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -281,6 +281,16 @@ void* Loader::resolve_forwarder(const std::string& spec, Binding& binding, int d
281 auto dot = spec.rfind('.'); 281 auto dot = spec.rfind('.');
282 if (dot == std::string::npos || dot == 0 || dot + 1 >= spec.size()) return nullptr; 282 if (dot == std::string::npos || dot == 0 || dot + 1 >= spec.size()) return nullptr;
283 const std::string module = spec.substr(0, dot), symbol = spec.substr(dot + 1); 283 const std::string module = spec.substr(0, dot), symbol = spec.substr(dot + 1);
284
285 // A forwarder can name a module the loader shims. Shims take precedence over a bundled or host copy, exactly as
286 // they do for a direct import in resolve(); without this, a forwarded xmem or d3d12_xs call becomes a failure thunk.
287 std::string shim_key = lower(module);
288 if (shim_key.size() < 4 || shim_key.compare(shim_key.size() - 4, 4, ".dll") != 0) shim_key += ".dll";
289 if (void* p = shims::find(shim_key, symbol)) {
290 binding = Binding::Shim;
291 return p;
292 }
293
284 const bool by_ordinal = symbol.size() > 1 && symbol[0] == '#'; 294 const bool by_ordinal = symbol.size() > 1 && symbol[0] == '#';
285 uint32_t ordinal = 0; 295 uint32_t ordinal = 0;
286 if (by_ordinal) { 296 if (by_ordinal) {