7#include <QtCore/qdebug.h>
19QComHelper::QComHelper(COINIT concurrencyModel)
22 concurrencyModel = COINIT(concurrencyModel | COINIT_DISABLE_OLE1DDE);
24 m_initResult = CoInitializeEx(
nullptr, concurrencyModel);
26 if (FAILED(m_initResult))
27 qErrnoWarning(m_initResult,
"Failed to initialize COM library");
30QComHelper::~QComHelper()
32 Q_ASSERT(m_threadId == GetCurrentThreadId());
33 if (SUCCEEDED(m_initResult))
38
39
40
41
42
43
44
45
46
47
48
51 static thread_local QComHelper s_comHelper;
55
56
57
58
59
60
61
62
65#if defined(HAS_APPMODEL)
66 static const bool hasPackageIdentity = []() {
68 switch (
const auto result = GetCurrentPackageFullName(&length,
nullptr)) {
69 case ERROR_INSUFFICIENT_BUFFER:
71 case APPMODEL_ERROR_NO_PACKAGE:
74 qWarning(
"Failed to resolve package identity (error code %ld)", result);
78 return hasPackageIdentity;
void qt_win_ensureComInitializedOnThisThread()
bool qt_win_hasPackageIdentity()