This commit is contained in:
Jean-Marie Mineau 2023-08-31 14:02:04 +02:00
parent bda74f55ac
commit 559ae665cf
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
5 changed files with 92 additions and 12 deletions

View file

@ -17,7 +17,7 @@ use crate::core::*;
pub use androscalpel_serializer_derive::*;
/// <https://source.android.com/docs/core/runtime/dex-format#string-data-item>
#[derive(Serializable, PartialEq, Eq, Debug)]
#[derive(Serializable, Clone, PartialEq, Eq, Debug)]
pub struct StringDataItem {
pub utf16_size: Uleb128,
#[until(u8, u8, 0x00u8)]

View file

@ -90,6 +90,42 @@ impl<'a> DexFileReader<'a> {
pub fn get_header(&self) -> &HeaderItem {
&self.header
}
/// Retunr the file [`StringIdItem`] list.
pub fn get_string_ids(&self) -> &[StringIdItem] {
&self.string_ids
}
/// Retunr the file [`TypeIdItem`] list.
pub fn get_type_ids(&self) -> &[TypeIdItem] {
&self.type_ids
}
/// Retunr the file [`ProtoIdItem`] list.
pub fn get_proto_ids(&self) -> &[ProtoIdItem] {
&self.proto_ids
}
/// Retunr the file [`FieldIdItem`] list.
pub fn get_field_ids(&self) -> &[FieldIdItem] {
&self.field_ids
}
/// Retunr the file [`MethodIdItem`] list.
pub fn get_method_ids(&self) -> &[MethodIdItem] {
&self.method_ids
}
/// Retunr the file [`ClassDefItem`] list.
pub fn get_class_defs(&self) -> &[ClassDefItem] {
&self.class_defs
}
/// Retunr the file [`CallSiteIdItem`] list.
pub fn get_call_site_ids(&self) -> &[CallSiteIdItem] {
&self.call_site_ids
}
/// Retunr the file [`MethodHandleItem`] list.
pub fn get_method_handles(&self) -> &[MethodHandleItem] {
&self.method_handles
}
/// Retunr the file [`MapList`].
pub fn get_map_list(&self) -> &MapList {
&self.map_list
}
fn sanity_check(&self) -> Result<()> {
if self.header.magic.version != [0x30, 0x33, 0x39] {