(data: &[u8], pe_offset: usize, num_sections: u16)
| 31 | } |
| 32 | |
| 33 | fn parse_sections(data: &[u8], pe_offset: usize, num_sections: u16) -> Vec<(u32, u32, u32)> { |
| 34 | let opt_header_size = read_u16(data, pe_offset + 20) as usize; |
| 35 | let section_start = pe_offset + 24 + opt_header_size; |
| 36 | |
| 37 | (0..num_sections as usize) |
| 38 | .map(|i| { |
| 39 | let base = section_start + i * 40; |
| 40 | let vaddr = read_u32(data, base + 12); |
| 41 | let vsize = read_u32(data, base + 8); |
| 42 | let raw_offset = read_u32(data, base + 20); |
| 43 | (vaddr, vsize, raw_offset) |
| 44 | }) |
| 45 | .collect() |
| 46 | } |
| 47 | |
| 48 | pub fn parse_exports(dll_path: &Path) -> Result<Vec<DllExport>, String> { |
| 49 | let data = fs::read(dll_path).map_err(|e| format!("Failed to read DLL: {}", e))?; |
no test coverage detected