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.
Returned by CoffHeader::sections
and
ImageNtHeaders::sections
.
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: section indices start at 1.
sourcepub fn enumerate(
&self,
) -> impl Iterator<Item = (SectionIndex, &'data ImageSectionHeader)>
pub fn enumerate( &self, ) -> impl Iterator<Item = (SectionIndex, &'data ImageSectionHeader)>
Iterate over the section headers and their indices.
sourcepub fn section(&self, index: SectionIndex) -> Result<&'data ImageSectionHeader>
pub fn section(&self, index: SectionIndex) -> 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<(SectionIndex, &'data ImageSectionHeader)>
pub fn section_by_name<R: ReadRef<'data>>( &self, strings: StringTable<'data, R>, name: &[u8], ) -> Option<(SectionIndex, &'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 moresource§impl<'data> Debug for SectionTable<'data>
impl<'data> Debug for SectionTable<'data>
source§impl<'data> Default for SectionTable<'data>
impl<'data> Default for SectionTable<'data>
source§fn default() -> SectionTable<'data>
fn default() -> SectionTable<'data>
impl<'data> Copy for SectionTable<'data>
Auto Trait Implementations§
impl<'data> Freeze for SectionTable<'data>
impl<'data> RefUnwindSafe for SectionTable<'data>
impl<'data> Send for SectionTable<'data>
impl<'data> Sync for SectionTable<'data>
impl<'data> Unpin for SectionTable<'data>
impl<'data> UnwindSafe for SectionTable<'data>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)