Skip to main content

CommonHeader

Struct CommonHeader 

Source
pub struct CommonHeader<'a> { /* private fields */ }
Expand description

View type for the NSIS common header.

The common header sits at the start of the decompressed header block. It provides flags, block descriptors (which give offsets into the rest of the decompressed data), callback entry indices, and install configuration.

Implementations§

Source§

impl<'a> CommonHeader<'a>

Source

pub fn parse( data: &'a [u8], version_hint: NsisVersionHint, ) -> Result<Self, Error>

Parses the common header from the start of the decompressed header data.

The version_hint guides layout selection. If Unknown, the parser tries the standard layout and validates block headers.

§Errors
Source

pub fn flags(&self) -> u32

Returns the common header flags (CH_FLAGS_*).

Source

pub fn block(&self, bt: BlockType) -> &BlockHeader<'a>

Returns the block header for the given block type.

The BlockType enum discriminants are always within 0..BLOCKS_NUM, so this lookup never returns None for a well-formed BlockType; the .first() fallback is purely defensive.

Source

pub fn blocks(&self) -> &[BlockHeader<'a>; 8]

Returns all 8 block headers.

Source

pub fn version(&self) -> NsisVersionHint

Returns the detected (or hinted) NSIS version.

Source

pub fn install_reg_rootkey(&self) -> i32

Returns the install registry root key.

Located after the block headers at offset 4 + 8*8 = 68.

Source

pub fn langtable_size(&self) -> i32

Returns the language table entry size.

This field determines the size of each entry in the language table block. Located at a version-dependent offset after the color fields.

Source

pub fn code_on_init(&self) -> i32

Returns the callback entry index for .onInit (-1 if unused).

Source

pub fn code_on_inst_success(&self) -> i32

Returns the callback entry index for .onInstSuccess (-1 if unused).

Source

pub fn code_on_inst_failed(&self) -> i32

Returns the callback entry index for .onInstFailed (-1 if unused).

Source

pub fn code_on_user_abort(&self) -> i32

Returns the callback entry index for .onUserAbort (-1 if unused).

Source

pub fn code_on_gui_init(&self) -> i32

Returns the callback entry index for .onGUIInit (-1 if unused).

Source

pub fn code_on_gui_end(&self) -> i32

Returns the callback entry index for .onGUIEnd (-1 if unused).

Source

pub fn code_on_mouse_over_section(&self) -> i32

Returns the callback entry index for .onMouseOverSection (-1 if unused).

Source

pub fn code_on_verify_inst_dir(&self) -> i32

Returns the callback entry index for .onVerifyInstDir (-1 if unused).

Source

pub fn code_on_sel_change(&self) -> i32

Returns the callback entry index for .onSelChange (-1 if unused).

Source

pub fn code_on_reboot_failed(&self) -> i32

Returns the callback entry index for .onRebootFailed (-1 if unused).

Source

pub fn block_data( &self, bt: BlockType, header_data: &'a [u8], ) -> Result<&'a [u8], Error>

Returns a slice of the decompressed header data for the given block type.

The returned slice starts at the block’s offset and contains num items (the interpretation of “num” depends on the block type).

§Errors

Returns Error::InvalidBlockOffset if the block offset or computed end is beyond the available data.

Source

pub fn is_silent(&self) -> bool

Returns true if the installer uses silent mode.

Source

pub fn is_auto_close(&self) -> bool

Returns true if the installer auto-closes after installation.

Trait Implementations§

Source§

impl<'a> Debug for CommonHeader<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CommonHeader<'a>

§

impl<'a> RefUnwindSafe for CommonHeader<'a>

§

impl<'a> Send for CommonHeader<'a>

§

impl<'a> Sync for CommonHeader<'a>

§

impl<'a> Unpin for CommonHeader<'a>

§

impl<'a> UnsafeUnpin for CommonHeader<'a>

§

impl<'a> UnwindSafe for CommonHeader<'a>

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.