mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-20 02:51:13 +00:00
Bail out immediately if IAT entry is already hooked
* This avoids going into VirtualProtect changing the page access while code may potentially be executing these areas of memory (since the module is hooked, and may have returned to user code)
This commit is contained in:
1 parent
aa690d7183
commit
1b0eae755a
1 file changed
+4
-1
@@ -50,6 +50,9 @@ struct FunctionHook
|
||||
{
|
||||
DWORD oldProtection = PAGE_EXECUTE;
|
||||
|
||||
if(*IATentry == hookptr)
|
||||
return;
|
||||
|
||||
BOOL success = TRUE;
|
||||
|
||||
success = VirtualProtect(IATentry, sizeof(void*), PAGE_READWRITE, &oldProtection);
|
||||
@@ -59,7 +62,7 @@ struct FunctionHook
|
||||
return;
|
||||
}
|
||||
|
||||
if(origptr && *origptr == NULL && *IATentry != hookptr) *origptr = *IATentry;
|
||||
if(origptr && *origptr == NULL) *origptr = *IATentry;
|
||||
|
||||
*IATentry = hookptr;
|
||||
|
||||
|
||||
Reference in new issue
Block a user