Struct lief::pe::Section

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

This structure defines a regular PE section.

Note that it implements the trait generic::Section which provides additional functions.

Implementations§

§

impl Section<'_>

pub fn sizeof_raw_data(&self) -> u32

Return the size of the data in the section.

pub fn virtual_size(&self) -> u32

Return the size of the data when mapped in memory

If this value is greater than Section::sizeof_raw_data, the section is zero-padded.

pub fn pointerto_raw_data(&self) -> u32

The offset of the section data in the PE file

pub fn pointerto_relocation(&self) -> u32

The file pointer to the beginning of the COFF relocation entries for the section. This is set to zero for executable images or if there are no relocations.

For modern PE binaries, this value is usually set to 0 as the relocations are managed by crate::pe::Relocation.

pub fn pointerto_line_numbers(&self) -> u32

The file pointer to the beginning of line-number entries for the section. This is set to zero if there are no COFF line numbers. This value should be zero for an image because COFF debugging information is deprecated and modern debug information relies on the PDB files.

pub fn numberof_relocations(&self) -> u32

No longer used in recent PE binaries produced by Visual Studio

pub fn numberof_line_numbers(&self) -> u32

No longer used in recent PE binaries produced by Visual Studio

pub fn characteristics(&self) -> Characteristics

Characteristics of the section: it provides information about the permissions of the section when mapped. It can also provide information about the purpose of the section (contain code, BSS-like, …)

pub fn padding(&self) -> &[u8]

Content of the section’s padding area

Trait Implementations§

§

impl Debug for Section<'_>

§

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

Formats the value using the given formatter. Read more
§

impl Section for Section<'_>

§

fn name(&self) -> String

Name of the section
§

fn size(&self) -> u64

Size of the section in the file
§

fn offset(&self) -> u64

Offset of the section in the file
§

fn virtual_address(&self) -> u64

Address of the section in memory
§

fn content(&self) -> &[u8]

Content of the section

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Section<'a>

§

impl<'a> !Send for Section<'a>

§

impl<'a> !Sync for Section<'a>

§

impl<'a> Unpin for Section<'a>

§

impl<'a> UnwindSafe for Section<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.