exe-parse/src-tauri/src/services/mod.rs
2024-12-10 11:25:55 +08:00

31 lines
626 B
Rust

use memmap2::{Mmap, MmapMut};
use std::{
ops::{Deref, DerefMut},
sync::Mutex,
};
use crate::pe_parse::pe::PE;
pub mod file;
// 全局文件路径
pub static mut GLOBAL_FILE_PATH: Option<String> = None;
pub(crate) struct PeData(pub Vec<u8>);
// 实现Deref
impl Deref for PeData {
type Target = [u8];
fn deref(&self) -> &Self::Target {
&self.0
}
}
// 实现DerefMut
impl DerefMut for PeData {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl PE for PeData {}
// 文件的内存映射clone
pub static GLOBAL_FILE_DATA: Mutex<Option<PeData>> = Mutex::new(None);