feat: 写了一个派生宏,来简单的序列化一个结构体

This commit is contained in:
2024-12-09 16:26:29 +08:00
parent f837e7cdaf
commit 142a8cd3eb
8 changed files with 199 additions and 260 deletions

View File

@@ -1,8 +1,10 @@
use super::types::*;
use bitflags::bitflags;
use serde::Serialize;
use pe_serialize_proc_macro::SerializeEX;
use serde::ser::SerializeStruct;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, SerializeEX)]
pub struct ImageDosHeader {
pub e_magic: u16, // Magic number 固定值 0x5A4D
pub e_cblp: u16,
@@ -22,7 +24,7 @@ pub struct ImageDosHeader {
pub e_oemid: u16,
pub e_oeminfo: u16,
pub e_res2: [u16; 10],
pub e_lfanew: Offset, // File address of new exe header nt头的偏移
pub e_lfanew: u32, // File address of new exe header nt头的偏移
}
#[repr(C)]