Created
September 27, 2015 03:17
-
-
Save kumatti1/115627aaabbca67231ea to your computer and use it in GitHub Desktop.
APIフック
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define UNICODE | |
#include <windows.h> | |
#include <stdio.h> | |
__declspec(naked) void Proto2(DWORD *Addr) | |
{ | |
_asm { | |
pop eax | |
pop ecx | |
push eax | |
jmp ecx | |
} | |
} | |
void Sub2() | |
{ | |
MessageBoxW(0, L"", L"Callback", MB_OK); | |
} | |
void StarteHook() | |
{ | |
DWORD* t = (DWORD*)Sub2; | |
Proto2(t); | |
} | |
int CALLBACK WinMain( | |
_In_ HINSTANCE hInstance, | |
_In_ HINSTANCE hPrevInstance, | |
_In_ LPSTR lpCmdLine, | |
_In_ int nCmdShow | |
) | |
{ | |
StarteHook(); | |
MessageBoxA(0, "", "hoge", MB_OK); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment