Hi All,
This is no doubt something I’m doing wrong. I’ve not run into trouble hooking most API’s but for some reason, the target app crashes when I hook ExtTextOutA. The app is crashing after my code executes. I’m probably not defining the next hook or the hook proc properly but still can’t figure it out.
Here is my definition for the “next hook”
BOOL (WINAPI *ExtTextOutANext) (HDC hdc,
int X,
int Y,
UINT fuOptions,
const RECT *lprc,
LPCSTR lpString,
UINT cbCount,
const INT *lpDx);
Here is my hook proc…
// ****************************** ExtTextOutA
BOOL ExtTextOutAHookProc(HDC hdc,
int X,
int Y,
UINT fuOptions,
const RECT *lprc,
LPCSTR lpString,
UINT cbCount,
const INT *lpDx)
{
BOOL result = ExtTextOutANext(hdc, X, Y, fuOptions, lprc, lpString, cbCount, lpDx);
sendWindowMessage("999" + DL + "ExtTextOutA:" + lpString);
return result;
}
I’ve been API hooking for years in PowerBasic and just recently switched to MS C++ so I’m probably screwing this up because of pointers. Any idea what I need to change keep the target app from crashing? The target app crashes after my call returns… not before, not in my code but after my code returns.
Thanks in advance for any words of wisdom.
Newbie pointer confusion for ExtTextOutA
Re: Newbie pointer confusion for ExtTextOutA
You're missing the "WINAPI" for your hook proc.
That's the most common mistake, and always the first thing I check...
That's the most common mistake, and always the first thing I check...
Re: Newbie pointer confusion for ExtTextOutA
Well that is embarrassing. Thanks for the quick reply. I couldn’t see the forest for the trees and got hung up on the const definition and pointers. Thanks again. I can now stop pounding my head on the keyboard.