Struct pelite::pe32::PeFile [−][src]
pub struct PeFile<'a> { /* fields omitted */ }
View into an unmapped PE file.
Methods
impl<'a> PeFile<'a>
[src]
impl<'a> PeFile<'a>
pub fn from_bytes<T: AsRef<[u8]> + ?Sized>(image: &'a T) -> Result<PeFile<'a>>
[src]
pub fn from_bytes<T: AsRef<[u8]> + ?Sized>(image: &'a T) -> Result<PeFile<'a>>
Constructs a file 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 one_lfanew
,SizeOfHeaders
orNumberOfSections
are exceeded.
pub fn to_view(self) -> Vec<u8>
[src]
pub fn to_view(self) -> Vec<u8>
Converts the file to section alignment.
Trait Implementations
impl<'a> Copy for PeFile<'a>
[src]
impl<'a> Copy for PeFile<'a>
impl<'a> Clone for PeFile<'a>
[src]
impl<'a> Clone for PeFile<'a>
fn clone(&self) -> PeFile<'a>
[src]
fn clone(&self) -> PeFile<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Pe<'a> for PeFile<'a>
[src]
impl<'a> Pe<'a> for PeFile<'a>
fn image(&self) -> &'a [u8]
[src]
fn image(&self) -> &'a [u8]
Returns the image as a byte slice.
fn align(&self) -> Align
[src]
fn align(&self) -> Align
Returns whether this image uses file alignment or section alignment.
fn slice(
&self,
rva: Rva,
min_size_of: usize,
align_of: usize
) -> Result<&'a [u8]>
[src]
fn slice(
&self,
rva: Rva,
min_size_of: usize,
align_of: usize
) -> Result<&'a [u8]>
Slices the image at the specified rva. Read more
fn read(&self, va: Va, min_size_of: usize, align_of: usize) -> Result<&'a [u8]>
[src]
fn read(&self, va: Va, min_size_of: usize, align_of: usize) -> Result<&'a [u8]>
Reads the image at the specified va. Read more
const SERDE_NAME: &'static str
fn dos_header(self) -> &'a IMAGE_DOS_HEADER where
Self: Copy,
[src]
fn dos_header(self) -> &'a IMAGE_DOS_HEADER where
Self: Copy,
Returns the DOS header.
fn dos_image(self) -> &'a [u8] where
Self: Copy,
[src]
fn dos_image(self) -> &'a [u8] where
Self: Copy,
Returns the DOS image. Read more
fn nt_headers(self) -> &'a IMAGE_NT_HEADERS where
Self: Copy,
[src]
fn nt_headers(self) -> &'a IMAGE_NT_HEADERS where
Self: Copy,
Returns the NT headers.
fn file_header(self) -> &'a IMAGE_FILE_HEADER where
Self: Copy,
[src]
fn file_header(self) -> &'a IMAGE_FILE_HEADER where
Self: Copy,
Returns the file header.
fn optional_header(self) -> &'a IMAGE_OPTIONAL_HEADER where
Self: Copy,
[src]
fn optional_header(self) -> &'a IMAGE_OPTIONAL_HEADER where
Self: Copy,
Returns the optional header.
fn data_directory(self) -> &'a [IMAGE_DATA_DIRECTORY] where
Self: Copy,
[src]
fn data_directory(self) -> &'a [IMAGE_DATA_DIRECTORY] where
Self: Copy,
Returns the data directory.
fn section_headers(self) -> &'a [IMAGE_SECTION_HEADER] where
Self: Copy,
[src]
fn section_headers(self) -> &'a [IMAGE_SECTION_HEADER] where
Self: Copy,
Returns the section headers.
fn headers(self) -> Headers<Self> where
Self: Copy,
[src]
fn headers(self) -> Headers<Self> where
Self: Copy,
Returns the pe headers together in a single struct.
fn rva_to_file_offset(self, rva: Rva) -> Result<usize> where
Self: Copy,
[src]
fn rva_to_file_offset(self, rva: Rva) -> Result<usize> where
Self: Copy,
Converts a relative virtual address to file offset. Read more
fn file_offset_to_rva(self, file_offset: usize) -> Result<Rva> where
Self: Copy,
[src]
fn file_offset_to_rva(self, file_offset: usize) -> Result<Rva> where
Self: Copy,
Converts a file offset to relative virtual address. Read more
fn rva_to_va(self, rva: Rva) -> Result<Va> where
Self: Copy,
[src]
fn rva_to_va(self, rva: Rva) -> Result<Va> where
Self: Copy,
Converts from relative virtual address to virtual address. Read more
fn va_to_rva(self, va: Va) -> Result<Rva> where
Self: Copy,
[src]
fn va_to_rva(self, va: Va) -> Result<Rva> where
Self: Copy,
Converts from virtual address to relative virtual address. Read more
fn slice_bytes(self, rva: Rva) -> Result<&'a [u8]> where
Self: Sized,
[src]
fn slice_bytes(self, rva: Rva) -> Result<&'a [u8]> where
Self: Sized,
Slices the image at the specified rva returning a byte slice with no alignment or minimum size. Read more
fn read_bytes(self, va: Va) -> Result<&'a [u8]> where
Self: Sized,
[src]
fn read_bytes(self, va: Va) -> Result<&'a [u8]> where
Self: Sized,
Reads the image at the specified va returning a byte slice with no alignment or minimum size. Read more
fn derva<T>(self, rva: Rva) -> Result<&'a T> where
Self: Copy,
T: Pod,
[src]
fn derva<T>(self, rva: Rva) -> Result<&'a T> where
Self: Copy,
T: Pod,
Reads an aligned pod T
.
fn derva_copy<T>(self, rva: Rva) -> Result<T> where
Self: Copy,
T: Copy + Pod,
[src]
fn derva_copy<T>(self, rva: Rva) -> Result<T> where
Self: Copy,
T: Copy + Pod,
Reads an unaligned pod T
.
fn derva_into<T: ?Sized>(self, rva: Rva, dest: &mut T) -> Result<()> where
Self: Copy,
T: Pod,
[src]
fn derva_into<T: ?Sized>(self, rva: Rva, dest: &mut T) -> Result<()> where
Self: Copy,
T: Pod,
Reads and byte-wise copies the content to the given destination. Read more
fn derva_slice<T>(self, rva: Rva, len: usize) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
[src]
fn derva_slice<T>(self, rva: Rva, len: usize) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
Reads an array of pod T
with given length.
fn derva_slice_f<T, F>(self, rva: Rva, f: F) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
[src]
fn derva_slice_f<T, F>(self, rva: Rva, f: F) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
Reads an array of pod T
. Read more
fn derva_slice_s<T>(self, rva: Rva, sentinel: T) -> Result<&'a [T]> where
Self: Copy,
T: PartialEq + Pod,
[src]
fn derva_slice_s<T>(self, rva: Rva, sentinel: T) -> Result<&'a [T]> where
Self: Copy,
T: PartialEq + Pod,
Reads an array of pod T
. Read more
fn derva_c_str(self, rva: Rva) -> Result<&'a CStr> where
Self: Copy,
[src]
fn derva_c_str(self, rva: Rva) -> Result<&'a CStr> where
Self: Copy,
Reads a nul-terminated C string.
fn derva_string<T: ?Sized>(self, rva: Rva) -> Result<&'a T> where
Self: Copy,
T: FromBytes,
[src]
fn derva_string<T: ?Sized>(self, rva: Rva) -> Result<&'a T> where
Self: Copy,
T: FromBytes,
Reads a string.
fn deref<T>(self, ptr: Ptr<T>) -> Result<&'a T> where
Self: Copy,
T: Pod,
[src]
fn deref<T>(self, ptr: Ptr<T>) -> Result<&'a T> where
Self: Copy,
T: Pod,
Dereferences the pointer to a pod T
.
fn deref_copy<T>(self, ptr: Ptr<T>) -> Result<T> where
Self: Copy,
T: Copy + Pod,
[src]
fn deref_copy<T>(self, ptr: Ptr<T>) -> Result<T> where
Self: Copy,
T: Copy + Pod,
Dereferences the pointer to an unaligned pod T
.
fn deref_into<T: ?Sized>(self, ptr: Ptr<T>, dest: &mut T) -> Result<()> where
Self: Copy,
T: Pod,
[src]
fn deref_into<T: ?Sized>(self, ptr: Ptr<T>, dest: &mut T) -> Result<()> where
Self: Copy,
T: Pod,
Reads and byte-wise copies the content to the given destination. Read more
fn deref_slice<T>(self, ptr: Ptr<[T]>, len: usize) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
[src]
fn deref_slice<T>(self, ptr: Ptr<[T]>, len: usize) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
Reads an array of pod T
with given length.
fn deref_slice_f<T, F>(self, ptr: Ptr<[T]>, f: F) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
[src]
fn deref_slice_f<T, F>(self, ptr: Ptr<[T]>, f: F) -> Result<&'a [T]> where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
Reads an array of pod T
. Read more
fn deref_slice_s<T>(self, ptr: Ptr<[T]>, sentinel: T) -> Result<&'a [T]> where
Self: Copy,
T: PartialEq + Pod,
[src]
fn deref_slice_s<T>(self, ptr: Ptr<[T]>, sentinel: T) -> Result<&'a [T]> where
Self: Copy,
T: PartialEq + Pod,
Reads an array of pod T
. Read more
fn deref_c_str(self, ptr: Ptr<CStr>) -> Result<&'a CStr> where
Self: Copy,
[src]
fn deref_c_str(self, ptr: Ptr<CStr>) -> Result<&'a CStr> where
Self: Copy,
Dereferences the pointer to a nul-terminated C string.
fn deref_string<T: ?Sized>(self, ptr: Ptr<T>) -> Result<&'a T> where
Self: Copy,
T: FromBytes,
[src]
fn deref_string<T: ?Sized>(self, ptr: Ptr<T>) -> Result<&'a T> where
Self: Copy,
T: FromBytes,
Dereferences the pointer to a string.
fn exports(self) -> Result<Exports<'a, Self>> where
Self: Copy,
[src]
fn exports(self) -> Result<Exports<'a, Self>> where
Self: Copy,
Gets the Export Directory. Read more
fn imports(self) -> Result<Imports<'a, Self>> where
Self: Copy,
[src]
fn imports(self) -> Result<Imports<'a, Self>> where
Self: Copy,
Gets the Import Directory. Read more
fn iat(self) -> Result<IAT<'a, Self>> where
Self: Copy,
[src]
fn iat(self) -> Result<IAT<'a, Self>> where
Self: Copy,
Gets the Import Address Table. Read more
fn base_relocs(self) -> Result<BaseRelocs<'a, Self>> where
Self: Copy,
[src]
fn base_relocs(self) -> Result<BaseRelocs<'a, Self>> where
Self: Copy,
Gets the Base Relocations Directory. Read more
fn load_config(self) -> Result<LoadConfig<'a, Self>> where
Self: Copy,
[src]
fn load_config(self) -> Result<LoadConfig<'a, Self>> where
Self: Copy,
Gets the Load Config Directory. Read more
fn tls(self) -> Result<Tls<'a, Self>> where
Self: Copy,
[src]
fn tls(self) -> Result<Tls<'a, Self>> where
Self: Copy,
Gets the TLS Directory. Read more
fn security(self) -> Result<Security<'a, Self>> where
Self: Copy,
[src]
fn security(self) -> Result<Security<'a, Self>> where
Self: Copy,
Gets the Security Directory. Read more
fn exception(self) -> Result<Exception<'a, Self>> where
Self: Copy,
[src]
fn exception(self) -> Result<Exception<'a, Self>> where
Self: Copy,
Gets the Exception Directory. Read more
fn debug(self) -> Result<Debug<'a, Self>> where
Self: Copy,
[src]
fn debug(self) -> Result<Debug<'a, Self>> where
Self: Copy,
Gets the Debug Directory. Read more
fn resources(self) -> Result<Resources<'a>> where
Self: Copy,
[src]
fn resources(self) -> Result<Resources<'a>> where
Self: Copy,
Gets the Resources. Read more
fn scanner(self) -> Scanner<Self> where
Self: Copy,
[src]
fn scanner(self) -> Scanner<Self> where
Self: Copy,
Gets Scanner access. Read more
impl<'a> Serialize for PeFile<'a>
[src]
impl<'a> Serialize for PeFile<'a>