fix: 修复一个错误解析32与64dos头的问题。修复了未处理转发函数的问题

This commit is contained in:
2024-12-18 22:45:42 +08:00
parent e68f3fd3db
commit ba627058f0
5 changed files with 68 additions and 40 deletions

View File

@@ -1,5 +1,4 @@
mod test {
use super::*;
use memmap2::Mmap;
use pe_parse::header::ProcName;
#[test]
@@ -61,8 +60,8 @@ mod test {
#[test]
fn test_find_export_function() {
// let find_function_str = ProcName::Named("test_def_add".to_string());
let find_function_str = ProcName::Ordinal(2);
let find_function_str = ProcName::Named("test_def_add".to_string());
// let find_function_str = ProcName::Ordinal("div");
// 1. 还是先映射
use pe_parse::pe::ReadOnlyPE;
let file = std::fs::OpenOptions::new()
@@ -76,9 +75,14 @@ mod test {
println!("Can't find the function");
return;
}
Some(rva) => {
println!("Find Function RVA: {:#x}", rva);
}
Some(rva) => match rva {
pe_parse::header::ExportFunEnum::ExportFunctionRVA(rva) => {
println!("Find the function at: {:#x}", rva);
}
pe_parse::header::ExportFunEnum::ForwarderString(forward_str) => {
println!("转发函数,转发到: {}", forward_str);
}
},
}
}
}