Skip to content

Instantly share code, notes, and snippets.

@m417z
Created June 26, 2023 17:58
Show Gist options
  • Save m417z/42927e305f6e9b5eac7150ca0ae418e5 to your computer and use it in GitHub Desktop.
Save m417z/42927e305f6e9b5eac7150ca0ae418e5 to your computer and use it in GitHub Desktop.
A Windhawk mod to print all SetWindowsHookExW calls
// ==WindhawkMod==
// @id print-setwindowhookexw-calls
// @name Your Awesome Mod
// @description The best mod ever that does great things
// @version 0.1
// @author You
// @github https://github.com/nat
// @twitter https://twitter.com/jack
// @homepage https://your-personal-homepage.example.com/
// @include *
// ==/WindhawkMod==
using SetWindowsHookExW_t = decltype(&SetWindowsHookExW);
SetWindowsHookExW_t SetWindowsHookExW_Original;
HHOOK WINAPI SetWindowsHookExW_Hook(int idHook,
HOOKPROC lpfn,
HINSTANCE hmod,
DWORD dwThreadId) {
Wh_Log(L"SetWindowsHookExW_Hook(%d)", idHook);
return SetWindowsHookExW_Original(idHook, lpfn, hmod, dwThreadId);
}
BOOL Wh_ModInit() {
Wh_Log(L"Init " WH_MOD_ID L" version " WH_MOD_VERSION);
Wh_SetFunctionHook((void*)SetWindowsHookExW, (void*)SetWindowsHookExW_Hook,
(void**)&SetWindowsHookExW_Original);
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment