pub struct ManualMapper<S> { /* private fields */ }Expand description
manual mapper with type-state progression
the type parameter ensures mapping steps happen in correct order: Parsed -> Allocated -> SectionsMapped -> Relocated -> ImportsResolved -> TlsProcessed -> Ready
Implementations§
Source§impl ManualMapper<Parsed>
impl ManualMapper<Parsed>
Sourcepub fn allocate(self) -> Result<ManualMapper<Allocated>>
pub fn allocate(self) -> Result<ManualMapper<Allocated>>
allocate memory for the PE image
tries preferred base first, falls back to any available address
Sourcepub fn allocate_at(self, base: usize) -> Result<ManualMapper<Allocated>>
pub fn allocate_at(self, base: usize) -> Result<ManualMapper<Allocated>>
allocate at specific address
fails if address is not available
Sourcepub fn allocate_anywhere(self) -> Result<ManualMapper<Allocated>>
pub fn allocate_anywhere(self) -> Result<ManualMapper<Allocated>>
allocate anywhere (no preference)
Source§impl ManualMapper<Allocated>
impl ManualMapper<Allocated>
Sourcepub fn map_sections(self) -> Result<ManualMapper<SectionsMapped>>
pub fn map_sections(self) -> Result<ManualMapper<SectionsMapped>>
map PE sections to allocated memory
Source§impl ManualMapper<SectionsMapped>
impl ManualMapper<SectionsMapped>
Sourcepub fn relocate(self) -> Result<ManualMapper<Relocated>>
pub fn relocate(self) -> Result<ManualMapper<Relocated>>
apply base relocations
Sourcepub fn skip_relocations(self) -> ManualMapper<Relocated>
pub fn skip_relocations(self) -> ManualMapper<Relocated>
skip relocations (use if loaded at preferred base)
Source§impl ManualMapper<Relocated>
impl ManualMapper<Relocated>
Sourcepub fn resolve_imports(self) -> Result<ManualMapper<ImportsResolved>>
pub fn resolve_imports(self) -> Result<ManualMapper<ImportsResolved>>
resolve import address table
Sourcepub fn resolve_imports_with<F>(
self,
resolver_fn: F,
) -> Result<ManualMapper<ImportsResolved>>
pub fn resolve_imports_with<F>( self, resolver_fn: F, ) -> Result<ManualMapper<ImportsResolved>>
resolve imports with custom resolver function
Sourcepub fn skip_imports(self) -> ManualMapper<ImportsResolved>
pub fn skip_imports(self) -> ManualMapper<ImportsResolved>
skip import resolution (use if PE has no imports or manually resolved)
Source§impl ManualMapper<ImportsResolved>
impl ManualMapper<ImportsResolved>
Sourcepub fn process_tls(self) -> Result<ManualMapper<TlsProcessed>>
pub fn process_tls(self) -> Result<ManualMapper<TlsProcessed>>
process TLS callbacks
Sourcepub fn skip_tls(self) -> ManualMapper<TlsProcessed>
pub fn skip_tls(self) -> ManualMapper<TlsProcessed>
skip TLS processing
Source§impl ManualMapper<TlsProcessed>
impl ManualMapper<TlsProcessed>
Sourcepub fn finalize(self) -> Result<ManualMapper<Ready>>
pub fn finalize(self) -> Result<ManualMapper<Ready>>
finalize mapping with proper memory protections
Sourcepub fn finalize_without_protections(self) -> ManualMapper<Ready>
pub fn finalize_without_protections(self) -> ManualMapper<Ready>
finalize without setting protections (keeps RW everywhere)
Source§impl ManualMapper<Ready>
impl ManualMapper<Ready>
Sourcepub fn call_entry_point(&self) -> Result<bool>
pub fn call_entry_point(&self) -> Result<bool>
call DllMain with DLL_PROCESS_ATTACH
Sourcepub fn call_entry_point_with_reason(&self, call_reason: u32) -> Result<bool>
pub fn call_entry_point_with_reason(&self, call_reason: u32) -> Result<bool>
call DllMain with custom reason
Sourcepub fn get_export(&self, name: &str) -> Result<usize>
pub fn get_export(&self, name: &str) -> Result<usize>
get export address by name
Sourcepub fn get_export_by_ordinal(&self, ordinal: u16) -> Result<usize>
pub fn get_export_by_ordinal(&self, ordinal: u16) -> Result<usize>
get export address by ordinal
Sourcepub fn into_memory(self) -> MappedMemory
pub fn into_memory(self) -> MappedMemory
consume and return raw memory handle