pub struct Factory { /* private fields */ }Expand description
Factory for creating PE binaries from scratch
use lief::pe;
if let Some(mut factory) = pe::Factory::create(pe::PE_TYPE::PE32_PLUS) {
let section = pe::Section::new_with_name(".text");
factory.add_section(§ion);
factory.set_entrypoint(0x1000);
if let Some(binary) = factory.get() {
// use binary
}
}Implementations§
§impl Factory
impl Factory
pub fn create(pe_type: PE_TYPE) -> Option<Factory>
pub fn create(pe_type: PE_TYPE) -> Option<Factory>
Create a new factory for the given PE type (PE32 or PE32+)
pub fn add_section(&mut self, section: &Section<'_>)
pub fn add_section(&mut self, section: &Section<'_>)
Add a section to the PE being built
pub fn set_arch(&mut self, arch: MachineType)
pub fn set_arch(&mut self, arch: MachineType)
Set the target architecture
pub fn set_entrypoint(&mut self, ep: u64)
pub fn set_entrypoint(&mut self, ep: u64)
Set the entry point address
pub fn section_align(&self) -> u32
pub fn section_align(&self) -> u32
Return the section alignment
pub fn file_align(&self) -> u32
pub fn file_align(&self) -> u32
Return the file alignment
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Factory
impl !Send for Factory
impl !Sync for Factory
impl Unpin for Factory
impl UnwindSafe for Factory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more