feat: parse and display all optional headers (M2)
Implement parsing for all 15 optional header types found in XEX2 files: inline values (entry point, base address, stack size, system flags), fixed-size structures (execution info, file format, TLS, game ratings, LAN key, checksum/timestamp), and variable-size structures (static libraries, import libraries, resource info, original PE name, Xbox 360 logo). Add comprehensive unit and integration tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -9,16 +9,20 @@
|
||||
pub mod display;
|
||||
pub mod error;
|
||||
pub mod header;
|
||||
pub mod optional;
|
||||
pub mod util;
|
||||
|
||||
use error::Result;
|
||||
use header::Xex2Header;
|
||||
use optional::OptionalHeaders;
|
||||
|
||||
/// A parsed XEX2 file containing all extracted structures.
|
||||
#[derive(Debug)]
|
||||
pub struct Xex2File {
|
||||
/// The main XEX2 header (magic, flags, sizes, offsets).
|
||||
pub header: Xex2Header,
|
||||
/// All parsed optional headers.
|
||||
pub optional_headers: OptionalHeaders,
|
||||
}
|
||||
|
||||
/// Parses an XEX2 file from a byte slice.
|
||||
@@ -27,6 +31,10 @@ pub struct Xex2File {
|
||||
/// Returns a [`Xex2File`] with all successfully parsed structures.
|
||||
pub fn parse(data: &[u8]) -> Result<Xex2File> {
|
||||
let header = header::parse_header(data)?;
|
||||
let optional_headers = optional::parse_optional_headers(data, &header)?;
|
||||
|
||||
Ok(Xex2File { header })
|
||||
Ok(Xex2File {
|
||||
header,
|
||||
optional_headers,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user