Implemented the CoCreateInstanceEx method.

This commit is contained in:
Francis Beaudet 1999-04-11 12:01:08 +00:00 committed by Alexandre Julliard
parent 6f0056d0bd
commit 0c12f37afd
4 changed files with 79 additions and 1 deletions

View File

@ -178,5 +178,11 @@ HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
/* FIXME: unimplemented */
HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid,
LPUNKNOWN pUnkOuter,
DWORD dwClsContext,
COSERVERINFO* pServerInfo,
ULONG cmq,
MULTI_QI* pResults);
#endif /* __WINE_WINE_OBJ_MISC_H */

View File

@ -315,6 +315,7 @@ extern int WIN32_LastError;
#define CO_E_INIT_SCM_EXEC_FAILURE 0x80004011
#define CO_E_INIT_ONLY_SINGLE_THREADED 0x80004012 */
#define CO_S_NOTALLINTERFACES 0x00080012
#define CO_E_NOTINITIALIZED 0x800401F0
#define CO_E_ERRORINDLL 0x800401F9
#define CO_E_OBJISREG 0x800401FB

View File

@ -1439,7 +1439,78 @@ HRESULT WINAPI CoCreateInstance(
return hres;
}
/***********************************************************************
* CoCreateInstanceEx [OLE32.165]
*/
HRESULT WINAPI CoCreateInstanceEx(
REFCLSID rclsid,
LPUNKNOWN pUnkOuter,
DWORD dwClsContext,
COSERVERINFO* pServerInfo,
ULONG cmq,
MULTI_QI* pResults)
{
IUnknown* pUnk = NULL;
HRESULT hr;
ULONG index;
int successCount = 0;
/*
* Sanity check
*/
if ( (cmq==0) || (pResults==NULL))
return E_INVALIDARG;
if (pServerInfo!=NULL)
FIXME(ole, "() non-NULL pServerInfo not supported!\n");
/*
* Initialize all the "out" parameters.
*/
for (index = 0; index < cmq; index++)
{
pResults[index].pItf = NULL;
pResults[index].hr = E_NOINTERFACE;
}
/*
* Get the object and get it's IUnknown pointer.
*/
hr = CoCreateInstance(rclsid,
pUnkOuter,
dwClsContext,
&IID_IUnknown,
(VOID**)&pUnk);
if (hr)
return hr;
/*
* Then, query for all the interfaces requested.
*/
for (index = 0; index < cmq; index++)
{
pResults[index].hr = IUnknown_QueryInterface(pUnk,
pResults[index].pIID,
(VOID**)&(pResults[index].pItf));
if (pResults[index].hr == S_OK)
successCount++;
}
/*
* Release our temporary unknown pointer.
*/
IUnknown_Release(pUnk);
if (successCount == 0)
return E_NOINTERFACE;
if (successCount!=cmq)
return CO_S_NOTALLINTERFACES;
return S_OK;
}
/***********************************************************************
* CoFreeLibrary [COMPOBJ.13]

View File

@ -165,7 +165,7 @@ type win32
162 stub WriteStringStream
163 stdcall CoInitializeEx(ptr long) CoInitializeEx
164 stub CoInitializeSecurity # stdcall (ptr long ptr ptr long long ptr long ptr) return 0,ERR_NOTIMPLEMENTED
165 stub CoCreateInstanceEx # stdcall (ptr ptr long ptr long ptr) return 0,ERR_NOTIMPLEMENTED
165 stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr) CoCreateInstanceEx
166 stub PropVariantClear
167 stub CoCopyProxy # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
168 stub CoGetCallContext # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED