Struct pelite::pe64::PeView

source ·
pub struct PeView<'a> { /* private fields */ }
Expand description

View into a mapped PE image.

Implementations

Constructs a view of the module this code is executing in.

Constructs a view from a byte slice.

Errors
  • Bounds: The byte slice is too small to fit the PE headers.

  • Misaligned: The minimum alignment of 4 is not satisfied.

  • BadMagic: This is not a PE file.

  • PeMagic: Trying to parse a PE32 file with the PE32+ parser and vice versa.

  • Insanity: Reasonable limits on e_lfanew, SizeOfHeaders or NumberOfSections are exceeded.

Constructs a new view from module handle.

Safety

The underlying memory is borrowed and an unbounded lifetime is returned. Ensure the lifetime outlives this view instance!

No sanity or safety checks are done to make sure this is really PE32(+) image. When using this with a HMODULE from the system the caller must be sure this is a PE32(+) image.

Converts the view to file alignment.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the image as a byte slice.
Returns whether this image uses file alignment or section alignment.
Slices the image at the specified rva. Read more
Reads the image at the specified va. Read more
Returns the DOS header.
Returns the DOS image. Read more
Returns the NT headers.
Returns the file header.
Returns the optional header.
Returns the data directory.
Returns the section headers.
Returns the pe headers together in a single struct.
Converts a relative virtual address to file offset. Read more
Converts a file offset to relative virtual address. Read more
Converts from relative virtual address to virtual address. Read more
Converts from virtual address to relative virtual address. Read more
Slices the image at the specified rva returning a byte slice with no alignment or minimum size. Read more
Reads the image at the specified va returning a byte slice with no alignment or minimum size. Read more
Reads an aligned pod T.
Reads an unaligned pod T.
Reads and byte-wise copies the content to the given destination. Read more
Reads an array of pod T with given length.
Reads an array of pod T. Read more
Reads an array of pod T. Read more
Reads a nul-terminated C string.
Reads a string.
Dereferences the pointer to a pod T.
Dereferences the pointer to an unaligned pod T.
Reads and byte-wise copies the content to the given destination. Read more
Reads an array of pod T with given length.
Reads an array of pod T. Read more
Reads an array of pod T. Read more
Dereferences the pointer to a nul-terminated C string.
Dereferences the pointer to a string.
Gets the Export Directory. Read more
Gets the Import Directory. Read more
Gets the Import Address Table. Read more
Gets the Base Relocations Directory. Read more
Gets the Load Config Directory. Read more
Gets the TLS Directory. Read more
Gets the Security Directory. Read more
Gets the Exception Directory. Read more
Gets the Debug Directory. Read more
Gets the Resources. Read more
Gets Scanner access. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Convenient method to get an exported function. Read more
Convenient method to get the address of an exported function. Read more
Convenient method to get an exported function. Read more
Convenient method to get the address of an exported function. Read more
Convenient method to get an exported function. Read more
Convenient method to get the address of an exported function. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.