From 96ae6bed96e1182252312da4e9abaf92a91de12d Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Fri, 6 Feb 2026 03:50:50 -0800 Subject: [PATCH] fix: update Windows API calls for windows crate v0.52 --- server/packages/sandbox-agent/src/daemon.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/packages/sandbox-agent/src/daemon.rs b/server/packages/sandbox-agent/src/daemon.rs index e011d11..58bf6b4 100644 --- a/server/packages/sandbox-agent/src/daemon.rs +++ b/server/packages/sandbox-agent/src/daemon.rs @@ -122,18 +122,18 @@ pub fn is_process_running(pid: u32) -> bool { #[cfg(windows)] pub fn is_process_running(pid: u32) -> bool { - use windows::Win32::Foundation::{CloseHandle, HANDLE}; + use windows::Win32::Foundation::CloseHandle; use windows::Win32::System::Threading::{ GetExitCodeProcess, OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION, }; unsafe { - let handle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, pid); - if handle.is_invalid() { - return false; - } + let handle = match OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, pid) { + Ok(h) => h, + Err(_) => return false, + }; let mut exit_code = 0u32; - let ok = GetExitCodeProcess(handle, &mut exit_code).as_bool(); + let ok = GetExitCodeProcess(handle, &mut exit_code).is_ok(); let _ = CloseHandle(handle); ok && exit_code == 259 }