diff --git a/Cargo.lock b/Cargo.lock index 3c5eb8b46..8d921a545 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bstr" @@ -74,15 +74,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "libc" @@ -98,9 +98,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "ntapi" @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -131,9 +131,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -157,9 +157,9 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ "bitflags", "errno", @@ -196,9 +196,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -207,9 +207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -275,9 +275,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" dependencies = [ "windows-core", "windows-targets", @@ -285,9 +285,19 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" dependencies = [ "windows-targets", ] diff --git a/Cargo.toml b/Cargo.toml index d3a383e8a..28be55df6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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"] @@ -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", diff --git a/src/common.rs b/src/common.rs index d4fb53e57..62b4d33c4 100644 --- a/src/common.rs +++ b/src/common.rs @@ -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; diff --git a/src/windows/component.rs b/src/windows/component.rs index 670e2b0b5..8195b0bda 100644 --- a/src/windows/component.rs +++ b/src/windows/component.rs @@ -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::{ @@ -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, @@ -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; @@ -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); } diff --git a/src/windows/network.rs b/src/windows/network.rs index e89db787d..60e1d32ad 100644 --- a/src/windows/network.rs +++ b/src/windows/network.rs @@ -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); diff --git a/src/windows/system.rs b/src/windows/system.rs index 0a9c6149f..267a978b9 100644 --- a/src/windows/system.rs +++ b/src/windows/system.rs @@ -315,6 +315,8 @@ impl SystemInner { } else { None }; + // Not sure why we need to make this + let process_list: &Wrap>> = &process_list; if let Some(proc_) = (*process_list.0.get()).get_mut(&pid) { let proc_ = &mut proc_.inner; if proc_ diff --git a/src/windows/utils.rs b/src/windows/utils.rs index 06fc69c0b..6c1c066e8 100644 --- a/src/windows/utils.rs +++ b/src/windows/utils.rs @@ -80,6 +80,7 @@ impl RegKey { Some(buf.as_mut_ptr()), Some(buf_len), ) + .ok() } }