Add And Use patch_address()
This commit is contained in:
parent
73afa13af4
commit
e5d1a0578c
@ -30,6 +30,7 @@ extern "C" {
|
||||
void *overwrite(void *start, void *target);
|
||||
void revert_overwrite(void *start, void *original);
|
||||
void patch(void *start, unsigned char patch[]);
|
||||
void patch_address(void *start, void *target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -66,3 +66,8 @@ void patch(void *start, unsigned char patch[]) {
|
||||
memcpy(data, patch, 4);
|
||||
END_PATCH(1);
|
||||
}
|
||||
|
||||
void patch_address(void *start, void *target) {
|
||||
unsigned char patch_data[4] = {target & 0xff, (target >> 8) & 0xff, (target >> 16) & 0xff, (target >> 24) & 0xff};
|
||||
patch(start, patch_data);
|
||||
}
|
||||
|
@ -185,8 +185,5 @@ __attribute__((constructor)) static void init() {
|
||||
|
||||
// Change Username
|
||||
const char *username = get_username();
|
||||
uint32_t username_addr = (uint32_t) username;
|
||||
fprintf(stderr, "0x%08x", username_addr);
|
||||
unsigned char username_patch[4] = {username_addr & 0xff, (username_addr >> 8) & 0xff, (username_addr >> 16) & 0xff, (username_addr >> 24) & 0xff};
|
||||
patch((void *) 0x18fd4, username_patch);
|
||||
patch_address((void *) 0x18fd4, username);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user