mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-08 15:04:21 +00:00
Support hooking GetProcAddress for ordinals. Used for delay-load d3d12
This commit is contained in:
1 parent
9dc69410e5
commit
99c51259e3
1 file changed
+24
-1
@@ -474,7 +474,7 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func)
|
||||
if(mod == NULL || func == NULL)
|
||||
return (FARPROC)NULL;
|
||||
|
||||
if(mod == s_HookData->ownmodule || OrdinalAsString((void *)func))
|
||||
if(mod == s_HookData->ownmodule)
|
||||
return GetProcAddress(mod, func);
|
||||
|
||||
for(auto it = s_HookData->DllHooks.begin(); it != s_HookData->DllHooks.end(); ++it)
|
||||
@@ -484,6 +484,29 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func)
|
||||
|
||||
if(mod == it->second.module)
|
||||
{
|
||||
if(OrdinalAsString((void *)func))
|
||||
{
|
||||
uint32_t ordinal = (uint16_t)func;
|
||||
|
||||
if(ordinal < it->second.OrdinalBase)
|
||||
{
|
||||
RDCERR("Unexpected ordinal - lower than ordinalbase %u for %s",
|
||||
(uint32_t)it->second.OrdinalBase, it->first.c_str());
|
||||
return GetProcAddress(mod, func);
|
||||
}
|
||||
|
||||
ordinal -= it->second.OrdinalBase;
|
||||
|
||||
if(ordinal >= it->second.OrdinalNames.size())
|
||||
{
|
||||
RDCERR("Unexpected ordinal - higher than fetched ordinal names (%u) for %s",
|
||||
(uint32_t)it->second.OrdinalNames.size(), it->first.c_str());
|
||||
return GetProcAddress(mod, func);
|
||||
}
|
||||
|
||||
func = it->second.OrdinalNames[ordinal].c_str();
|
||||
}
|
||||
|
||||
FunctionHook search(func, NULL, NULL);
|
||||
|
||||
auto found =
|
||||
|
||||
Reference in new issue
Block a user