pub struct LeBinary {
pub cpu: u16,
pub os_type: u16,
pub module_flags: u32,
pub page_size: u32,
pub module_name: Option<String>,
pub import_modules: Vec<String>,
pub objects: Vec<LeObject>,
pub fixups: Vec<LeFixup>,
pub entrypoint: Option<u64>,
pub initial_stack: Option<u64>,
}Expand description
A parsed LE image.
Fields§
§cpu: u16The header’s CPU type: 1 = 286, 2 = 386, 3 = 486.
os_type: u16The header’s target OS field. Watcom’s DOS/4GW links write 1 (OS/2); the container does not say “DOS”, the stub that loads it does.
module_flags: u32The header’s module flags.
page_size: u32§module_name: Option<String>The module name: the first entry of the resident name table.
import_modules: Vec<String>Import module names, in the order fixup records number them (1-based).
objects: Vec<LeObject>Objects in object-table order (objects[n - 1] is object n).
fixups: Vec<LeFixup>Every fixup record, sources in ascending address order.
entrypoint: Option<u64>Linear address of the initial EIP.
initial_stack: Option<u64>Linear address of the initial ESP.
Implementations§
Trait Implementations§
Source§impl BinaryFormat for LeBinary
impl BinaryFormat for LeBinary
Source§fn load_address(&self) -> u64
fn load_address(&self) -> u64
The lowest object base.
Source§fn bits(&self) -> u32
fn bits(&self) -> u32
32 when the entry point’s object (or, without one, any code object) is USE32; 16 otherwise.
Source§fn is_known_read_only(&self, _addr: u64) -> bool
fn is_known_read_only(&self, _addr: u64) -> bool
DOS extenders do not enforce the read-only flag (DOS/4GW maps every object read-write), so an object without it is not proven immutable.
Source§fn architecture(&self) -> Arch
fn architecture(&self) -> Arch
Source§fn endianness(&self) -> Endian
fn endianness(&self) -> Endian
EI_DATA); PE is always
little-endian. Defaults to little-endian for formats that record none.Source§fn linked_libraries(&self) -> Vec<String>
fn linked_libraries(&self) -> Vec<String>
DT_NEEDED sonames,
PE import-directory DLL names (original case; matching is
case-insensitive). Empty when the format has no such notion (Blob).Source§fn byte_at(&self, addr: u64) -> Option<u8>
fn byte_at(&self, addr: u64) -> Option<u8>
addr, or None if the address is unmapped.Source§fn bytes_at(&self, addr: u64) -> Option<&[u8]>
fn bytes_at(&self, addr: u64) -> Option<&[u8]>
addr. Read moreSource§fn mapped_regions(&self) -> Vec<(u64, Vec<u8>, bool, bool)>
fn mapped_regions(&self) -> Vec<(u64, Vec<u8>, bool, bool)>
(start, bytes, executable, writable). Read moreSource§fn is_executable(&self, addr: u64) -> bool
fn is_executable(&self, addr: u64) -> bool
true if addr lies in an executable region of this binary
image. Defaults to “mapped” for formats that don’t track per-region
permissions; formats with permission information (e.g. ELF segment
flags) should override this.Source§fn is_known_writable(&self, addr: u64) -> bool
fn is_known_writable(&self, addr: u64) -> bool
true only if addr lies in a region known to be writable
(from the container’s segment flags). Passes that fold a value out of
initialized memory use this to refuse mutable memory — e.g. a GOT slot
the dynamic linker overwrites at load time. Defaults to false
(“not proven writable”); Blob keeps the default.Source§fn segment_bounds(&self, addr: u64) -> Option<(u64, u64)>
fn segment_bounds(&self, addr: u64) -> Option<(u64, u64)>
[start, end) bounds of the mapped region containing addr, if
any. Used to key per-segment facts (e.g. executability propositions)
so repeated queries in one region collapse to a single entry. Defaults
to None for formats that do not expose their segments.Source§fn entry_points(&self) -> Vec<u64>
fn entry_points(&self) -> Vec<u64>
Source§fn entrypoint(&self) -> Option<u64>
fn entrypoint(&self) -> Option<u64>
e_entry), if the format
designates one. Unlike entry_points, this is the single address where
execution begins. Returns None for formats with no distinguished entry.Source§fn symbol_name(&self, addr: u64) -> Option<&str>
fn symbol_name(&self, addr: u64) -> Option<&str>
addr, if the
binary format has one (e.g. from an ELF symbol table).
Returns None for formats with no symbol information. Read moreSource§fn symbol_address(&self, name: &str) -> Option<u64>
fn symbol_address(&self, name: &str) -> Option<u64>
name, if the binary
format has one (e.g. main from an ELF .symtab, or an import stub
named after the function it resolves to).
Returns None for formats with no symbol information. Read moreSource§fn os(&self) -> TargetOs
fn os(&self) -> TargetOs
TargetOs::Unknown; PE returns Windows, ELF Linux.Source§fn symbols(&self) -> Vec<Symbol>
fn symbols(&self) -> Vec<Symbol>
symbol_name would answer for each address, with
the size and import provenance the container records. Empty for
formats with no symbol information.Source§fn is_external_symbol(&self, _addr: u64) -> bool
fn is_external_symbol(&self, _addr: u64) -> bool
true if addr is an external (imported) function stub,
e.g. a PLT thunk. The recursive disassembler will not lift the body
of external functions. Defaults to false.Source§fn import_library(&self, _addr: u64) -> Option<&str>
fn import_library(&self, _addr: u64) -> Option<&str>
addr: the PE import-directory DLL, or the ELF .gnu.version_r soname
the symbol’s version requirement points at. None when the format does
not record a per-symbol source library (e.g. an unversioned ELF import).Source§fn import_symbol_name(&self, _addr: u64) -> Option<&str>
fn import_symbol_name(&self, _addr: u64) -> Option<&str>
addr, if any. Read more