Make iterate_text_sections MCPI-Agnostic

pull/39/head
TheBrokenRail 11 months ago
parent 55a815643b
commit 59b8fd9f54

@ -15,7 +15,7 @@ extern "C" {
// Find And Iterate Over All .text Sections In Current Binary
typedef void (*text_section_callback_t)(ElfW(Addr) section, ElfW(Word) size, void *data);
void iterate_text_sections(text_section_callback_t callback, void *data);
void iterate_text_sections(const char *exe, text_section_callback_t callback, void *data);
#ifdef __cplusplus
}

@ -115,7 +115,7 @@ void _overwrite_calls(const char *file, int line, void *start, void *target) {
data.replacement = code_block;
data.found = 0;
iterate_text_sections(overwrite_calls_callback, &data);
iterate_text_sections(getenv("MCPI_EXECUTABLE_PATH"), overwrite_calls_callback, &data);
// Increment Code Block Position
increment_code_block();

@ -1,9 +1,9 @@
#include <libreborn/elf.h>
// Find And Iterate Over All .text Sections In Current Binary
void iterate_text_sections(text_section_callback_t callback, void *data) {
void iterate_text_sections(const char *exe, text_section_callback_t callback, void *data) {
// Load Main Binary
FILE *file_obj = fopen(getenv("MCPI_EXECUTABLE_PATH"), "rb");
FILE *file_obj = fopen(exe, "rb");
// Verify Binary
if (!file_obj) {

Loading…
Cancel
Save