Skip to content

Commit

Permalink
xzre_code: add find_string_reference
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Aug 3, 2024
1 parent c025508 commit 43e7fc9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions xzre_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_library(xzre_code
elf_parse.c
elf_symbol_get_addr.c
get_lzma_allocator.c
find_string_reference.c
is_endbr64_instruction.c
init_elf_entry_ctx.c
fake_lzma_alloc.c
Expand Down
16 changes: 16 additions & 0 deletions xzre_code/find_string_reference.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright (C) 2024 Stefano Moioli <[email protected]>
**/
#include "xzre.h"

u8 *find_string_reference(
u8 *code_start,
u8 *code_end,
const char *str
){
dasm_ctx_t dctx = {0};
if(find_lea_instruction_with_mem_operand(code_start, code_end, &dctx, (void *)str)){
return dctx.instruction;
}
return NULL;
}

0 comments on commit 43e7fc9

Please sign in to comment.