Struct OptionalHeader64

Source
#[repr(C)]
pub struct OptionalHeader64 {
Show 30 fields pub magic: u16, pub major_linker_version: u8, pub minor_linker_version: u8, pub size_of_code: u32, pub size_of_initialized_data: u32, pub size_of_uninitialized_data: u32, pub address_of_entry_point: u32, pub base_of_code: u32, pub image_base: u64, pub section_alignment: u32, pub file_alignment: u32, pub major_operating_system_version: u16, pub minor_operating_system_version: u16, pub major_image_version: u16, pub minor_image_version: u16, pub major_subsystem_version: u16, pub minor_subsystem_version: u16, pub win32_version_value: u32, pub size_of_image: u32, pub size_of_headers: u32, pub check_sum: u32, pub subsystem: u16, pub dll_characteristics: u16, pub size_of_stack_reserve: u64, pub size_of_stack_commit: u64, pub size_of_heap_reserve: u64, pub size_of_heap_commit: u64, pub loader_flags: u32, pub number_of_rva_and_sizes: u32, pub data_directories: DataDirectories,
}
Expand description

PE32+ Optional Header (Image Only)

Fields§

§magic: u16

The unsigned integer that identifies the state of the image file. The most common number is 0x10B, which identifies it as a normal executable file. 0x107 identifies it as a ROM image, and 0x20B identifies it as a PE32+ executable.

§major_linker_version: u8

The linker major version number.

§minor_linker_version: u8

The linker minor version number.

§size_of_code: u32

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

§size_of_initialized_data: u32

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

§size_of_uninitialized_data: u32

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

§address_of_entry_point: u32

The address of the entry point relative to the image base when the executable file is loaded into memory. For program images, this is the starting address. For device drivers, this is the address of the initialization function. An entry point is optional for DLLs. When no entry point is present, this field must be zero.

§base_of_code: u32

The address that is relative to the image base of the beginning-of-code section when it is loaded into memory.

§image_base: u64

The preferred address of the first byte of image when loaded into memory; must be a multiple of 64 K. The default for DLLs is 0x10000000. The default for Windows CE EXEs is 0x00010000. The default for Windows NT, Windows 2000, Windows XP, Windows 95, Windows 98, and Windows Me is 0x00400000.

§section_alignment: u32

The alignment (in bytes) of sections when they are loaded into memory. It must be greater than or equal to file_alignment. The default is the page size for the architecture.

§file_alignment: u32

The alignment factor (in bytes) that is used to align the raw data of sections in the image file. The value should be a power of 2 between 512 and 64 K, inclusive. The default is 512. If the section_alignment is less than the architecture’s page size, then file_alignment must match section_alignment.

§major_operating_system_version: u16

The major version number of the required operating system.

§minor_operating_system_version: u16

The minor version number of the required operating system.

§major_image_version: u16

The major version number of the image.

§minor_image_version: u16

The minor version number of the image.

§major_subsystem_version: u16

The major version number of the subsystem.

§minor_subsystem_version: u16

The minor version number of the subsystem.

§win32_version_value: u32

Reserved, must be zero.

§size_of_image: u32

The size (in bytes) of the image, including all headers, as the image is loaded in memory. It must be a multiple of section_alignment.

§size_of_headers: u32

The combined size of an MS-DOS stub, PE header, and section headers rounded up to a multiple of file_alignment.

§check_sum: u32

The image file checksum. The algorithm for computing the checksum is incorporated into IMAGHELP.DLL. The following are checked for validation at load time: all drivers, any DLL loaded at boot time, and any DLL that is loaded into a critical Windows process.

§subsystem: u16

The subsystem that is required to run this image.

§dll_characteristics: u16

Bitflag characteristics that describe how a DLL should be loaded.

§size_of_stack_reserve: u64

The size of the stack to reserve. Only size_of_stack_commit is committed; the rest is made available one page at a time until the reserve size is reached.

§size_of_stack_commit: u64

The size of the stack to commit.

§size_of_heap_reserve: u64

The size of the local heap space to reserve. Only size_of_heap_commit is committed; the rest is made available one page at a time until the reserve size is reached.

§size_of_heap_commit: u64

The size of the local heap space to commit.

§loader_flags: u32

Reserved, must be zero.

§number_of_rva_and_sizes: u32

The number of data-directory entries in the remainder of the optional header. Each describes a location and size.

§data_directories: DataDirectories

Struct containing basic information (address and size) of each table.

Trait Implementations§

Source§

impl Clone for OptionalHeader64

Source§

fn clone(&self) -> OptionalHeader64

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Default for OptionalHeader64

Source§

fn default() -> OptionalHeader64

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

impl Display for OptionalHeader64

Source§

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

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

impl Optional for OptionalHeader64

Source§

fn get_subsystem(&self) -> Option<Subsystem>

Returns the subsystem as an enum
Source§

fn get_dll_characteristics(&self) -> Option<DLLCharacteristics>

Returns the DLL Characteristics as bitflags
Source§

fn parse_optional_header( binary: &[u8], offset: &mut usize, ) -> Result<Self, Error>

Parse optional header (either PE32, or PE32+) starting at the given offset.
Source§

impl Zeroable for OptionalHeader64

Source§

fn zeroed() -> Self

Source§

impl Copy for OptionalHeader64

Source§

impl Pod for OptionalHeader64

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,