diff --git a/src/lib.rs b/src/lib.rs index a3d0f9a..5dda5a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -169,6 +169,7 @@ pub enum Reference { pub struct Information { /// Specifies the platform for which the VBA project is created. pub sys_kind: SysKind, + compat: Option, lcid: u32, lcid_invoke: u32, /// Specifies the code page for the VBA project. diff --git a/src/parser.rs b/src/parser.rs index ce051d9..e0dab99 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -164,9 +164,21 @@ fn parse_syskind(i: &[u8]) -> IResult<&[u8], SysKind, FormatError<&[u8]>> { } } +fn parse_compat(i: &[u8]) -> IResult<&[u8], Option, FormatError<&[u8]>> { + const COMPAT_SIGNATURE: &[u8] = &[0x4A, 0x00]; + let (i, compat) = opt(preceded( + tuple((tag(COMPAT_SIGNATURE), tag(U32_FIXED_SIZE_4))), + le_u32, + ))(i)?; + Ok((i, compat)) +} + fn parse_lcid(i: &[u8]) -> IResult<&[u8], u32, FormatError<&[u8]>> { const LCID_SIGNATURE: &[u8] = &[0x02, 0x00]; - let (i, lcid) = preceded(tuple((tag(LCID_SIGNATURE), tag(U32_FIXED_SIZE_4))), le_u32)(i)?; + let (i, lcid) = preceded( + tuple((tag(LCID_SIGNATURE), tag(U32_FIXED_SIZE_4))), + le_u32, + )(i)?; Ok((i, lcid)) } @@ -562,6 +574,7 @@ pub(crate) fn parse_project_information( i: &[u8], ) -> IResult<&[u8], ProjectInformation, FormatError<&[u8]>> { let (i, sys_kind) = parse_syskind(i)?; + let (i, compat) = parse_compat(i)?; let (i, lcid) = parse_lcid(i)?; let (i, lcid_invoke) = parse_lcid_invoke(i)?; let (i, code_page) = parse_code_page(i)?; @@ -619,6 +632,7 @@ pub(crate) fn parse_project_information( ProjectInformation { information: Information { sys_kind, + compat, lcid, lcid_invoke, code_page,