MS Detours Library, detouring non win api function
- by flavour404
Hi,
I want to use the windows detours library to detour a non win api function. The function is part of the Qt library (QtGui4.dll). I am wondering how I would set up the function signature for :
void QPainter::drawText ( const QPointF & position, const QString & text )
I had a go with this and it received my usual share of errors, a little explanation of requirements would be interesting as well:
void (QPainter * real_drawText)(const QPointF & position, const QString & text) = drawText
This is what they look like for TextOut, under the windows API:
BOOL (WINAPI * Real_TextOut)(HDC a0, int a1, int a2, LPCWSTR a3, int a4) = TextOutW;
BOOL WINAPI Mine_TextOut(HDC hdc,int X,int Y,LPCWSTR text,int textLen)
{
BOOL rv = Real_TextOut(hdc, X, Y, text, textLen);
HWND hWindow = WindowFromDC(hdc);
SendTextMessage(hWindow, text);
return rv;
}
Thanks.