summaryrefslogtreecommitdiff
path: root/sapi/activescript/classfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/activescript/classfactory.cpp')
-rw-r--r--sapi/activescript/classfactory.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/sapi/activescript/classfactory.cpp b/sapi/activescript/classfactory.cpp
index bd0416d7ed..5fa37c9f03 100644
--- a/sapi/activescript/classfactory.cpp
+++ b/sapi/activescript/classfactory.cpp
@@ -98,11 +98,15 @@ STDMETHODIMP TPHPClassFactory::LockServer(BOOL fLock)
STDMETHODIMP TPHPClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject)
{
- TPHPScriptingEngine *engine = new TPHPScriptingEngine;
+ IUnknown *punk = create_scripting_engine(NULL);
+ HRESULT ret;
- HRESULT ret = engine->QueryInterface(iid, ppvObject);
-
- engine->Release();
+ if (punk) {
+ ret = punk->QueryInterface(iid, ppvObject);
+ punk->Release();
+ } else {
+ ret = E_UNEXPECTED;
+ }
return ret;
}
@@ -161,7 +165,13 @@ static const GUID *script_engine_categories[] = {
};
static const struct reg_class classes_to_register[] = {
- { &CLSID_PHPActiveScriptEngine, "PHP Active Script Engine", "Both", engine_entries, script_engine_categories },
+ { &CLSID_PHPActiveScriptEngine, "PHP Active Script Engine",
+#if ACTIVEPHP_THREADING_MODE == COINIT_MULTITHREADED
+ "Both",
+#else
+ "Apartment",
+#endif
+ engine_entries, script_engine_categories },
{ NULL, NULL, NULL, 0, NULL }
};
/* }}} */