diff --git a/ghost-core/src/yara_engine.rs b/ghost-core/src/yara_engine.rs index bc6b998..d19f479 100644 --- a/ghost-core/src/yara_engine.rs +++ b/ghost-core/src/yara_engine.rs @@ -408,7 +408,7 @@ impl DynamicYaraEngine { } /// Read memory from a specific process and region - #[cfg(target_os = "windows")] + #[cfg(all(target_os = "windows", feature = "yara-scanning"))] fn read_process_memory(pid: u32, region: &MemoryRegion) -> Result, GhostError> { use windows::Win32::Foundation::CloseHandle; use windows::Win32::System::Diagnostics::Debug::ReadProcessMemory; @@ -446,8 +446,7 @@ impl DynamicYaraEngine { } /// Read memory from a specific process and region (Linux implementation) - #[cfg(target_os = "linux")] - #[allow(dead_code)] + #[cfg(all(target_os = "linux", feature = "yara-scanning"))] fn read_process_memory(pid: u32, region: &MemoryRegion) -> Result, GhostError> { use std::fs::File; use std::io::{Read, Seek, SeekFrom}; @@ -472,8 +471,7 @@ impl DynamicYaraEngine { } /// Read memory from a specific process and region (macOS implementation) - #[cfg(target_os = "macos")] - #[allow(dead_code)] + #[cfg(all(target_os = "macos", feature = "yara-scanning"))] fn read_process_memory(_pid: u32, _region: &MemoryRegion) -> Result, GhostError> { Err(GhostError::PlatformNotSupported { feature: "Memory reading not implemented for macOS".to_string(),