diff --git a/WatcherAgent/src/main.rs b/WatcherAgent/src/main.rs index 28ccb82..cfd1ce4 100644 --- a/WatcherAgent/src/main.rs +++ b/WatcherAgent/src/main.rs @@ -467,10 +467,15 @@ fn get_cpu_temp() -> Option { None } + #[cfg(target_os = "windows")] + fn failed(hr: winapi::shared::winerror::HRESULT) -> bool { + hr < 0 + } + #[cfg(target_os = "windows")] { use com::runtime::init_runtime; - use com::sys::{CLSCTX_INPROC_SERVER, FAILED}; + use com::sys::CLSCTX_INPROC_SERVER; use widestring::U16CString; use winapi::shared::rpcdce::*; use winapi::shared::wtypes::VT_I4; @@ -566,7 +571,7 @@ fn get_cpu_temp() -> Option { &mut returned, ); - if FAILED(hr) { + if failed(hr) { eprintln!("Failed to enumerate WMI objects (HRESULT: {})", hr); (*enumerator).Release(); continue;