This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// byteandahalf tiny hook | |
// ini bukan buatan gw | |
#include "sys/mman.h" | |
void tiny_hook(uint32_t* addr, uint32_t hook) { | |
bool thumb = (uint32_t)addr & 1; | |
if(thumb) | |
addr = (uint32_t*) ((uint32_t) addr - 1); | |
mprotect(addr, 9, PROT_READ | PROT_WRITE); | |
*addr = (uint32_t) (thumb)? 0xF000F8DF : 0xE51FF008; // LDR PC, [PC] di Thumb trus LDR PC, [PC, #-8] di ARM. |