Advertisement
captmicro

Untitled

Feb 16th, 2013
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. void Function(void)
  2. {
  3.     MessageBoxA(0, "Leet hacks!", "Leet hacks!", 0);
  4. }
  5.  
  6. _declspec(naked) void FunctionCallerStub()
  7. {
  8.     __asm
  9.     {
  10.         pushfd ;store flags
  11.         pushad ;store registers
  12.         call Function
  13.         popad ;restore registers
  14.         popfd ;restore flags
  15.         jnz 0x0042E280
  16.     }
  17. }
  18.  
  19. void InstallHook(void)
  20. {
  21.     unsigned char *overwriteptr = (unsigned char*)0x0042E1AC;
  22.     *overwriteptr = 0xE9; *((DWORD*)(overwriteptr + 1)) = (DWORD)&FunctionCallerStub;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement