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
49 static thread_local QComHelper s_comHelper;
53
54
55
56
57
58
59
60
63#if defined(HAS_APPMODEL)
64 static const bool hasPackageIdentity = []() {
66 switch (
const auto result = GetCurrentPackageFullName(&length,
nullptr)) {
67 case ERROR_INSUFFICIENT_BUFFER:
69 case APPMODEL_ERROR_NO_PACKAGE:
72 qWarning(
"Failed to resolve package identity (error code %ld)", result);
76 return hasPackageIdentity;
void qt_win_ensureComInitializedOnThisThread()
bool qt_win_hasPackageIdentity()