Refresh module handle if NULL when hitting GetProcAddress

* This might be a more serious problem in future...
* We only hook all loaded modules once, at init time, in Win32_IAT_EndHooks
* If a LoadLibrary call afterwards implicitly loads some modules we don't
  see them. Potentially we should rehook all loaded modules again each time
  LoadLibrary is called but then there would be a lot of redundant work
  unless we tracked module unload/loads to see if a module has been hooked
  before or not. For now assume we don't need to hook these modules and
  get away with just updating module handles
This commit is contained in:
Baldur Karlsson
2014-08-06 11:50:37 +01:00
parent 68e47d3ae2
commit 81ee6a47b0
+3
View File
@@ -220,6 +220,9 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func)
for(auto it=s_HookData->DllHooks.begin(); it != s_HookData->DllHooks.end(); ++it)
{
if(it->second.module == NULL)
it->second.module = GetModuleHandleA(it->first.c_str());
if(mod == it->second.module)
{
FunctionHook search(func, NULL, NULL);