diff --git a/src/lib/libwindisk/windisk.cpp b/src/lib/libwindisk/windisk.cpp index f68f8af4..d24098dd 100644 --- a/src/lib/libwindisk/windisk.cpp +++ b/src/lib/libwindisk/windisk.cpp @@ -43,6 +43,14 @@ WinDiskManagement::WinDiskManagement(QObject *parent, bool isHelper) } HRESULT res = S_OK; + + HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (FAILED(hr)) { + _com_error err(res); + logMessage(QtWarningMsg, QStringLiteral("Failed to initialize COM library. Error = %1").arg(err.ErrorMessage())); + return; + } + // This needs to be initialized before any RPC communication occurs // Currently when used in WinDriveManager we are good. res = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0);