Advertisement
Terrah

Untitled

Nov 6th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <Windows.h>
  3.  
  4. void Overwrite(DWORD Target, DWORD New)
  5. {
  6.     DWORD old;
  7.     VirtualProtect(Target, 7, PAGE_EXECUTE_READWRITE, &old);
  8.  
  9.     unsigned char* oldfunc = (unsigned char*)Target;
  10.     oldfunc[0] = 0xb8;
  11.     oldfunc[1] = New & 0xff;
  12.     oldfunc[2] = (New >> 8) & 0xff;
  13.     oldfunc[3] = (New >> 16) & 0xff;
  14.     oldfunc[4] = (New >> 24) & 0xff;
  15.     oldfunc[5] = 0xff;
  16.     oldfunc[6] = 0xe0;
  17. }
  18.  
  19. void main() {
  20.  
  21.     puts("Is deadbeef?");
  22.     Overwrite(&puts, 0xDEADBEEF);
  23.     puts("YES!");
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement