section helper

This commit is contained in:
Intege-rs
2024-11-19 16:44:03 -05:00
parent ccfe11d856
commit 0f3fe5e23f

View File

@@ -64,6 +64,12 @@ impl ImageBase {
core::slice::from_raw_parts_mut(ptr, size) core::slice::from_raw_parts_mut(ptr, size)
} }
pub unsafe fn section(&self, sec: &ImageSectionHeader) -> &[u8] {
core::slice::from_raw_parts(
(self.as_ptr() + sec.virtual_address as usize) as *const _,
sec.virtual_size as usize)
}
} }
impl Add<usize> for &ImageBase { impl Add<usize> for &ImageBase {