diff options
author | Fredrik Orderud <fredrik.orderud@ge.com> | 2018-10-22 08:49:53 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2018-10-24 10:38:46 +0000 |
commit | 7691225c934130c78a7df4c8803f14532e0a2976 (patch) | |
tree | ba0cb02c496ce49ff0627d3bcf939edc22ab0dec | |
parent | ed59e85a6d1a12d6192c6c4bab54382f2fdb643d (diff) |
Enable DllSurrogate activation when building as DLL
DllSurrogate enables launching of the control in a separate dllhost.exe process,
instead of loading it directly into the container process. This can be used for
failure isolation and/or security sandboxing.
DllSurrogate activation is not enabled by default. It has to be enabled explicitly by
calling QAxWidget::setClassContext with a bitmask that includes CLSCTX_LOCAL_SERVER
but _not_ CLSCTX_INPROC_SERVER before creating the control.
REF: https://docs.microsoft.com/en-us/windows/desktop/com/dllsurrogate
Task-number: QTBUG-70983
Change-Id: I46ce7a3f8469f3841b59d5bfe284b9ba4e39568d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r-- | src/activeqt/control/qaxserver.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index ee55f09..eb64fd4 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -283,10 +283,11 @@ HRESULT UpdateRegistry(BOOL bRegister) } if (bRegister) { - if (qAxOutProcServer) { - settings->setValue(QLatin1String("/AppID/") + appId + QLatin1String("/."), module); + settings->setValue(QLatin1String("/AppID/") + appId + QLatin1String("/."), module); + if (qAxOutProcServer) settings->setValue(QLatin1String("/AppID/") + module + QLatin1String(".EXE/AppID"), appId); - } + else + settings->setValue(QLatin1String("/AppID/") + appId + QLatin1String("/DllSurrogate"), ""); const QStringList keys = qAxFactory()->featureList(); for (const QString &classNameIn : keys) { @@ -328,8 +329,7 @@ HRESULT UpdateRegistry(BOOL bRegister) key = QLatin1String("/CLSID/") + classId; settings->setValue(key + QLatin1String("/."), className + QLatin1String(" Class")); - if (file.endsWith(QLatin1String("exe"), Qt::CaseInsensitive)) - settings->setValue(key + QLatin1String("/AppID"), appId); + settings->setValue(key + QLatin1String("/AppID"), appId); if (control) settings->setValue(key + QLatin1String("/Control/."), QVariant(QLatin1String(""))); if (insertable) @@ -390,10 +390,12 @@ HRESULT UpdateRegistry(BOOL bRegister) qAxFactory()->registerClass(classNameIn, settings.data()); } } else { - if (qAxOutProcServer) { - settings->remove(QLatin1String("/AppID/") + appId + QLatin1String("/.")); + settings->remove(QLatin1String("/AppID/") + appId + QLatin1String("/.")); + if (qAxOutProcServer) settings->remove(QLatin1String("/AppID/") + module + QLatin1String(".EXE")); - } + else + settings->remove(QLatin1String("/AppID/") + appId + QLatin1String("/DllSurrogate")); + const QStringList keys = qAxFactory()->featureList(); for (const QString &classNameIn : keys) { const QMetaObject *mo = qAxFactory()->metaObject(classNameIn); |