Detours InLine Hook
Inline hook 简介


示例代码

RdpThief应用





LINKS
最后更新于








最后更新于
#include<Windows.h>
#include<stdio.h>
#include "include/detours.h"
#if _X64
#pragma comment(lib,"lib.X64/detours.lib")
#else
#pragma comment(lib,"lib.X86/detours.lib")
#endif
static int (WINAPI* OldMesssageBoxA)
(
HWND hWnd,
LPCSTR lpText,
LPCSTR lpCaption,
UINT uType
) = MessageBoxA;
int WINAPI MyFunction0(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
{
return OldMesssageBoxA(NULL, "Hooking your MessageBoxA!", "Warming", MB_OKCANCEL);
}
int main() {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)OldMesssageBoxA, MyFunction0);
//DetourDetach(&(PVOID&)OldMesssageBoxA, MyFunction0);
DetourTransactionCommit();
MessageBoxA(0, 0, 0, 0);
return 0;
}