Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD dwOldProtect; // 원래 메모리 페이지 권한이 백업될 변수
- // 메모리 페이지를 Read + Write + Execute 권한으로 변경
- VirtualProtect(function, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
- // JMP 명령어 삽입
- *(char *)function = '\xE9';
- *(int32_t *)( (char *)function + 1 ) = (int32_t)target - ((int32_t)function + 5);
- // 메모리 페이지 권한 원래대로 복구 (굳이 안해도 되지만 좀 더 완벽하게 하려면)
- VirtualProtect(function, 5, dwOldProtect, &dwOldProtect);
Advertisement
Add Comment
Please, Sign In to add comment