autohook.c
来自「window编程,非常的好」· C语言 代码 · 共 42 行
C
42 行
#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 + =
减小字号Ctrl + -
显示快捷键?