Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created September 27, 2015 03:17
Show Gist options
  • Save kumatti1/115627aaabbca67231ea to your computer and use it in GitHub Desktop.
Save kumatti1/115627aaabbca67231ea to your computer and use it in GitHub Desktop.
APIフック
#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