mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 08:03:46 +00:00
fix: update Windows API calls for windows crate v0.52
This commit is contained in:
parent
60e1ce7e2d
commit
96ae6bed96
1 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue