MCPcopy Create free account
hub / github.com/Nariod/RustPacker / parse_sections

Function parse_sections

src/pe_parser.rs:33–46  ·  view source on GitHub ↗
(data: &[u8], pe_offset: usize, num_sections: u16)

Source from the content-addressed store, hash-verified

31}
32
33fn 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
48pub 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))?;

Callers 1

parse_exportsFunction · 0.85

Calls 2

read_u16Function · 0.85
read_u32Function · 0.85

Tested by

no test coverage detected