[][src]Struct pelite::pe64::exports::By

pub struct By<'a, P> { /* fields omitted */ }

Export directory symbol lookup.

Methods

impl<'a, P: Pe<'a>> By<'a, P>[src]

pub fn functions(&self) -> &'a [Rva][src]

Gets the export address table.

pub fn names(&self) -> &'a [Rva][src]

Gets the name address table.

The values are RVAs to the exported function's name, to find its export look at the name index table with the same index.

The names are sorted allowing binary search lookup.

pub fn name_indices(&self) -> &'a [u16][src]

Gets the name index table.

The values are indices (not ordinals!) into the export address table matching name with the same index in the name address table.

pub fn check_sorted(&self) -> Result<bool>[src]

Validates and checks if the name table is sorted.

The PE specification says that the list of names should be sorted to allow binary search. This function checks if the names table is actually sorted, if not then various name based lookup functions may fail to find certain exports.

Returns an error if a name entry cannot be read or is otherwise corrupt.

pub fn ordinal(&self, ordinal: Ordinal) -> Result<Export<'a>>[src]

Looks up an Export by its ordinal.

pub fn name_linear<S: AsRef<[u8]> + ?Sized>(
    &self,
    name: &S
) -> Result<Export<'a>>
[src]

Looks up an Export by its name.

Does a linear scan over the name table. If the name table isn't sorted this will still be able to find exported functions by name.

Gracefully handles corrupted name entries by ignoring them.

pub fn name<S: AsRef<[u8]> + ?Sized>(&self, name: &S) -> Result<Export<'a>>[src]

Looks up an Export by its name.

If the name table isn't sorted, certain exported functions may fail to be found.

pub fn import(&self, import: Import) -> Result<Export<'a>>[src]

Looks up an Export by its import.

pub fn index(&self, index: usize) -> Result<Export<'a>>[src]

Looks up an export by its index.

pub fn hint(&self, hint: usize) -> Result<Export<'a>>[src]

Looks up an export by its hint.

pub fn hint_name<S: AsRef<[u8]> + ?Sized>(
    &self,
    hint: usize,
    name: &S
) -> Result<Export<'a>>
[src]

Looks up an export by its hint and falls back to the name if the hint is incorrect.

pub fn name_of_hint(&self, hint: usize) -> Result<&'a CStr>[src]

Looks up the name for a hint.

pub fn name_lookup(&self, index: usize) -> Result<Import<'a>>[src]

Given an index in the functions array, gets the named export.

Note that this does a linear scan to find its name, if this is called in a loop over all the exported functions you are accidentally quadratic.

See iter_names to iterate over the exported names in linear time.

pub fn iter<'s>(
    &'s self
) -> impl 's + Clone + Iterator<Item = Result<Export<'a>>>
[src]

Iterate over exported functions.

Not every exported function has a name, some are exported by ordinal. Looking up the exported function's name with name_lookup results in quadratic performance. If the exported function's name is important consider building a cache or using iter_names instead.

pub fn iter_names<'s>(
    &'s self
) -> impl 's + Clone + Iterator<Item = (Result<&'a CStr>, Result<Export<'a>>)>
[src]

Iterate over functions exported by name.

pub fn iter_name_indices<'s>(
    &'s self
) -> impl 's + Clone + Iterator<Item = (Result<&'a CStr>, usize)>
[src]

Iterate over functions exported by name, returning their name and index in the functions table.

Methods from Deref<Target = Exports<'a, P>>

pub fn pe(&self) -> P[src]

Gets the PE instance.

pub fn image(&self) -> &'a IMAGE_EXPORT_DIRECTORY[src]

Returns the underlying export directory image.

pub fn dll_name(&self) -> Result<&'a CStr>[src]

Gets the export directory's name for this library.

pub fn ordinal_base(&self) -> Ordinal[src]

Gets the ordinal base for the exported functions.

pub fn functions(&self) -> Result<&'a [Rva]>[src]

Gets the export address table.

pub fn names(&self) -> Result<&'a [Rva]>[src]

Gets the name address table.

The values are RVAs to the exported function's name, to find its export look at the name index table with the same index.

The names are sorted allowing binary search lookup.

pub fn name_indices(&self) -> Result<&'a [u16]>[src]

Gets the name index table.

The values are indices (not ordinals!) into the export address table matching name with the same index in the name address table.

pub fn by(&self) -> Result<By<'a, P>>[src]

Query the exports.

This specifically validates whether the functions, names and name indices are valid.

Trait Implementations

impl<'a, P: Clone> Clone for By<'a, P>[src]

impl<'a, P: Copy> Copy for By<'a, P>[src]

impl<'a, P: Pe<'a>> Deref for By<'a, P>[src]

type Target = Exports<'a, P>

The resulting type after dereferencing.

impl<'a, P: Pe<'a>> Debug for By<'a, P>[src]

impl<'a, P: Pe<'a>> Serialize for By<'a, P>[src]

Auto Trait Implementations

impl<'a, P> Sync for By<'a, P> where
    P: Sync

impl<'a, P> Send for By<'a, P> where
    P: Send

impl<'a, P> Unpin for By<'a, P> where
    P: Unpin

impl<'a, P> UnwindSafe for By<'a, P> where
    P: UnwindSafe

impl<'a, P> RefUnwindSafe for By<'a, P> where
    P: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]