hookserv.c
来自「编程高手箴言-原书源码」· C语言 代码 · 共 41 行
C
41 行
#include <windows.h>
#include "../PEHOOK/APIHook32.h"
#include "../RUN/RUN.c"
PROC lpAdder = MessageBoxA;
int WINAPI MyMesageBoxA(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
)
{
return lpAdder(NULL,"new","new",MB_OK);
}
void main()
{
APIHOOK32_ENTRY pe;
pe.pszAPIName = "MessageBoxA";
pe.pszCallerModuleName = "user32.DLL";
pe.pfnOriginApiAddress = MessageBoxA;
pe.pfnDummyFuncAddress = MyMesageBoxA;
pe.hModCallerModule = NULL;
lpAdder = MessageBoxA;
//钩挂MessageBoxA
SetWindowsAPIHook(&pe);
MessageBox(NULL,"old","old",MB_OK);
run();
//去除钩挂
UnhookWindowsAPIHooks(&pe);
//MessageBox(NULL,"old","old",MB_OK);
run();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?