Also Scan .data.rel.ro
This commit is contained in:
parent
a2b3bb128b
commit
b033912633
@ -29,19 +29,26 @@ void _overwrite_call(const char *file, int line, void *start, void *target) {
|
|||||||
// .rodata Information
|
// .rodata Information
|
||||||
#define RODATA_START 0x1020c8
|
#define RODATA_START 0x1020c8
|
||||||
#define RODATA_END 0x11665c
|
#define RODATA_END 0x11665c
|
||||||
|
// .data.rel.ro Information
|
||||||
|
#define DATA_REL_RO_START 0x1352b8
|
||||||
|
#define DATA_REL_RO_END 0x135638
|
||||||
// Search And Patch VTables Containing Function
|
// Search And Patch VTables Containing Function
|
||||||
|
#define scan_vtables(section) \
|
||||||
|
for (uintptr_t i = section##_START; i < section##_END; i = i + 4) { \
|
||||||
|
uint32_t *addr = (uint32_t *) i; \
|
||||||
|
if (*addr == (uintptr_t) target) { \
|
||||||
|
/* Found VTable Entry */ \
|
||||||
|
_patch_address(file, line, addr, replacement); \
|
||||||
|
found++; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
static int _patch_vtables(const char *file, int line, void *target, void *replacement) {
|
static int _patch_vtables(const char *file, int line, void *target, void *replacement) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (uintptr_t i = RODATA_START; i < RODATA_END; i = i + 4) {
|
scan_vtables(RODATA);
|
||||||
uint32_t *addr = (uint32_t *) i;
|
scan_vtables(DATA_REL_RO);
|
||||||
if (*addr == (uintptr_t) target) {
|
|
||||||
// Found VTable Entry
|
|
||||||
_patch_address(file, line, addr, replacement);
|
|
||||||
found++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
#undef scan_vtables
|
||||||
|
|
||||||
// Patch Calls Within Range
|
// Patch Calls Within Range
|
||||||
static int _overwrite_calls_within_internal(const char *file, int line, void *from, void *to, void *target, void *replacement) {
|
static int _overwrite_calls_within_internal(const char *file, int line, void *from, void *to, void *target, void *replacement) {
|
||||||
|
Loading…
Reference in New Issue
Block a user