diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 88da5fb888e..bcf9912cbc1 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -775,3 +775,22 @@ HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO *server_info, CLSID *rclsi return return_multi_qi(obj, count, results, FALSE); } + +/*********************************************************************** + * CoCreateInstance (combase.@) + */ +HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, + REFIID riid, void **obj) +{ + MULTI_QI multi_qi = { .pIID = riid }; + HRESULT hr; + + TRACE("%s, %p, %#x, %s, %p.\n", debugstr_guid(rclsid), outer, cls_context, debugstr_guid(riid), obj); + + if (!obj) + return E_POINTER; + + hr = CoCreateInstanceEx(rclsid, outer, cls_context, NULL, 1, &multi_qi); + *obj = multi_qi.pItf; + return hr; +} diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index de0ebe7cd31..b8e374924aa 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -79,7 +79,7 @@ @ stdcall CoCreateErrorInfo(ptr) CreateErrorInfo @ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) ole32.CoCreateFreeThreadedMarshaler @ stdcall CoCreateGuid(ptr) -@ stdcall CoCreateInstance(ptr ptr long ptr ptr) ole32.CoCreateInstance +@ stdcall CoCreateInstance(ptr ptr long ptr ptr) @ stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr) ole32.CoCreateInstanceEx @ stub CoCreateInstanceFromApp @ stub CoCreateObjectInContext diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index e63759c0609..cc64d7c036f 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3263,58 +3263,6 @@ HRESULT WINAPI CoResumeClassObjects(void) return S_OK; } -/*********************************************************************** - * CoCreateInstance [OLE32.@] - * - * Creates an instance of the specified class. - * - * PARAMS - * rclsid [I] Class ID to create an instance of. - * pUnkOuter [I] Optional outer unknown to allow aggregation with another object. - * dwClsContext [I] Flags to restrict the location of the created instance. - * iid [I] The ID of the interface of the instance to return. - * ppv [O] On returns, contains a pointer to the specified interface of the instance. - * - * RETURNS - * Success: S_OK - * Failure: HRESULT code. - * - * NOTES - * The dwClsContext parameter can be one or more of the following: - *| CLSCTX_INPROC_SERVER - Use an in-process server, such as from a DLL. - *| CLSCTX_INPROC_HANDLER - Use an in-process object which handles certain functions for an object running in another process. - *| CLSCTX_LOCAL_SERVER - Connect to an object running in another process. - *| CLSCTX_REMOTE_SERVER - Connect to an object running on another machine. - * - * Aggregation is the concept of deferring the IUnknown of an object to another - * object. This allows a separate object to behave as though it was part of - * the object and to allow this the pUnkOuter parameter can be set. Note that - * not all objects support having an outer of unknown. - * - * SEE ALSO - * CoGetClassObject() - */ -HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance( - REFCLSID rclsid, - LPUNKNOWN pUnkOuter, - DWORD dwClsContext, - REFIID iid, - LPVOID *ppv) -{ - MULTI_QI multi_qi = { iid }; - HRESULT hres; - - TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)\n", debugstr_guid(rclsid), - pUnkOuter, dwClsContext, debugstr_guid(iid), ppv); - - if (ppv==0) - return E_POINTER; - - hres = CoCreateInstanceEx(rclsid, pUnkOuter, dwClsContext, NULL, 1, &multi_qi); - *ppv = multi_qi.pItf; - return hres; -} - static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr) { ULONG i; diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 6f44e298af8..550b3149d49 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -12,7 +12,7 @@ @ stdcall CoCopyProxy(ptr ptr) combase.CoCopyProxy @ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) @ stdcall CoCreateGuid(ptr) combase.CoCreateGuid -@ stdcall CoCreateInstance(ptr ptr long ptr ptr) +@ stdcall CoCreateInstance(ptr ptr long ptr ptr) combase.CoCreateInstance @ stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr) @ stdcall CoDecrementMTAUsage(ptr) @ stdcall CoDisableCallCancellation(ptr)