逆向 | hook WM_PAINT消息进行绘制
hook WM_PAINT消息进行绘制
采用dll注入的方式(有bug还挺严重的,搞不定了md)
dll:
HHOOK g_hHook = NULL;
// hook后用来重绘的过程函数
LRESULT CALLBACK CallWndProc(int nCode,
WPARAM wParam,
LPARAM lParam){
CWPSTRUCT* msg = (CWPSTRUCT*)lParam;
if(msg->message == WM_PAINT)
{
//....
}
return CallNextHookEx(g_hHook, nCode, wParam, lParam); // 传递消息给下面的处理函数
}
void hook_wm_paint(){
HHOOK hhook;
// 尝试注册消息钩子
hhook = SetWindowsHookEx(WH_CALLWNDPROC,
CallWndProc,
GetModuleHandle("apparent.dll"), 0);
if (hhook == NULL)
{
char a[20] = {0};
sprintf(a, "hook err: %d", GetLastError());
MessageBox(0,a, 0, 0);
}else{
g_hHook = hhook;
}
}
调用hook_wm_paint函数实现注册hook
本文来自博客园,作者:Mz1,转载请注明原文链接:https://www.cnblogs.com/Mz1-rc/p/15398154.html
如果有问题可以在下方评论或者email:mzi_mzi@163.com