Struct goblin::pe::optional_header::StandardFields

source ·
pub struct StandardFields {
    pub magic: u16,
    pub major_linker_version: u8,
    pub minor_linker_version: u8,
    pub size_of_code: u64,
    pub size_of_initialized_data: u64,
    pub size_of_uninitialized_data: u64,
    pub address_of_entry_point: u64,
    pub base_of_code: u64,
    pub base_of_data: u32,
}
Expand description

Unified 32/64-bit standard COFF fields (for PE32 and PE32+).

Notably, a value of this type is a member of goblin::pe::optional_header::OptionalHeader, which in turn represents either

from winnt.h, depending on the value of StandardFields::magic.

§Position in PE binary

Standard COFF fields are located at the beginning of the OptionalHeader and before the WindowsFields.

Fields§

§magic: u16

The state of the image file. This member can be one of the following values:

§major_linker_version: u8

The major version number of the linker.

§minor_linker_version: u8

The minor version number of the linker.

§size_of_code: u64

The size of the code section (.text), in bytes, or the sum of all such sections if there are multiple code sections.

§size_of_initialized_data: u64

The size of the initialized data section (.data), in bytes, or the sum of all such sections if there are multiple initialized data sections.

§size_of_uninitialized_data: u64

The size of the uninitialized data section (.bss), in bytes, or the sum of all such sections if there are multiple uninitialized data sections.

§address_of_entry_point: u64

A pointer to the entry point function, relative to the image base address.

  • For executable files, this is the starting address.
  • For device drivers, this is the address of the initialization function.

The entry point function is optional for DLLs. When no entry point is present, this member is zero.

§base_of_code: u64

A pointer to the beginning of the code section (.text), relative to the image base.

§base_of_data: u32

A pointer to the beginning of the data section (.data), relative to the image base. Absent in 64-bit PE32+.

In other words, it is a Relative virtual address (RVA) of the start of the data (.data) section when the PE is loaded into memory.

Trait Implementations§

source§

impl Clone for StandardFields

source§

fn clone(&self) -> StandardFields

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StandardFields

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for StandardFields

source§

fn default() -> StandardFields

Returns the “default value” for a type. Read more
source§

impl From<StandardFields> for StandardFields32

source§

fn from(fields: StandardFields) -> Self

Converts to this type from the input type.
source§

impl From<StandardFields> for StandardFields64

source§

fn from(fields: StandardFields) -> Self

Converts to this type from the input type.
source§

impl From<StandardFields32> for StandardFields

source§

fn from(fields: StandardFields32) -> Self

Converts to this type from the input type.
source§

impl From<StandardFields64> for StandardFields

source§

fn from(fields: StandardFields64) -> Self

Converts to this type from the input type.
source§

impl PartialEq for StandardFields

source§

fn eq(&self, other: &StandardFields) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for StandardFields

source§

impl StructuralPartialEq for StandardFields

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.