Skip to content

Commit

Permalink
Update windows-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
dalance committed Oct 21, 2024
1 parent 600208b commit ad5effd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
11 changes: 10 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ uzers = "0.12"
which = "6"

[target.'cfg(target_os = "windows")'.dependencies]
windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_NetworkManagement_IpHelper", "Win32_Security", "Win32_System_Diagnostics_ToolHelp", "Win32_System_ProcessStatus", "Win32_System_Threading"] }
windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_NetworkManagement_IpHelper", "Win32_Security", "Win32_System_Diagnostics_ToolHelp", "Win32_System_ProcessStatus", "Win32_System_Threading"] }

[target.'cfg(target_os = "freebsd")'.dependencies]
bsd-kvm = "0.1.5"
Expand Down
12 changes: 5 additions & 7 deletions src/process/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ use std::mem::{size_of, zeroed, MaybeUninit};
use std::ptr;
use std::thread;
use std::time::{Duration, Instant};
use windows_sys::Win32::Foundation::{
CloseHandle, FALSE, FILETIME, HANDLE, HMODULE, MAX_PATH, PSID,
};
use windows_sys::Win32::Foundation::{CloseHandle, FALSE, FILETIME, HANDLE, HMODULE, MAX_PATH};
use windows_sys::Win32::Security::{
AdjustTokenPrivileges, GetTokenInformation, LookupAccountSidW, LookupPrivilegeValueW,
TokenGroups, TokenUser, SE_DEBUG_NAME, SE_PRIVILEGE_ENABLED, SID, TOKEN_ADJUST_PRIVILEGES,
TOKEN_GROUPS, TOKEN_PRIVILEGES, TOKEN_QUERY, TOKEN_USER,
TokenGroups, TokenUser, PSID, SE_DEBUG_NAME, SE_PRIVILEGE_ENABLED, SID,
TOKEN_ADJUST_PRIVILEGES, TOKEN_GROUPS, TOKEN_PRIVILEGES, TOKEN_QUERY, TOKEN_USER,
};
use windows_sys::Win32::System::Diagnostics::ToolHelp::{
CreateToolhelp32Snapshot, Process32First, Process32Next, PROCESSENTRY32, TH32CS_SNAPPROCESS,
Expand Down Expand Up @@ -299,7 +297,7 @@ fn get_handle(pid: i32) -> Option<HANDLE> {
)
};

if handle == 0 {
if handle == std::ptr::null_mut() {
None
} else {
Some(handle)
Expand Down Expand Up @@ -366,7 +364,7 @@ fn get_memory_info(handle: HANDLE) -> Option<MemoryInfo> {

fn get_command(handle: HANDLE) -> Option<String> {
let mut exe_buf = [0u16; MAX_PATH as usize + 1];
let h_mod: HMODULE = 0;
let h_mod: HMODULE = std::ptr::null_mut();
let mut cb_needed = 0;

let ret = unsafe {
Expand Down

0 comments on commit ad5effd

Please sign in to comment.