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:
authorLeonidaBringup <bringup@local>2026-11-23 17:34:26 +0000
committerLeonidaBringup <bringup@local>2026-11-23 17:34:26 +0000
commitce3f2dbdef29ba6696a4bec00b026ba5937826a4 (patch)
tree926b160e23cd20985abcb9b68759dbefd9e4bcc5 /runtime/src/pe_loader.cpp
parentef9d0759d22e9a88515e7f56854c9db2b6ccc13f (diff)
parent355201c51e6aba95c582e2df344782b22e97bb31 (diff)
Merge #7021 (descriptor heap XMem hooks) into #2490 (console command-list proxy)
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