add header item

This commit is contained in:
Jean-Marie Mineau 2023-08-25 14:41:39 +02:00
parent 736c4611ac
commit 52447aef42
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,33 @@
//! The header item: https://source.android.com/docs/core/runtime/dex-format#header-item
use crate::{DexFileMagic, EndianConstant};
/// The header item: https://source.android.com/docs/core/runtime/dex-format#header-item
#[derive(Serializable, PartialEq, Eq, Debug)]
pub struct UserItem {
pub magic: DexFileMagic,
pub checksum: u32,
pub signature: [u8; 20],
pub file_size: u32,
pub header_size: u32, // should be = 0x70
pub endian_tag: EndianConstant,
pub link_size: u32, // should be 0
pub link_off: u32, // should be 0
pub map_off: u32,
pub string_ids_size: u32,
pub string_ids_off: u32,
pub type_ids_size: u32, // At most 0xffff
pub type_ids_off: u32,
pub proto_ids_size: u32, // At most 0xffff
pub proto_ids_off: u32,
pub field_ids_size: u32,
pub field_ids_off: u32,
pub method_ids_size: u32,
pub method_ids_off: u32,
pub class_defs_size: u32,
pub class_defs_off: u32,
pub data_size: u32, // Must be an even multiple of sizeof(uint) -> % 8 = 0
pub data_off: u32,
}
// TODO: add checks

View file

@ -0,0 +1,7 @@
//! The items structures.
pub mod header;
pub mod map;
pub use header::*;
pub use map::*;