📄 autohook.c
字号:
#if _MSC_VER > 1000
#pragma once
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "ApiHooks.h"
int (WINAPI *OriginalMessageBoxA)(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,
UINT uType);
int WINAPI NewMessageBoxA(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,
UINT uType) {
return(OriginalMessageBoxA(hWnd, lpText, lpCaption,
uType & MB_ICONINFORMATION
? uType ^ (MB_ICONINFORMATION | MB_ICONEXCLAMATION)
: uType));
}
API_HOOK ApiHookChain[3] = {
{DYNAMIC_HOOKS},
{"USER32.DLL","MessageBoxA",HOOK_EXACT, NULL, NULL, NewMessageBoxA},
{HOOKS_END}
};
int MsgBox() {
return(MessageBoxA(NULL, "This is illegal", "Warning", MB_ICONINFORMATION));
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
OriginalMessageBoxA = MessageBoxA;
MsgBox();
EstablishApiHooks((LPCSTR)ApiHookChain, GetCurrentProcessId());
return(MsgBox());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -