You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MH_STATUS status = MH_CreateHook(MessageBoxW, (void*)MessageBoxWHook, (void**)&pOriginalMessageBoxW);
if (status == MH_OK) {
status = MH_QueueEnableHook(MessageBoxW);
}
The code above return MH_ERROR_MEMORY_ALLOC, but the hook is working. What's even stranger is that when I add a new hook to GetComputerNameW, all hooks fail.
The text was updated successfully, but these errors were encountered:
The code above return MH_ERROR_MEMORY_ALLOC, but the hook is working
That doesn't make sense, I believe there's some misunderstanding on your side. Perhaps it failed in a specific process, and the hook worked in another process?
In any case, similar code is used as the core of Windhawk, which is used by many users and was proven to be working and stable, so I believe the problems you see are as a result of your code changes.
MH_ERROR_MEMORY_ALLOC can also be caused by the following, although it's not a common scenario: TsudaKageyu/minhook#107
Thanks for the reply! After your tip, I found out that there was a global variable defined in the namespace, and moving it out fix the problem. Also, there are indeed some special high-privileged processes that can't be injected.
In my project, I defined slot handle in namespace before, this caused problem. May I ask why?
global-inject-demo/global-inject-lib/customization_session.cpp
Lines 30 to 33 in 608f007
The code above return
MH_ERROR_MEMORY_ALLOC
, but the hook is working. What's even stranger is that when I add a new hook toGetComputerNameW
, all hooks fail.The text was updated successfully, but these errors were encountered: