From 0d5abc1c0bc2bd99e48b9a53af2fbba9db48c733 Mon Sep 17 00:00:00 2001 From: Ohad Ravid Date: Sat, 3 Sep 2022 10:24:19 +0300 Subject: [PATCH] Use a timeout when calling `ConnectServer` --- Cargo.toml | 4 ++-- src/connection.rs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4e201d4..fc6b2c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "wmi" -version = "0.11.1" +version = "0.11.2" authors = ["Ohad Ravid "] -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" documentation = "https://docs.rs/crate/wmi" diff --git a/src/connection.rs b/src/connection.rs index 9391258..2a58f54 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -17,7 +17,10 @@ use winapi::{ combaseapi::{CoCreateInstance, CoInitializeEx, CoInitializeSecurity, CoSetProxyBlanket}, objbase::COINIT_MULTITHREADED, objidl::EOAC_NONE, - wbemcli::{CLSID_WbemLocator, IID_IWbemLocator, IWbemLocator, IWbemServices}, + wbemcli::{ + CLSID_WbemLocator, IID_IWbemLocator, IWbemLocator, IWbemServices, + WBEM_FLAG_CONNECT_USE_MAX_WAIT, + }, }, }; @@ -200,7 +203,7 @@ impl WMIConnection { ptr::null_mut(), ptr::null_mut(), ptr::null_mut(), - 0, + WBEM_FLAG_CONNECT_USE_MAX_WAIT as _, ptr::null_mut(), ptr::null_mut(), &mut p_svc,