add DexWriter squeleton

This commit is contained in:
Jean-Marie Mineau 2023-11-30 16:17:30 +01:00
parent 80968c9bcf
commit e194072981
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
4 changed files with 6 additions and 4 deletions

View file

@ -8,6 +8,7 @@ pub mod class;
pub mod code;
pub mod dex_id;
pub mod dex_string;
pub mod dex_writer;
pub mod field;
pub mod method;
pub mod method_handle;
@ -20,6 +21,7 @@ pub use class::*;
pub use code::*;
pub use dex_id::*;
pub use dex_string::*;
pub use dex_writer::*;
pub use field::*;
pub use method::*;
pub use method_handle::*;

View file

@ -6,7 +6,7 @@ pub use androscalpel_serializer_derive::*;
/// [dex-file-magic](https://source.android.com/docs/core/runtime/dex-format#dex-file-magic)
/// `version` is the Dex version of this file (encoded decimal digit).
#[derive(Serializable, PartialEq, Eq, Debug)]
#[derive(Serializable, PartialEq, Eq, Debug, Clone)]
pub struct DexFileMagic {
#[prefix([0x64, 0x65, 0x78, 0x0a])]
#[suffix([0x00])]
@ -17,7 +17,7 @@ pub struct DexFileMagic {
///
/// The only supported value as of 2023 is [`EndianConstant`]
/// ([because](https://cs.android.com/android/platform/superproject/main/+/main:art/libdexfile/dex/dex_file_verifier.cc;l=597;drc=397dd78fcdcfed36ee62302e2b90712e2d784364))
#[derive(Serializable, PartialEq, Eq, Debug)]
#[derive(Serializable, PartialEq, Eq, Debug, Clone)]
#[prefix_type(u32)]
pub enum EndianConstant {
#[prefix(0x12345678)]

View file

@ -5,7 +5,7 @@ use crate::{DexFileMagic, EndianConstant, Serializable};
/// <https://source.android.com/docs/core/runtime/dex-format#header-item>
/// alignment: 4 bytes
#[derive(Serializable, PartialEq, Eq, Debug)]
#[derive(Serializable, Clone, PartialEq, Eq, Debug)]
pub struct HeaderItem {
pub magic: DexFileMagic,
pub checksum: u32,

View file

@ -6,7 +6,7 @@ use std::io::Write;
/// <https://source.android.com/docs/core/runtime/dex-format#map-list>
/// alignment: 4 bytes
#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub struct MapList {
// pub size: u32,
pub list: Vec<MapItem>,