Skip to content

Commit b0215aa

Browse files
committed
Common (Windows): fixes random failures of WMI initialization
1 parent 86cfa4e commit b0215aa

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/common/windows/com.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ static const char* doInitCom()
1717
return "CoInitializeEx() failed";
1818

1919
// Set general COM security levels
20-
if (FAILED(CoInitializeSecurity(
20+
21+
HRESULT hRes = CoInitializeSecurity(
2122
NULL,
2223
-1, // COM authentication
2324
NULL, // Authentication services
@@ -27,7 +28,9 @@ static const char* doInitCom()
2728
NULL, // Authentication info
2829
EOAC_NONE, // Additional capabilities
2930
NULL // Reserved
30-
)))
31+
);
32+
33+
if (FAILED(hRes) && hRes != RPC_E_TOO_LATE /* Has been set by a random dll */)
3134
{
3235
CoUninitialize();
3336
return "CoInitializeSecurity() failed";

0 commit comments

Comments
 (0)