Make iterate_text_sections MCPI-Agnostic

This commit is contained in:
TheBrokenRail 2022-03-16 19:50:46 -04:00
parent 55a815643b
commit 59b8fd9f54
3 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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();

View File

@ -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) {