diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index ca17c4be39..629ce50e67 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -761,7 +761,7 @@ static bool OrdinalAsString(void *func) return uint64_t(func) <= 0xffff; } -FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) +FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, const LPCSTR func) { if(mod == NULL || func == NULL || mod == s_HookData->ownmodule) return GetProcAddress(mod, func); @@ -807,6 +807,8 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) RDCDEBUG("Located module %s", it->first.c_str()); #endif + LPCSTR searchFunc = func; + if(OrdinalAsString((void *)func)) { #if ENABLED(VERBOSE_DEBUG_HOOK) @@ -835,14 +837,14 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) return GetProcAddress(mod, func); } - func = it->second.OrdinalNames[ordinal].c_str(); + searchFunc = it->second.OrdinalNames[ordinal].c_str(); #if ENABLED(VERBOSE_DEBUG_HOOK) - RDCDEBUG("found ordinal %s", func); + RDCDEBUG("found ordinal %s", searchFunc); #endif } - FunctionHook search(func, NULL, NULL); + FunctionHook search(searchFunc, NULL, NULL); auto found = std::lower_bound(it->second.FunctionHooks.begin(), it->second.FunctionHooks.end(), search);