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:
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index bfeab4c7f..21c4673a8 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -932,6 +932,7 @@ Loader::~Loader() {
932 entry(m.base, DLL_PROCESS_DETACH, nullptr); // explicit unload; the return value is ignored 932 entry(m.base, DLL_PROCESS_DETACH, nullptr); // explicit unload; the return value is ignored
933 } 933 }
934 } 934 }
935 shims::remove_xmem_allocation_hooks(this);
935 shims::remove_bundled_loader(this); 936 shims::remove_bundled_loader(this);
936 shims::remove_module_lookup(this); 937 shims::remove_module_lookup(this);
937 for (auto* m : order_) { 938 for (auto* m : order_) {
@@ -1285,6 +1286,12 @@ Module& Loader::map_image(const std::filesystem::path& path, const std::string&
1285 // installed here, before bind_imports can return control to the caller and before any image code can run. 1286 // installed here, before bind_imports can return control to the caller and before any image code can run.
1286 initialize_tls(*m); 1287 initialize_tls(*m);
1287 parse_exports(*m); 1288 parse_exports(*m);
1289 if (auto it = m->exports.find("__XMemAllocationHooks__"); it != m->exports.end()) {
1290 const auto offset = static_cast<uint64_t>(static_cast<uint8_t*>(it->second) - m->base);
1291 if (offset <= m->size && m->size - offset >= sizeof(shims::XMemAllocationHooks)) {
1292 shims::add_xmem_allocation_hooks(this, static_cast<const shims::XMemAllocationHooks*>(it->second));
1293 }
1294 }
1288 return *m; 1295 return *m;
1289} 1296}
1290 1297