pub unsafe trait Pe<'a> {
Show 45 methods
fn image(&self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
;
fn align(&self) -> Align;
fn slice(&self, rva: Rva, min_size_of: usize, align: usize) -> Result<&'a [u8]>;
fn read(&self, va: Va, min_size_of: usize, align: usize) -> Result<&'a [u8]>;
fn dos_header(self) -> &'a IMAGE_DOS_HEADER
where
Self: Copy,
{ ... }
fn dos_image(self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
where
Self: Copy,
{ ... }
fn nt_headers(self) -> &'a IMAGE_NT_HEADERS
where
Self: Copy,
{ ... }
fn file_header(self) -> &'a IMAGE_FILE_HEADER
where
Self: Copy,
{ ... }
fn optional_header(self) -> &'a IMAGE_OPTIONAL_HEADER
where
Self: Copy,
{ ... }
fn data_directory(self) -> &'a [IMAGE_DATA_DIRECTORY]
where
Self: Copy,
{ ... }
fn section_headers(self) -> &'a [IMAGE_SECTION_HEADER]
where
Self: Copy,
{ ... }
fn headers(self) -> Headers<Self>
where
Self: Copy,
{ ... }
fn rva_to_file_offset(self, rva: Rva) -> Result<usize>
where
Self: Copy,
{ ... }
fn file_offset_to_rva(self, file_offset: usize) -> Result<Rva>
where
Self: Copy,
{ ... }
fn rva_to_va(self, rva: Rva) -> Result<Va>
where
Self: Copy,
{ ... }
fn va_to_rva(self, va: Va) -> Result<Rva>
where
Self: Copy,
{ ... }
fn slice_bytes(self, rva: Rva) -> Result<&'a [u8]>
where
Self: Sized,
{ ... }
fn read_bytes(self, va: Va) -> Result<&'a [u8]>
where
Self: Sized,
{ ... }
fn derva<T>(self, rva: Rva) -> Result<&'a T>
where
Self: Copy,
T: Pod,
{ ... }
fn derva_copy<T>(self, rva: Rva) -> Result<T>
where
Self: Copy,
T: Copy + Pod,
{ ... }
fn derva_into<T>(self, rva: Rva, dest: &mut T) -> Result<()>
where
Self: Copy,
T: ?Sized + Pod,
{ ... }
fn derva_slice<T>(self, rva: Rva, len: usize) -> Result<&'a [T]>
where
Self: Copy,
T: Pod,
{ ... }
fn derva_slice_f<T, F>(self, rva: Rva, f: F) -> Result<&'a [T]>
where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
{ ... }
fn derva_slice_s<T>(self, rva: Rva, sentinel: T) -> Result<&'a [T]>
where
Self: Copy,
T: PartialEq + Pod,
{ ... }
fn derva_c_str(self, rva: Rva) -> Result<&'a CStr>
where
Self: Copy,
{ ... }
fn derva_string<T>(self, rva: Rva) -> Result<&'a T>
where
Self: Copy,
T: FromBytes + ?Sized,
{ ... }
fn deref<T>(self, ptr: Ptr<T>) -> Result<&'a T>
where
Self: Copy,
T: Pod,
{ ... }
fn deref_copy<T>(self, ptr: Ptr<T>) -> Result<T>
where
Self: Copy,
T: Copy + Pod,
{ ... }
fn deref_into<T>(self, ptr: Ptr<T>, dest: &mut T) -> Result<()>
where
Self: Copy,
T: ?Sized + Pod,
{ ... }
fn deref_slice<T>(self, ptr: Ptr<[T]>, len: usize) -> Result<&'a [T]>
where
Self: Copy,
T: Pod,
{ ... }
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,
{ ... }
fn deref_slice_s<T>(self, ptr: Ptr<[T]>, sentinel: T) -> Result<&'a [T]>
where
Self: Copy,
T: PartialEq + Pod,
{ ... }
fn deref_c_str(self, ptr: Ptr<CStr>) -> Result<&'a CStr>
where
Self: Copy,
{ ... }
fn deref_string<T>(self, ptr: Ptr<T>) -> Result<&'a T>
where
Self: Copy,
T: FromBytes + ?Sized,
{ ... }
fn exports(self) -> Result<Exports<'a, Self>>
where
Self: Copy,
{ ... }
fn imports(self) -> Result<Imports<'a, Self>>
where
Self: Copy,
{ ... }
fn iat(self) -> Result<IAT<'a, Self>>
where
Self: Copy,
{ ... }
fn base_relocs(self) -> Result<BaseRelocs<'a, Self>>
where
Self: Copy,
{ ... }
fn load_config(self) -> Result<LoadConfig<'a, Self>>
where
Self: Copy,
{ ... }
fn tls(self) -> Result<Tls<'a, Self>>
where
Self: Copy,
{ ... }
fn security(self) -> Result<Security<'a, Self>>
where
Self: Copy,
{ ... }
fn exception(self) -> Result<Exception<'a, Self>>
where
Self: Copy,
{ ... }
fn debug(self) -> Result<Debug<'a, Self>>
where
Self: Copy,
{ ... }
fn resources(self) -> Result<Resources<'a>>
where
Self: Copy,
{ ... }
fn scanner(self) -> Scanner<Self>
where
Self: Copy,
{ ... }
}
Required Methods
sourcefn image(&self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn image(&self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns the image as a byte slice.
sourcefn slice(&self, rva: Rva, min_size_of: usize, align: usize) -> Result<&'a [u8]>
fn slice(&self, rva: Rva, min_size_of: usize, align: usize) -> Result<&'a [u8]>
Slices the image at the specified rva.
If successful the returned slice’s length will be at least the given size but often be quite larger. This allows to access the image without knowing beforehand how large the structure being accessed will be.
The length is the largest consecutive number of bytes available until the end. In case the of PE files on disk, this is limited to the section’s size of raw data.
Errors
Null
: The rva is zero.
sourcefn read(&self, va: Va, min_size_of: usize, align: usize) -> Result<&'a [u8]>
fn read(&self, va: Va, min_size_of: usize, align: usize) -> Result<&'a [u8]>
Reads the image at the specified va.
If successful the returned slice’s length will be at least the given size but often be quite larger. This allows to access the image without knowing beforehand how large the structure being accessed will be.
The length is the largest consecutive number of bytes available until the end. In case the of PE files on disk, this is limited to the section’s size of raw data.
Errors
Null
: The va is zero.
Provided Methods
sourcefn dos_header(self) -> &'a IMAGE_DOS_HEADERwhere
Self: Copy,
fn dos_header(self) -> &'a IMAGE_DOS_HEADERwhere
Self: Copy,
Returns the DOS header.
sourcefn dos_image(self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
where
Self: Copy,
fn dos_image(self) -> &'a [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
where
Self: Copy,
Returns the DOS image.
This includes the dos header and everything up to the start of the PE headers but is not guaranteed to actually contain anything valid.
sourcefn nt_headers(self) -> &'a IMAGE_NT_HEADERSwhere
Self: Copy,
fn nt_headers(self) -> &'a IMAGE_NT_HEADERSwhere
Self: Copy,
Returns the NT headers.
sourcefn file_header(self) -> &'a IMAGE_FILE_HEADERwhere
Self: Copy,
fn file_header(self) -> &'a IMAGE_FILE_HEADERwhere
Self: Copy,
Returns the file header.
sourcefn optional_header(self) -> &'a IMAGE_OPTIONAL_HEADERwhere
Self: Copy,
fn optional_header(self) -> &'a IMAGE_OPTIONAL_HEADERwhere
Self: Copy,
Returns the optional header.
sourcefn data_directory(self) -> &'a [IMAGE_DATA_DIRECTORY]where
Self: Copy,
fn data_directory(self) -> &'a [IMAGE_DATA_DIRECTORY]where
Self: Copy,
Returns the data directory.
sourcefn section_headers(self) -> &'a [IMAGE_SECTION_HEADER]where
Self: Copy,
fn section_headers(self) -> &'a [IMAGE_SECTION_HEADER]where
Self: Copy,
Returns the section headers.
sourcefn headers(self) -> Headers<Self>where
Self: Copy,
fn headers(self) -> Headers<Self>where
Self: Copy,
Returns the pe headers together in a single struct.
sourcefn rva_to_file_offset(self, rva: Rva) -> Result<usize>where
Self: Copy,
fn rva_to_file_offset(self, rva: Rva) -> Result<usize>where
Self: Copy,
Converts a relative virtual address to file offset.
Errors
sourcefn file_offset_to_rva(self, file_offset: usize) -> Result<Rva>where
Self: Copy,
fn file_offset_to_rva(self, file_offset: usize) -> Result<Rva>where
Self: Copy,
Converts a file offset to relative virtual address.
Errors
sourcefn slice_bytes(self, rva: Rva) -> Result<&'a [u8]>where
Self: Sized,
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.
Shorthand to invoke slice(rva, 0, 1)
.
sourcefn read_bytes(self, va: Va) -> Result<&'a [u8]>where
Self: Sized,
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.
Shorthand to invoke read(va, 0, 1)
.
sourcefn derva_copy<T>(self, rva: Rva) -> Result<T>where
Self: Copy,
T: Copy + Pod,
fn derva_copy<T>(self, rva: Rva) -> Result<T>where
Self: Copy,
T: Copy + Pod,
Reads an unaligned pod T
.
sourcefn derva_into<T>(self, rva: Rva, dest: &mut T) -> Result<()>where
Self: Copy,
T: ?Sized + Pod,
fn derva_into<T>(self, rva: Rva, dest: &mut T) -> Result<()>where
Self: Copy,
T: ?Sized + Pod,
Reads and byte-wise copies the content to the given destination.
Allows reading of an unaligned array of data.
sourcefn derva_slice<T>(self, rva: Rva, len: usize) -> Result<&'a [T]>where
Self: Copy,
T: Pod,
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.
sourcefn derva_slice_f<T, F>(self, rva: Rva, f: F) -> Result<&'a [T]>where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
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
.
For every element of the array, starting at the given rva
, the callable f
is called with that element.
The length of the array is the index when the callable f
returns true
.
The returned slice contains all T
up to but not including the element for which the callable returned true
.
sourcefn derva_slice_s<T>(self, rva: Rva, sentinel: T) -> Result<&'a [T]>where
Self: Copy,
T: PartialEq + Pod,
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
.
The length of the array is determined by a sentinel value, a special value of T
which marks the end of the array.
The returned slice contains all T
up to but not including the sentinel value.
sourcefn derva_c_str(self, rva: Rva) -> Result<&'a CStr>where
Self: Copy,
fn derva_c_str(self, rva: Rva) -> Result<&'a CStr>where
Self: Copy,
Reads a nul-terminated C string.
sourcefn derva_string<T>(self, rva: Rva) -> Result<&'a T>where
Self: Copy,
T: FromBytes + ?Sized,
fn derva_string<T>(self, rva: Rva) -> Result<&'a T>where
Self: Copy,
T: FromBytes + ?Sized,
Reads a string.
sourcefn deref<T>(self, ptr: Ptr<T>) -> Result<&'a T>where
Self: Copy,
T: Pod,
fn deref<T>(self, ptr: Ptr<T>) -> Result<&'a T>where
Self: Copy,
T: Pod,
Dereferences the pointer to a pod T
.
sourcefn deref_copy<T>(self, ptr: Ptr<T>) -> Result<T>where
Self: Copy,
T: Copy + Pod,
fn deref_copy<T>(self, ptr: Ptr<T>) -> Result<T>where
Self: Copy,
T: Copy + Pod,
Dereferences the pointer to an unaligned pod T
.
sourcefn deref_into<T>(self, ptr: Ptr<T>, dest: &mut T) -> Result<()>where
Self: Copy,
T: ?Sized + Pod,
fn deref_into<T>(self, ptr: Ptr<T>, dest: &mut T) -> Result<()>where
Self: Copy,
T: ?Sized + Pod,
Reads and byte-wise copies the content to the given destination.
Allows reading of an unaligned array of data.
sourcefn deref_slice<T>(self, ptr: Ptr<[T]>, len: usize) -> Result<&'a [T]>where
Self: Copy,
T: Pod,
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.
sourcefn deref_slice_f<T, F>(self, ptr: Ptr<[T]>, f: F) -> Result<&'a [T]>where
Self: Copy,
T: Pod,
F: FnMut(&'a T) -> bool,
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
.
For every element of the array, starting at the given ptr
, the callable f
is called with that element.
The length of the array is the index when the callable f
returns true
.
The returned slice contains all T
up to but not including the element for which the callable returned true
.
sourcefn deref_slice_s<T>(self, ptr: Ptr<[T]>, sentinel: T) -> Result<&'a [T]>where
Self: Copy,
T: PartialEq + Pod,
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
.
The length of the array is determined by a sentinel value, a special value of T
which marks the end of the array.
The returned slice contains all T
up to but not including the sentinel value.
sourcefn deref_c_str(self, ptr: Ptr<CStr>) -> Result<&'a CStr>where
Self: Copy,
fn deref_c_str(self, ptr: Ptr<CStr>) -> Result<&'a CStr>where
Self: Copy,
Dereferences the pointer to a nul-terminated C string.
sourcefn deref_string<T>(self, ptr: Ptr<T>) -> Result<&'a T>where
Self: Copy,
T: FromBytes + ?Sized,
fn deref_string<T>(self, ptr: Ptr<T>) -> Result<&'a T>where
Self: Copy,
T: FromBytes + ?Sized,
Dereferences the pointer to a string.
sourcefn base_relocs(self) -> Result<BaseRelocs<'a, Self>>where
Self: Copy,
fn base_relocs(self) -> Result<BaseRelocs<'a, Self>>where
Self: Copy,
Gets the Base Relocations Directory.
See the base relocations module for more information.
Returns Err(Null)
if the image has no base relocations. Any other error indicates some form of corruption.
sourcefn load_config(self) -> Result<LoadConfig<'a, Self>>where
Self: Copy,
fn load_config(self) -> Result<LoadConfig<'a, Self>>where
Self: Copy,
Gets the Load Config Directory.
See the load config module for more information.
Returns Err(Null)
if the image has no load config. Any other error indicates some form of corruption.