Guest User

Untitled

a guest
Nov 12th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. DWORD dwOldProtect; // 원래 메모리 페이지 권한이 백업될 변수
  2.  
  3. // 메모리 페이지를 Read + Write + Execute 권한으로 변경
  4. VirtualProtect(function, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
  5.  
  6. // JMP 명령어 삽입
  7. *(char *)function = '\xE9';
  8. *(int32_t *)( (char *)function + 1 ) = (int32_t)target - ((int32_t)function + 5);
  9.  
  10. // 메모리 페이지 권한 원래대로 복구 (굳이 안해도 되지만 좀 더 완벽하게 하려면)
  11. VirtualProtect(function, 5, dwOldProtect, &dwOldProtect);
Advertisement
Add Comment
Please, Sign In to add comment