Struct object::read::pe::ImportTable
source · pub struct ImportTable<'data> {
section_data: Bytes<'data>,
section_address: u32,
import_address: u32,
}
Expand description
Information for parsing a PE import table.
Returned by DataDirectories::import_table
.
Fields§
§section_data: Bytes<'data>
§section_address: u32
§import_address: u32
Implementations§
source§impl<'data> ImportTable<'data>
impl<'data> ImportTable<'data>
sourcepub fn new(
section_data: &'data [u8],
section_address: u32,
import_address: u32,
) -> Self
pub fn new( section_data: &'data [u8], section_address: u32, import_address: u32, ) -> Self
Create a new import table parser.
The import descriptors start at import_address
.
The size declared in the IMAGE_DIRECTORY_ENTRY_IMPORT
data directory is
ignored by the Windows loader, and so descriptors will be parsed until a null entry.
section_data
should be from the section containing import_address
, and
section_address
should be the address of that section. Pointers within the
descriptors and thunks may point to anywhere within the section data.
sourcepub fn descriptors(&self) -> Result<ImportDescriptorIterator<'data>>
pub fn descriptors(&self) -> Result<ImportDescriptorIterator<'data>>
Return an iterator for the import descriptors.
sourcepub fn name(&self, address: u32) -> Result<&'data [u8]>
pub fn name(&self, address: u32) -> Result<&'data [u8]>
Return a library name given its address.
This address may be from pe::ImageImportDescriptor::name
.
sourcepub fn thunks(&self, address: u32) -> Result<ImportThunkList<'data>>
pub fn thunks(&self, address: u32) -> Result<ImportThunkList<'data>>
Return a list of thunks given its address.
This address may be from pe::ImageImportDescriptor::original_first_thunk
or pe::ImageImportDescriptor::first_thunk
.
sourcepub fn import<Pe: ImageNtHeaders>(
&self,
thunk: Pe::ImageThunkData,
) -> Result<Import<'data>>
pub fn import<Pe: ImageNtHeaders>( &self, thunk: Pe::ImageThunkData, ) -> Result<Import<'data>>
Parse a thunk.
sourcepub fn hint_name(&self, address: u32) -> Result<(u16, &'data [u8])>
pub fn hint_name(&self, address: u32) -> Result<(u16, &'data [u8])>
Return the hint and name at the given address.
This address may be from pe::ImageThunkData32
or pe::ImageThunkData64
.
The hint is an index into the export name pointer table in the target library.
Trait Implementations§
source§impl<'data> Clone for ImportTable<'data>
impl<'data> Clone for ImportTable<'data>
source§fn clone(&self) -> ImportTable<'data>
fn clone(&self) -> ImportTable<'data>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more