Struct Header

Source
pub struct Header {
Show 14 fields pub signature: u16, pub extra_bytes: u16, pub pages: u16, pub reloc_items: u16, pub header_size: u16, pub min_alloc: u16, pub max_alloc: u16, pub init_ss: u16, pub init_sp: u16, pub checksum: u16, pub init_ip: u16, pub init_cs: u16, pub reloc_table: u16, pub overlay: u16,
}
Expand description

A definition of a header in a 16 bit dos executable

Fields§

§signature: u16§extra_bytes: u16§pages: u16§reloc_items: u16§header_size: u16§min_alloc: u16§max_alloc: u16§init_ss: u16§init_sp: u16§checksum: u16§init_ip: u16§init_cs: u16§reloc_table: u16§overlay: u16

Implementations§

Source§

impl Header

Source

pub fn from_words(words: [u16; 14]) -> Result<Header, HeaderError>

Read a header from 14 16-bit words

Source

pub fn new(bytes: &[u8]) -> Result<Header, HeaderError>

Read a header from bytes

Source

pub fn exe_data_start(&self) -> usize

Get the start of the exe data

Source

pub fn extra_data_start(&self) -> usize

Get the start of the extra data

Source

pub fn relocation_table_start(&self) -> usize

Get the start of the relocation table

Source

pub fn relocation_table_end(&self) -> usize

Get the end of the relocation table

Source

pub fn exe_data<'a>(&self, bytes: &'a [u8]) -> &'a [u8]

Get the exe data as a slice

Source

pub fn extra_data<'a>(&self, bytes: &'a [u8]) -> &'a [u8]

Get the extra data as a slice

Source

pub fn header_data<'a>(&self, bytes: &'a [u8]) -> &'a [u8]

Get the header data

Source

pub fn relocation_table_data<'a>(&self, bytes: &'a [u8]) -> &'a [u8]

Get the relocation table data

Trait Implementations§

Source§

impl Debug for Header

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

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