From ec81a0329af00ced540971699e49b93b860b399c Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 12 Jul 2018 13:31:13 +0100 Subject: [PATCH] Fix original pointers not being fetched for modules fetched last-minute --- renderdoc/os/win32/win32_hook.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index c66826de6..6c0b24b48 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -707,7 +707,18 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) { it->second.module = GetModuleHandleA(it->first.c_str()); if(it->second.module) + { + // fetch all function hooks here, since we want to fill out the original function pointer + // even in case nothing imports from that function (which means it would not get filled + // out through FunctionHook::ApplyHook) + for(FunctionHook &hook : it->second.FunctionHooks) + { + if(hook.orig && *hook.orig == NULL) + *hook.orig = GetProcAddress(it->second.module, hook.function.c_str()); + } + it->second.FetchOrdinalNames(); + } } bool match = (mod == it->second.module);