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<'_>
impl Section<'_>
pub fn sizeof_raw_data(&self) -> u32
pub fn sizeof_raw_data(&self) -> u32
Return the size of the data in the section.
pub fn virtual_size(&self) -> u32
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
pub fn pointerto_raw_data(&self) -> u32
The offset of the section data in the PE file
pub fn pointerto_relocation(&self) -> u32
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
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) -> u16
pub fn numberof_relocations(&self) -> u16
No longer used in recent PE binaries produced by Visual Studio
pub fn numberof_line_numbers(&self) -> u16
pub fn numberof_line_numbers(&self) -> u16
No longer used in recent PE binaries produced by Visual Studio
pub fn characteristics(&self) -> Characteristics
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 is_discardable(&self) -> bool
pub fn is_discardable(&self) -> bool
True if the section can be discarded as needed.
This is typically the case for debug-related sections
pub fn coff_string(&self) -> Option<String<'_>>
pub fn coff_string(&self) -> Option<String<'_>>
Return the COFF string associated with the section’s name (or a None)
This coff string is usually present for long section names whose length does not fit in the 8 bytes allocated by the PE format.