-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR #63] Crashes when attempting to hook LoadLibraryExW #70
Comments
There's also a recursion when hooking AcquireSRWLockExclusive, which, I don't know, probably nothing can be done about? void WINAPI CustomAcquireSRWLockExclusive(PSRWLOCK SRWLock)
{
return shAcquireSRWLockExclusive.stdcall<void>(SRWLock);
}
...
shAcquireSRWLockExclusive = safetyhook::create_inline(AcquireSRWLockExclusive, CustomAcquireSRWLockExclusive);
As for LoadLibraryExW crash, tried to repro, but couldn't. |
I might be able to code around this issue actually using a spinlock or something instead. |
I was able to repro with
|
I get the same issue hooking NtMapViewOfSection |
It looks like the issue is hooking any function that happens to be on the same memory page as VirtualProtect, since trap_threads calls that between setting the trap and removing it. I can tell you at least that for me this happens to include LoadLibraryExW and a couple dozen other random Kernel32 funcs. You can use VirtualQuery to check where that page is and DbgHelp::SymEnumSymbols to find all the functions on that same page. But I suspect the list of affected functions will depend on your machine. |
Will update with more info. First glance looks like an exception occurs inside of trap_threads, causing a nested acquisition of the trap mutex.
The text was updated successfully, but these errors were encountered: