mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-21 21:00:02 +01:00
[iohook] Fix iohook_init race condition
This commit is contained in:
parent
3ed6ac6290
commit
be5a773cb7
@ -223,6 +223,12 @@ static void iohook_init(void)
|
|||||||
if (iohook_initted) {
|
if (iohook_initted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
InitializeCriticalSection(&iohook_lock);
|
||||||
|
EnterCriticalSection(&iohook_lock);
|
||||||
|
|
||||||
|
/* we do this first, so that any hooks that fire while we're applying
|
||||||
|
get caught by the critical section. */
|
||||||
|
iohook_initted = true;
|
||||||
|
|
||||||
/* Splice iohook into IAT entries referencing Win32 I/O APIs */
|
/* Splice iohook into IAT entries referencing Win32 I/O APIs */
|
||||||
|
|
||||||
@ -273,8 +279,7 @@ static void iohook_init(void)
|
|||||||
"SetFilePointerEx");
|
"SetFilePointerEx");
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeCriticalSection(&iohook_lock);
|
LeaveCriticalSection(&iohook_lock);
|
||||||
iohook_initted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user