ole32: Move more built-in classes to CoGetClassObject().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-13 08:29:30 +01:00 committed by Alexandre Julliard
parent 8b4d41d667
commit 42f6be1133
5 changed files with 32 additions and 21 deletions

View File

@ -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.
*/

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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");