From 944a8f5e6e7ffd89a8673e65978b15410d224632 Mon Sep 17 00:00:00 2001 From: pandaadir05 Date: Thu, 20 Nov 2025 15:36:28 +0200 Subject: [PATCH] Fix Windows/macOS build errors - add Win32_UI feature and remove unused imports --- ghost-core/Cargo.toml | 1 + ghost-core/src/hollowing.rs | 2 +- ghost-core/src/hooks.rs | 4 +--- ghost-core/src/process.rs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ghost-core/Cargo.toml b/ghost-core/Cargo.toml index 4b843ab..8184d34 100644 --- a/ghost-core/Cargo.toml +++ b/ghost-core/Cargo.toml @@ -26,6 +26,7 @@ windows = { version = "0.58", features = [ "Win32_System_Memory", "Win32_System_LibraryLoader", "Win32_Security", + "Win32_UI_WindowsAndMessaging", ] } [target.'cfg(unix)'.dependencies] diff --git a/ghost-core/src/hollowing.rs b/ghost-core/src/hollowing.rs index eb35d92..6618ccb 100644 --- a/ghost-core/src/hollowing.rs +++ b/ghost-core/src/hollowing.rs @@ -1,7 +1,7 @@ use crate::{MemoryRegion, ProcessInfo, Result}; #[cfg(windows)] -use crate::memory::{read_pe_header_info, validate_pe_header, PEHeaderValidation}; +use crate::memory::{validate_pe_header, PEHeaderValidation}; #[derive(Debug, Clone)] pub struct HollowingDetection { diff --git a/ghost-core/src/hooks.rs b/ghost-core/src/hooks.rs index 6d01372..d04d10a 100644 --- a/ghost-core/src/hooks.rs +++ b/ghost-core/src/hooks.rs @@ -73,10 +73,9 @@ pub struct HookDetectionResult { mod platform { use super::{HookDetectionResult, HookInfo, HookType}; use crate::{GhostError, Result}; - use std::collections::HashMap; use windows::Win32::Foundation::CloseHandle; use windows::Win32::System::Diagnostics::Debug::ReadProcessMemory; - use windows::Win32::System::LibraryLoader::{GetModuleHandleW, GetProcAddress, LoadLibraryW}; + use windows::Win32::System::LibraryLoader::{GetModuleHandleW, GetProcAddress}; use windows::Win32::System::ProcessStatus::{ EnumProcessModulesEx, GetModuleBaseNameW, GetModuleInformation, LIST_MODULES_ALL, MODULEINFO, @@ -111,7 +110,6 @@ mod platform { pub fn detect_hook_injection(target_pid: u32) -> Result { let mut hooks = Vec::new(); let mut suspicious_count = 0; - let mut global_hooks = 0; let mut inline_hooks = 0; // Detect inline hooks in critical APIs diff --git a/ghost-core/src/process.rs b/ghost-core/src/process.rs index 716116b..1761bb9 100644 --- a/ghost-core/src/process.rs +++ b/ghost-core/src/process.rs @@ -49,7 +49,7 @@ impl fmt::Display for ProcessInfo { mod platform { use super::ProcessInfo; use anyhow::{Context, Result}; - use windows::Win32::Foundation::{CloseHandle, HANDLE}; + use windows::Win32::Foundation::CloseHandle; use windows::Win32::System::Diagnostics::ToolHelp::{ CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W, TH32CS_SNAPPROCESS,