diff options
Diffstat (limited to 'runtime/shims/registry.cpp')
| -rw-r--r-- | runtime/shims/registry.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/shims/registry.cpp b/runtime/shims/registry.cpp index d6f989fae..4c6a0d60b 100644 --- a/runtime/shims/registry.cpp +++ b/runtime/shims/registry.cpp | |||
| @@ -302,6 +302,18 @@ void add_module_lookup(void* ctx, ModuleLookup fn) { | |||
| 302 | g_lookups.push_back({ctx, fn}); | 302 | g_lookups.push_back({ctx, fn}); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | bool mapped_image_base(uint64_t address, uint64_t& base) { | ||
| 306 | std::string module; | ||
| 307 | uint32_t rva = 0; | ||
| 308 | std::lock_guard lock(g_lookup_mutex); | ||
| 309 | for (auto& l : g_lookups) | ||
| 310 | if (l.fn(l.ctx, address, module, rva)) { | ||
| 311 | base = address - rva; | ||
| 312 | return true; | ||
| 313 | } | ||
| 314 | return false; | ||
| 315 | } | ||
| 316 | |||
| 305 | void remove_module_lookup(void* ctx) { | 317 | void remove_module_lookup(void* ctx) { |
| 306 | std::lock_guard lock(g_lookup_mutex); | 318 | std::lock_guard lock(g_lookup_mutex); |
| 307 | for (auto it = g_lookups.begin(); it != g_lookups.end(); ++it) | 319 | for (auto it = g_lookups.begin(); it != g_lookups.end(); ++it) |