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

Function rva_to_offset

src/pe_parser.rs:19–26  ·  view source on GitHub ↗
(sections: &[(u32, u32, u32)], rva: u32)

Source from the content-addressed store, hash-verified

17}
18
19fn rva_to_offset(sections: &[(u32, u32, u32)], rva: u32) -> Option<usize> {
20 for &(vaddr, vsize, raw_offset) in sections {
21 if rva >= vaddr && rva < vaddr + vsize {
22 return Some((rva - vaddr + raw_offset) as usize);
23 }
24 }
25 None
26}
27
28fn read_cstring(data: &[u8], offset: usize) -> Option<String> {
29 let end = data[offset..].iter().position(|&b| b == 0)?;

Callers 1

parse_exportsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected