add header item
This commit is contained in:
parent
736c4611ac
commit
52447aef42
2 changed files with 40 additions and 0 deletions
33
androscalpel_serializer/src/items/header.rs
Normal file
33
androscalpel_serializer/src/items/header.rs
Normal 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
|
||||||
7
androscalpel_serializer/src/items/mod.rs
Normal file
7
androscalpel_serializer/src/items/mod.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
//! The items structures.
|
||||||
|
|
||||||
|
pub mod header;
|
||||||
|
pub mod map;
|
||||||
|
|
||||||
|
pub use header::*;
|
||||||
|
pub use map::*;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue