Skip to main content

StandardFields

Struct 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: u32,
    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: u32

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 duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for StandardFields

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<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 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 PartialEq for StandardFields

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.