36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
//! The header item: https://source.android.com/docs/core/runtime/dex-format#header-item
|
|
|
|
use crate as androscalpel_serializer;
|
|
use crate::{DexFileMagic, EndianConstant, Serializable};
|
|
|
|
/// The header item: https://source.android.com/docs/core/runtime/dex-format#header-item
|
|
///
|
|
/// alignment: 4 bytes
|
|
#[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
|