When plt hooking on linux, need to patch all hooked functions

* If a library is loaded as RTLD_DEEPBIND it might be linked directly against
  libGL, in which case we need to plt hook the functions we care about as well
  as just dlopen.
This commit is contained in:
baldurk committed 2019-02-13 18:50:53 +00:00
1 parent 78b03633fa
commit e73c3a0d6b
1 file changed
+9
+9
View File
@@ -85,6 +85,15 @@ void plthook_lib(void *handle)
return;
plthook_replace(plthook, "dlopen", (void *)dlopen, NULL);
for(FunctionHook &hook : functionHooks)
{
void *orig = NULL;
plthook_replace(plthook, hook.function.c_str(), hook.hook, &orig);
if(hook.orig && *hook.orig == NULL && orig)
*hook.orig = orig;
}
plthook_close(plthook);
}