align call targets

This commit is contained in:
🪞👃🪞 2025-02-22 22:26:01 +02:00
parent 40356b31c7
commit c02df5d47f
2 changed files with 5 additions and 5 deletions

View file

@ -106,7 +106,7 @@ impl Rebuilder {
//Show::call(&dll, addr, Some(call)); //Show::call(&dll, addr, Some(call));
//Show::call_target_addrs(Some(call)); //Show::call_target_addrs(Some(call));
Show::call_site(&dll, addr, call.length, 1); Show::call_site(&dll, addr, call.length, 1);
Show::call_dasm(&dll.code[addr..addr+call.length]); Show::call_dasm(&dll.code[addr..], addr);
Show::call_module_method(Some(call)); Show::call_module_method(Some(call));
if let Some(method) = dll.parse_call(call) { if let Some(method) = dll.parse_call(call) {
let module_name = call.module.as_ref().unwrap(); let module_name = call.module.as_ref().unwrap();
@ -135,7 +135,7 @@ impl Rebuilder {
let target = Call::target(opcodes, 0); let target = Call::target(opcodes, 0);
Show::call_site(&dll, addr, instruction.len(), 1); Show::call_site(&dll, addr, instruction.len(), 1);
//println!(" ╰-------> (target {:?}) (offset {offset:?}) (rva {offset_rva:?})", target); //println!(" ╰-------> (target {:?}) (offset {offset:?}) (rva {offset_rva:?})", target);
Show::call_dasm(&dll.code[addr..addr+call.length]); Show::call_dasm(&dll.code[addr..], addr);
Show::call_module_method(dll.calls_by_source.get(&(addr as u32))); Show::call_module_method(dll.calls_by_source.get(&(addr as u32)));
//Show::call(&dll, addr + position, None); //Show::call(&dll, addr + position, None);
} }

View file

@ -90,7 +90,7 @@ impl Show {
write!(&mut output, "{RESET}"); write!(&mut output, "{RESET}");
if byte % line == line - 1 { if byte % line == line - 1 {
if snap(byte) == snap(addr) { if snap(byte) == snap(addr) {
let dasm = Self::call_dasm(&dll.code[addr..addr+length]); let dasm = Self::call_dasm(&dll.code[addr..addr+length], addr);
write!(&mut output, " -> {dasm}"); write!(&mut output, " -> {dasm}");
} }
write!(&mut output, " \n"); write!(&mut output, " \n");
@ -99,8 +99,8 @@ impl Show {
print!("{output}"); print!("{output}");
} }
pub fn call_dasm (bytes: &[u8]) -> Arc<str> { pub fn call_dasm (bytes: &[u8], rip: usize) -> Arc<str> {
let mut decoder = Decoder::with_ip(64, bytes, 0x0, DecoderOptions::NONE); let mut decoder = Decoder::with_ip(64, bytes, 0x1000 + rip as u64, DecoderOptions::NONE);
while decoder.can_decode() { while decoder.can_decode() {
let position = decoder.position(); let position = decoder.position();
let instruction = decoder.decode(); let instruction = decoder.decode();