Struct SectionTable

struct SectionTable<'data> { ... }

The table of section headers in a COFF or PE file.

Returned by CoffHeader::sections and ImageNtHeaders::sections.

Implementations

impl<'data> SectionTable<'data>

fn pe_file_range_at(self: &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.

fn pe_data_at<R: ReadRef<'data>>(self: &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.

fn pe_data_containing<R: ReadRef<'data>>(self: &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.

fn section_containing(self: &Self, va: u32) -> Option<&'data ImageSectionHeader>

Return the section that contains a given virtual address.

impl<'data> SectionTable<'data>

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.

fn iter(self: &Self) -> Iter<'data, ImageSectionHeader>

Iterate over the section headers.

Warning: section indices start at 1.

fn enumerate(self: &Self) -> impl Iterator<Item = (SectionIndex, &'data ImageSectionHeader)>

Iterate over the section headers and their indices.

fn is_empty(self: &Self) -> bool

Return true if the section table is empty.

fn len(self: &Self) -> usize

The number of section headers.

fn section(self: &Self, index: SectionIndex) -> Result<&'data ImageSectionHeader>

Return the section header at the given index.

The index is 1-based.

fn section_by_name<R: ReadRef<'data>>(self: &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.

fn max_section_file_offset(self: &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

impl<'data> Clone for SectionTable<'data>

fn clone(self: &Self) -> SectionTable<'data>

impl<'data> Copy for SectionTable<'data>

impl<'data> Debug for SectionTable<'data>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<'data> Default for SectionTable<'data>

fn default() -> SectionTable<'data>

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> UnsafeUnpin for SectionTable<'data>

impl<'data> UnwindSafe for SectionTable<'data>

impl<T> Any for SectionTable<'data>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for SectionTable<'data>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for SectionTable<'data>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for SectionTable<'data>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for SectionTable<'data>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for SectionTable<'data>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for SectionTable<'data>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for SectionTable<'data>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for SectionTable<'data>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>