Fix Windows/macOS build errors - add Win32_UI feature and remove unused imports

This commit is contained in:
pandaadir05
2025-11-20 15:36:28 +02:00
parent dc965bcddd
commit 944a8f5e6e
4 changed files with 4 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ windows = { version = "0.58", features = [
"Win32_System_Memory", "Win32_System_Memory",
"Win32_System_LibraryLoader", "Win32_System_LibraryLoader",
"Win32_Security", "Win32_Security",
"Win32_UI_WindowsAndMessaging",
] } ] }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]

View File

@@ -1,7 +1,7 @@
use crate::{MemoryRegion, ProcessInfo, Result}; use crate::{MemoryRegion, ProcessInfo, Result};
#[cfg(windows)] #[cfg(windows)]
use crate::memory::{read_pe_header_info, validate_pe_header, PEHeaderValidation}; use crate::memory::{validate_pe_header, PEHeaderValidation};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct HollowingDetection { pub struct HollowingDetection {

View File

@@ -73,10 +73,9 @@ pub struct HookDetectionResult {
mod platform { mod platform {
use super::{HookDetectionResult, HookInfo, HookType}; use super::{HookDetectionResult, HookInfo, HookType};
use crate::{GhostError, Result}; use crate::{GhostError, Result};
use std::collections::HashMap;
use windows::Win32::Foundation::CloseHandle; use windows::Win32::Foundation::CloseHandle;
use windows::Win32::System::Diagnostics::Debug::ReadProcessMemory; 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::{ use windows::Win32::System::ProcessStatus::{
EnumProcessModulesEx, GetModuleBaseNameW, GetModuleInformation, LIST_MODULES_ALL, EnumProcessModulesEx, GetModuleBaseNameW, GetModuleInformation, LIST_MODULES_ALL,
MODULEINFO, MODULEINFO,
@@ -111,7 +110,6 @@ mod platform {
pub fn detect_hook_injection(target_pid: u32) -> Result<HookDetectionResult> { pub fn detect_hook_injection(target_pid: u32) -> Result<HookDetectionResult> {
let mut hooks = Vec::new(); let mut hooks = Vec::new();
let mut suspicious_count = 0; let mut suspicious_count = 0;
let mut global_hooks = 0;
let mut inline_hooks = 0; let mut inline_hooks = 0;
// Detect inline hooks in critical APIs // Detect inline hooks in critical APIs

View File

@@ -49,7 +49,7 @@ impl fmt::Display for ProcessInfo {
mod platform { mod platform {
use super::ProcessInfo; use super::ProcessInfo;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use windows::Win32::Foundation::{CloseHandle, HANDLE}; use windows::Win32::Foundation::CloseHandle;
use windows::Win32::System::Diagnostics::ToolHelp::{ use windows::Win32::System::Diagnostics::ToolHelp::{
CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W, CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W,
TH32CS_SNAPPROCESS, TH32CS_SNAPPROCESS,