mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-28 04:41:07 +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:
@@ -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