From: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/ole32/compobj.c | 26 +++++---------------------
dlls/ole32/compobj_private.h | 1 +
dlls/ole32/ole32.spec | 1 +
dlls/ole32/oleproxy.c | 17 +++++++++++++++++
dlls/ole32/tests/marshal.c | 8 ++++++++
5 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 8e78519dc80..f84c12243f7 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2755,13 +2755,14 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(
if (CLSCTX_INPROC_SERVER & dwClsContext)
{
- if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler))
+ if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler) ||
+ IsEqualCLSID(rclsid, &CLSID_GlobalOptions) ||
+ IsEqualCLSID(rclsid, &CLSID_ManualResetEvent) ||
+ IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
{
apartment_release(apt);
- return FTMarshalCF_Create(iid, ppv);
+ return Ole32DllGetClassObject(rclsid, iid, ppv);
}
- if (IsEqualCLSID(rclsid, &CLSID_GlobalOptions))
- return IClassFactory_QueryInterface(&GlobalOptionsCF, iid, ppv);
}
if (CLSCTX_INPROC & dwClsContext)
@@ -2993,23 +2994,6 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(
}
apartment_release(apt);
- /*
- * The Standard Global Interface Table (GIT) object is a process-wide singleton.
- */
- if (IsEqualIID(&clsid, &CLSID_StdGlobalInterfaceTable))
- {
- IGlobalInterfaceTable *git = get_std_git();
- TRACE("Retrieving GIT\n");
- return return_multi_qi((IUnknown*)git, cmq, pResults, FALSE);
- }
-
- if (IsEqualCLSID(&clsid, &CLSID_ManualResetEvent)) {
- hres = ManualResetEvent_CreateInstance(&ManualResetEventCF, pUnkOuter, pResults[0].pIID, (void**)&unk);
- if (FAILED(hres))
- return hres;
- return return_multi_qi(unk, cmq, pResults, TRUE);
- }
-
/*
* Get a class factory to construct the object we want.
*/
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 974c230ddce..1b7aa5640ce 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -325,6 +325,7 @@ extern IClassFactory GlobalInterfaceTableCF DECLSPEC_HIDDEN;
extern HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid,
void **obj) DECLSPEC_HIDDEN;
extern IClassFactory ManualResetEventCF DECLSPEC_HIDDEN;
+extern HRESULT WINAPI Ole32DllGetClassObject(REFCLSID clsid, REFIID riid, void **obj) DECLSPEC_HIDDEN;
/* Exported non-interface Data Advise Holder functions */
HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN;
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index c83f0b27166..a8101df80bc 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -182,6 +182,7 @@
@ stdcall MkParseDisplayName(ptr wstr ptr ptr)
@ stdcall MonikerCommonPrefixWith(ptr ptr ptr)
@ stub MonikerRelativePathTo
+@ stdcall Ole32DllGetClassObject(ptr ptr ptr)
@ stdcall OleBuildVersion()
@ stdcall OleConvertIStorageToOLESTREAM(ptr ptr)
@ stub OleConvertIStorageToOLESTREAMEx
diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c
index 29cd391e127..0429e0f5495 100644
--- a/dlls/ole32/oleproxy.c
+++ b/dlls/ole32/oleproxy.c
@@ -220,3 +220,20 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
return Handler_DllGetClassObject(rclsid, iid, ppv);
}
+
+/***********************************************************************
+ * Ole32DllGetClassObject [OLE32.@]
+ */
+HRESULT WINAPI Ole32DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
+{
+ if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
+ return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, riid, obj);
+ else if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
+ return IClassFactory_QueryInterface(&ManualResetEventCF, riid, obj);
+ else if (IsEqualCLSID(rclsid, &CLSID_GlobalOptions))
+ return IClassFactory_QueryInterface(&GlobalOptionsCF, riid, obj);
+ else if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler))
+ return FTMarshalCF_Create(riid, obj);
+ else
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index ef608e66d01..a6811b9d241 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -4000,6 +4000,10 @@ static void test_globalinterfacetable(void)
ok_no_locks();
IGlobalInterfaceTable_Release(git);
+
+ hr = CoGetClassObject(&CLSID_StdGlobalInterfaceTable, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&cf);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ IClassFactory_Release(cf);
}
static void test_manualresetevent(void)
@@ -4016,6 +4020,10 @@ static void test_manualresetevent(void)
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IClassFactory_Release(factory);
+ hr = CoGetClassObject(&CLSID_ManualResetEvent, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&factory);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ IClassFactory_Release(factory);
+
hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk);
ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(!!punk, "Got NULL.\n");
--
2.23.0