Commit 9fa68c5d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

combase: Move CoCreateInstance().

parent 93e7afb4
......@@ -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;
}
......@@ -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
......
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment