Skip to main content

pe_assembler/formats/exe/
mod.rs

1#![doc = include_str!("readme.md")]
2
3use crate::{formats::exe::writer::ExeWriter, helpers::PeWriter, types::PeProgram};
4use gaia_types::{
5    helpers::{create_file, Url},
6    GaiaError,
7};
8use std::path::Path;
9
10/// PE EXE reader module.
11pub mod reader;
12/// PE EXE writer module.
13pub mod writer;
14
15/// Writes a PE program to the specified file path.
16pub fn exe_write_path(pe: &PeProgram, path: &Path) -> Result<Url, GaiaError> {
17    let (file, url) = create_file(path)?;
18    let mut exe = ExeWriter::new(file);
19    exe.write_program(pe)?;
20    Ok(url)
21}