Skip to content

Commit

Permalink
Merge pull request #1244 from GuillaumeGomez/update-and-cleanup
Browse files Browse the repository at this point in the history
Update dependencies, cleanup `Cargo.toml` and update edition to 2021
  • Loading branch information
GuillaumeGomez committed Apr 8, 2024
2 parents 258e1cf + c65673a commit 3faba91
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 32 deletions.
54 changes: 32 additions & 22 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Expand Up @@ -8,8 +8,8 @@ license = "MIT"
readme = "README.md"
rust-version = "1.74"
exclude = ["/test-unknown"]
categories = ["filesystem", "os", "api-bindings"]
edition = "2018"
keywords = ["system-information", "disk", "process", "network", "cpu"]
edition = "2021"

[lib]
name = "sysinfo"
Expand All @@ -19,7 +19,7 @@ default = ["multithread"]
apple-sandbox = []
apple-app-store = ["apple-sandbox"]
c-interface = []
multithread = ["rayon"]
multithread = ["dep:rayon"]
linux-netdevs = []
linux-tmpfs = []
debug = ["libc/extra_traits"]
Expand Down Expand Up @@ -49,7 +49,7 @@ serde = { version = "^1.0.190", optional = true }

[target.'cfg(windows)'.dependencies]
ntapi = "0.4"
windows = { version = "0.52", features = [
windows = { version = "0.54", features = [
"Wdk_System_SystemInformation",
"Wdk_System_SystemServices",
"Wdk_System_Threading",
Expand Down
1 change: 0 additions & 1 deletion src/common.rs
Expand Up @@ -7,7 +7,6 @@ use crate::{

use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::ffi::{OsStr, OsString};
use std::fmt;
use std::fmt::Formatter;
Expand Down
9 changes: 5 additions & 4 deletions src/windows/component.rs
Expand Up @@ -2,7 +2,7 @@

use crate::Component;

use windows::core::w;
use windows::core::{w, VARIANT};
use windows::Win32::Foundation::{SysAllocString, SysFreeString};
use windows::Win32::Security::PSECURITY_DESCRIPTOR;
use windows::Win32::System::Com::{
Expand All @@ -11,7 +11,7 @@ use windows::Win32::System::Com::{
RPC_C_IMP_LEVEL_IMPERSONATE,
};
use windows::Win32::System::Rpc::{RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE};
use windows::Win32::System::Variant::{VariantClear, VARIANT};
use windows::Win32::System::Variant::VariantClear;
use windows::Win32::System::Wmi::{
IEnumWbemClassObject, IWbemLocator, IWbemServices, WbemLocator, WBEM_FLAG_FORWARD_ONLY,
WBEM_FLAG_NONSYSTEM_ONLY, WBEM_FLAG_RETURN_IMMEDIATELY, WBEM_INFINITE,
Expand Down Expand Up @@ -276,7 +276,7 @@ impl Connection {
let mut variant = variant.assume_init();

// temperature is given in tenth of degrees Kelvin
let temp = (variant.Anonymous.decVal.Anonymous2.Lo64 / 10) as f32 - 273.15;
let temp = (variant.as_raw().Anonymous.decVal.Anonymous2.Lo64 / 10) as f32 - 273.15;
let _r = VariantClear(&mut variant);

let mut critical = None;
Expand All @@ -286,7 +286,8 @@ impl Connection {
.ok()?;

// temperature is given in tenth of degrees Kelvin
critical = Some((variant.Anonymous.decVal.Anonymous2.Lo64 / 10) as f32 - 273.15);
critical =
Some((variant.as_raw().Anonymous.decVal.Anonymous2.Lo64 / 10) as f32 - 273.15);
let _r = VariantClear(&mut variant);
}

Expand Down
2 changes: 1 addition & 1 deletion src/windows/network.rs
Expand Up @@ -145,7 +145,7 @@ impl NetworksInner {
}
}
}
let _err = FreeMibTable(table as _);
FreeMibTable(table as _);
}
// Remove interfaces which are gone.
self.interfaces.retain(|_, d| d.inner.updated);
Expand Down
2 changes: 2 additions & 0 deletions src/windows/system.rs
Expand Up @@ -315,6 +315,8 @@ impl SystemInner {
} else {
None
};
// Not sure why we need to make this
let process_list: &Wrap<UnsafeCell<&mut HashMap<Pid, Process>>> = &process_list;
if let Some(proc_) = (*process_list.0.get()).get_mut(&pid) {
let proc_ = &mut proc_.inner;
if proc_
Expand Down
1 change: 1 addition & 0 deletions src/windows/utils.rs
Expand Up @@ -80,6 +80,7 @@ impl RegKey {
Some(buf.as_mut_ptr()),
Some(buf_len),
)
.ok()
}
}

Expand Down

0 comments on commit 3faba91

Please sign in to comment.