From b0215aae373c3fa8b481530fdb484be491ba4ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 19 Mar 2026 15:46:19 +0800 Subject: [PATCH] Common (Windows): fixes random failures of WMI initialization --- src/common/windows/com.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/windows/com.cpp b/src/common/windows/com.cpp index f1e43418c..47da8e319 100644 --- a/src/common/windows/com.cpp +++ b/src/common/windows/com.cpp @@ -17,7 +17,8 @@ static const char* doInitCom() return "CoInitializeEx() failed"; // Set general COM security levels - if (FAILED(CoInitializeSecurity( + + HRESULT hRes = CoInitializeSecurity( NULL, -1, // COM authentication NULL, // Authentication services @@ -27,7 +28,9 @@ static const char* doInitCom() NULL, // Authentication info EOAC_NONE, // Additional capabilities NULL // Reserved - ))) + ); + + if (FAILED(hRes) && hRes != RPC_E_TOO_LATE /* Has been set by a random dll */) { CoUninitialize(); return "CoInitializeSecurity() failed";