Commit 5c4cbc9d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Support querying for ITypeComp from ITypeInfo.

parent 355af77a
...@@ -227,15 +227,13 @@ static void ref_count_test(LPCWSTR type_lib) ...@@ -227,15 +227,13 @@ static void ref_count_test(LPCWSTR type_lib)
static void test_TypeComp(void) static void test_TypeComp(void)
{ {
ITypeComp *pTypeComp, *tcomp, *pTypeComp_tmp;
ITypeInfo *pTypeInfo, *ti, *pFontTypeInfo;
ITypeLib *pTypeLib; ITypeLib *pTypeLib;
ITypeComp *pTypeComp;
HRESULT hr; HRESULT hr;
ULONG ulHash; ULONG ulHash;
DESCKIND desckind; DESCKIND desckind;
BINDPTR bindptr; BINDPTR bindptr;
ITypeInfo *pTypeInfo;
ITypeInfo *pFontTypeInfo;
ITypeComp *pTypeComp_tmp;
static WCHAR wszStdFunctions[] = {'S','t','d','F','u','n','c','t','i','o','n','s',0}; static WCHAR wszStdFunctions[] = {'S','t','d','F','u','n','c','t','i','o','n','s',0};
static WCHAR wszSavePicture[] = {'S','a','v','e','P','i','c','t','u','r','e',0}; static WCHAR wszSavePicture[] = {'S','a','v','e','P','i','c','t','u','r','e',0};
static WCHAR wszOLE_TRISTATE[] = {'O','L','E','_','T','R','I','S','T','A','T','E',0}; static WCHAR wszOLE_TRISTATE[] = {'O','L','E','_','T','R','I','S','T','A','T','E',0};
...@@ -436,6 +434,17 @@ static void test_TypeComp(void) ...@@ -436,6 +434,17 @@ static void test_TypeComp(void)
hr = ITypeInfo_GetTypeComp(pFontTypeInfo, &pTypeComp); hr = ITypeInfo_GetTypeComp(pFontTypeInfo, &pTypeComp);
ok_ole_success(hr, ITypeLib_GetTypeComp); ok_ole_success(hr, ITypeLib_GetTypeComp);
hr = ITypeInfo_QueryInterface(pFontTypeInfo, &IID_ITypeComp, (void**)&tcomp);
ok(hr == S_OK, "got %08x\n", hr);
ok(tcomp == pTypeComp, "got %p, was %p\n", tcomp, pTypeComp);
hr = ITypeComp_QueryInterface(tcomp, &IID_ITypeInfo, (void**)&ti);
ok(hr == S_OK, "got %08x\n", hr);
ok(ti == pFontTypeInfo, "got %p, was %p\n", ti, pFontTypeInfo);
ITypeInfo_Release(ti);
ITypeComp_Release(tcomp);
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszClone); ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszClone);
hr = ITypeComp_Bind(pTypeComp, wszClone, ulHash, 0, &pTypeInfo, &desckind, &bindptr); hr = ITypeComp_Bind(pTypeComp, wszClone, ulHash, 0, &pTypeInfo, &desckind, &bindptr);
ok_ole_success(hr, ITypeComp_Bind); ok_ole_success(hr, ITypeComp_Bind);
...@@ -1684,7 +1693,7 @@ static void test_CreateTypeLib(SYSKIND sys) { ...@@ -1684,7 +1693,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
ITypeInfo *interface1, *interface2, *dual, *unknown, *dispatch, *ti; ITypeInfo *interface1, *interface2, *dual, *unknown, *dispatch, *ti;
ITypeInfo *tinfos[2]; ITypeInfo *tinfos[2];
ITypeInfo2 *ti2; ITypeInfo2 *ti2;
ITypeComp *tcomp; ITypeComp *tcomp, *tcomp2;
MEMBERID memids[2]; MEMBERID memids[2];
FUNCDESC funcdesc, *pfuncdesc; FUNCDESC funcdesc, *pfuncdesc;
ELEMDESC elemdesc[5], *edesc; ELEMDESC elemdesc[5], *edesc;
...@@ -3599,6 +3608,11 @@ static void test_CreateTypeLib(SYSKIND sys) { ...@@ -3599,6 +3608,11 @@ static void test_CreateTypeLib(SYSKIND sys) {
hres = ITypeInfo_GetTypeComp(ti, &tcomp); hres = ITypeInfo_GetTypeComp(ti, &tcomp);
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
hres = ITypeInfo_QueryInterface(ti, &IID_ITypeComp, (void**)&tcomp2);
ok(hres == S_OK, "got %08x\n", hres);
ok(tcomp == tcomp2, "got %p, was %p\n", tcomp2, tcomp);
ITypeComp_Release(tcomp2);
hres = ITypeComp_Bind(tcomp, invokeW, 0, INVOKE_FUNC, &interface1, &desckind, &bindptr); hres = ITypeComp_Bind(tcomp, invokeW, 0, INVOKE_FUNC, &interface1, &desckind, &bindptr);
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
ok(desckind == DESCKIND_FUNCDESC, "got wrong desckind: 0x%x\n", desckind); ok(desckind == DESCKIND_FUNCDESC, "got wrong desckind: 0x%x\n", desckind);
......
...@@ -5583,9 +5583,11 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface( ...@@ -5583,9 +5583,11 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
else if(IsEqualIID(riid, &IID_ICreateTypeInfo) || else if(IsEqualIID(riid, &IID_ICreateTypeInfo) ||
IsEqualIID(riid, &IID_ICreateTypeInfo2)) IsEqualIID(riid, &IID_ICreateTypeInfo2))
*ppvObject = &This->ICreateTypeInfo2_iface; *ppvObject = &This->ICreateTypeInfo2_iface;
else if(IsEqualIID(riid, &IID_ITypeComp))
*ppvObject = &This->ITypeComp_iface;
if(*ppvObject){ if(*ppvObject){
ITypeInfo2_AddRef(iface); IUnknown_AddRef((IUnknown*)*ppvObject);
TRACE("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject); TRACE("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject);
return S_OK; return S_OK;
} }
......
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