Fix compilation errors on windows

This commit is contained in:
Albert24GG 2024-03-05 18:01:00 +02:00
parent 96da055d1a
commit c19eaf1756
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,7 @@
pub use module::Module; #[cfg(target_os = "linux")]
pub use module::ModuleEntry; pub use module::ModuleEntry;
pub use module::Module;
pub use process::Process; pub use process::Process;
pub mod module; pub mod module;

View File

@ -94,7 +94,7 @@ impl<'a> Module<'a> {
#[inline] #[inline]
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn imports(&self) -> &[Import] { pub fn imports(&self) -> &[Import] {
self.pe.imports &self.pe.imports
} }
#[inline] #[inline]
@ -158,7 +158,7 @@ impl<'a> Module<'a> {
#[inline] #[inline]
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn sections(&self) -> &[SectionTable] { pub fn sections(&self) -> &[SectionTable] {
self.pe.sections &self.pe.sections
} }
#[inline] #[inline]

View File

@ -1,4 +1,6 @@
use super::{Module, ModuleEntry}; use super::Module;
#[cfg(target_os = "linux")]
use super::ModuleEntry;
use anyhow::{bail, Result}; use anyhow::{bail, Result};
@ -66,7 +68,7 @@ impl Process {
Ok(process) Ok(process)
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn find_pattern(&self, module_name: &str, pattern: &str) -> Option<Address> { pub fn find_pattern(&self, module_name: &str, pattern: &str) -> Option<usize> {
let module = self.get_module_by_name(module_name)?; let module = self.get_module_by_name(module_name)?;
let pattern_bytes = Self::pattern_to_bytes(pattern); let pattern_bytes = Self::pattern_to_bytes(pattern);