Trait object::read::pe::ImageNtHeaders
source · pub trait ImageNtHeaders: Debug + Pod {
type ImageOptionalHeader: ImageOptionalHeader;
type ImageThunkData: ImageThunkData;
// Required methods
fn is_type_64(&self) -> bool;
fn is_valid_optional_magic(&self) -> bool;
fn signature(&self) -> u32;
fn file_header(&self) -> &ImageFileHeader;
fn optional_header(&self) -> &Self::ImageOptionalHeader;
// Provided methods
fn parse<'data, R: ReadRef<'data>>(
data: R,
offset: &mut u64,
) -> Result<(&'data Self, DataDirectories<'data>)> { ... }
fn sections<'data, R: ReadRef<'data>>(
&self,
data: R,
offset: u64,
) -> Result<SectionTable<'data>> { ... }
fn symbols<'data, R: ReadRef<'data>>(
&self,
data: R,
) -> Result<SymbolTable<'data, R>> { ... }
}
Expand description
A trait for generic access to ImageNtHeaders32
and ImageNtHeaders64
.
Required Associated Types§
Required Methods§
sourcefn is_type_64(&self) -> bool
fn is_type_64(&self) -> bool
Return true if this type is a 64-bit header.
This is a property of the type, not a value in the header data.
sourcefn is_valid_optional_magic(&self) -> bool
fn is_valid_optional_magic(&self) -> bool
Return true if the magic field in the optional header is valid.
sourcefn file_header(&self) -> &ImageFileHeader
fn file_header(&self) -> &ImageFileHeader
Return the file header.
sourcefn optional_header(&self) -> &Self::ImageOptionalHeader
fn optional_header(&self) -> &Self::ImageOptionalHeader
Return the optional header.
Provided Methods§
sourcefn parse<'data, R: ReadRef<'data>>(
data: R,
offset: &mut u64,
) -> Result<(&'data Self, DataDirectories<'data>)>
fn parse<'data, R: ReadRef<'data>>( data: R, offset: &mut u64, ) -> Result<(&'data Self, DataDirectories<'data>)>
Read the NT headers, including the data directories.
data
must be for the entire file.
offset
must be headers offset, which can be obtained from ImageDosHeader::nt_headers_offset
.
It is updated to point after the optional header, which is where the section headers are located.
Also checks that the signature
and magic
fields in the headers are valid.
sourcefn sections<'data, R: ReadRef<'data>>(
&self,
data: R,
offset: u64,
) -> Result<SectionTable<'data>>
fn sections<'data, R: ReadRef<'data>>( &self, data: R, offset: u64, ) -> Result<SectionTable<'data>>
Read the section table.
data
must be for the entire file.
offset
must be after the optional file header.
sourcefn symbols<'data, R: ReadRef<'data>>(
&self,
data: R,
) -> Result<SymbolTable<'data, R>>
fn symbols<'data, R: ReadRef<'data>>( &self, data: R, ) -> Result<SymbolTable<'data, R>>
Read the COFF symbol table and string table.
data
must be the entire file data.