summaryrefslogtreecommitdiffstats
path: root/src/activeqt/container/qaxbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/activeqt/container/qaxbase.cpp')
-rw-r--r--src/activeqt/container/qaxbase.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 722a389..bdd0c77 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -595,6 +595,7 @@ public:
QAxBasePrivate()
: useEventSink(true), useMetaObject(true), useClassInfo(true),
cachedMetaObject(false), initialized(false), tryCache(false),
+ classContext(CLSCTX_SERVER),
ptr(0), disp(0), metaobj(0)
{
// protect initialization
@@ -638,6 +639,7 @@ public:
uint cachedMetaObject :1;
uint initialized :1;
uint tryCache :1;
+ unsigned long classContext;
IUnknown *ptr;
mutable IDispatch *disp;
@@ -989,6 +991,8 @@ QAxMetaObject *QAxBase::internalMetaObject() const
The control's read function always returns the control's UUID, if provided including the license
key, and the name of the server, but not including the username, the domain or the password.
+
+ \sa setClassContext()
*/
bool QAxBase::setControl(const QString &c)
{
@@ -1067,6 +1071,34 @@ void QAxBase::disableEventSink()
}
/*!
+ \since 5.13
+
+ \return the context the ActiveX control will run in (default CLSCTX_SERVER).
+*/
+unsigned long QAxBase::classContext() const
+{
+ return d->classContext;
+}
+
+/*!
+ \since 5.13
+
+ Sets the context the ActiveX control will run in to \a classContext
+
+ Affects the "dwClsContext" argument when calling CoCreateInstance.
+ This can be used to control in-proc vs. out-of-proc startup for controls
+ supporting both alternatives. Also, it can be used to modify/reduce control
+ permissions when used with CLSCTX_ENABLE_CLOAKING and an impersonation token.
+
+ Note that this function must be called before setControl() to have any
+ effect.
+*/
+void QAxBase::setClassContext(unsigned long classContext)
+{
+ d->classContext = classContext;
+}
+
+/*!
Disables the meta object generation for this ActiveX container.
This also disables the event sink and class info generation. If
you don't intend to use the Qt meta object implementation call
@@ -1237,7 +1269,7 @@ bool QAxBase::initialize(IUnknown **ptr)
res = initializeFromFile(ptr);
if (!res) { // standard
- HRESULT hres = CoCreateInstance(QUuid(ctrl), 0, CLSCTX_SERVER, IID_IUnknown,
+ HRESULT hres = CoCreateInstance(QUuid(ctrl), 0, d->classContext, IID_IUnknown,
reinterpret_cast<void **>(ptr));
res = S_OK == hres;
#ifndef QT_NO_DEBUG