Empty WH_CALLWNDPROC hook crashes program right after WM_WINDOWPOSCHANGING message
I'm trying to hook into firefox.exe to capture a few messages. Which seems to work fine (messages are received), however when I give the window focus (by clicking on it in the task bar) Firefox crashes. It always happens right after the hook receives the WM_WINDOWPOSCHANGING message.
My DLL code is:
I've previously had some file writing code here, to output the message data, which is how I know it always crashes after the WM_WINDOWPOSCHANGING message.
FIREFOXDLL_API LRESULT GetMsgProc(
return CallNextHookEx(0, code, wParam, lParam);
The main program has the following function:
If anyone could share any insight they might have regarding what can be causing this, it would be much appreciated.
// Called using EnumWindows(enumMainWindows, processID);
// hkprcSysMsg and hinstDLL are correctly initialized
BOOL CALLBACK enumMainWindows(HWND hwnd, LPARAM lParam)
if (pid == lParam)
DWORD tid = GetWindowThreadProcessId(hwnd, NULL);