6#include <QtCore/qdebug.h>
18QComHelper::QComHelper(COINIT concurrencyModel)
21 concurrencyModel = COINIT(concurrencyModel | COINIT_DISABLE_OLE1DDE);
23 m_initResult = CoInitializeEx(
nullptr, concurrencyModel);
25 if (FAILED(m_initResult))
26 qErrnoWarning(m_initResult,
"Failed to initialize COM library");
29QComHelper::~QComHelper()
31 Q_ASSERT(m_threadId == GetCurrentThreadId());
32 if (SUCCEEDED(m_initResult))
37
38
39
40
41
42
43
44
45
46
47
50 static thread_local QComHelper s_comHelper;
54
55
56
57
58
59
60
61
64#if defined(HAS_APPMODEL)
65 static const bool hasPackageIdentity = []() {
67 switch (
const auto result = GetCurrentPackageFullName(&length,
nullptr)) {
68 case ERROR_INSUFFICIENT_BUFFER:
70 case APPMODEL_ERROR_NO_PACKAGE:
73 qWarning(
"Failed to resolve package identity (error code %ld)", result);
77 return hasPackageIdentity;
void qt_win_ensureComInitializedOnThisThread()
bool qt_win_hasPackageIdentity()