Struct object::read::coff::SectionTable
source · pub struct SectionTable<'data> { /* private fields */ }
Expand description
The table of section headers in a COFF or PE file.
Implementations§
source§impl<'data> SectionTable<'data>
impl<'data> SectionTable<'data>
sourcepub fn parse<Coff: CoffHeader, R: ReadRef<'data>>(
header: &Coff,
data: R,
offset: u64,
) -> Result<Self>
pub fn parse<Coff: CoffHeader, R: ReadRef<'data>>( header: &Coff, data: R, offset: u64, ) -> Result<Self>
Parse the section table.
data
must be the entire file data.
offset
must be after the optional file header.
sourcepub fn iter(&self) -> Iter<'data, ImageSectionHeader>
pub fn iter(&self) -> Iter<'data, ImageSectionHeader>
Iterate over the section headers.
Warning: sections indices start at 1.
sourcepub fn section(&self, index: usize) -> Result<&'data ImageSectionHeader>
pub fn section(&self, index: usize) -> Result<&'data ImageSectionHeader>
Return the section header at the given index.
The index is 1-based.
sourcepub fn section_by_name<R: ReadRef<'data>>(
&self,
strings: StringTable<'data, R>,
name: &[u8],
) -> Option<(usize, &'data ImageSectionHeader)>
pub fn section_by_name<R: ReadRef<'data>>( &self, strings: StringTable<'data, R>, name: &[u8], ) -> Option<(usize, &'data ImageSectionHeader)>
Return the section header with the given name.
The returned index is 1-based.
Ignores sections with invalid names.
sourcepub fn max_section_file_offset(&self) -> u64
pub fn max_section_file_offset(&self) -> u64
Compute the maximum file offset used by sections.
This will usually match the end of file, unless the PE file has a data overlay
source§impl<'data> SectionTable<'data>
impl<'data> SectionTable<'data>
sourcepub fn pe_file_range_at(&self, va: u32) -> Option<(u32, u32)>
pub fn pe_file_range_at(&self, va: u32) -> Option<(u32, u32)>
Return the file offset of the given virtual address, and the size up to the end of the section containing it.
Returns None
if no section contains the address.
sourcepub fn pe_data_at<R: ReadRef<'data>>(
&self,
data: R,
va: u32,
) -> Option<&'data [u8]>
pub fn pe_data_at<R: ReadRef<'data>>( &self, data: R, va: u32, ) -> Option<&'data [u8]>
Return the data starting at the given virtual address, up to the end of the section containing it.
Ignores sections with invalid data.
Returns None
if no section contains the address.
sourcepub fn pe_data_containing<R: ReadRef<'data>>(
&self,
data: R,
va: u32,
) -> Option<(&'data [u8], u32)>
pub fn pe_data_containing<R: ReadRef<'data>>( &self, data: R, va: u32, ) -> Option<(&'data [u8], u32)>
Return the data of the section that contains the given virtual address in a PE file.
Also returns the virtual address of that section.
Ignores sections with invalid data.
sourcepub fn section_containing(&self, va: u32) -> Option<&'data ImageSectionHeader>
pub fn section_containing(&self, va: u32) -> Option<&'data ImageSectionHeader>
Return the section that contains a given virtual address.
Trait Implementations§
source§impl<'data> Clone for SectionTable<'data>
impl<'data> Clone for SectionTable<'data>
source§fn clone(&self) -> SectionTable<'data>
fn clone(&self) -> SectionTable<'data>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more