Nikolay Sivov : oleaut32: Support querying for ITypeComp from ITypeInfo.

Alexandre Julliard julliard at winehq.org
Fri Aug 26 10:18:11 CDT 2016


Module: wine
Branch: master
Commit: 5c4cbc9d6006a1c630dabf1dc4e820f770aee9f4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c4cbc9d6006a1c630dabf1dc4e820f770aee9f4

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug 25 20:57:15 2016 +0300

oleaut32: Support querying for ITypeComp from ITypeInfo.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/tests/typelib.c | 24 +++++++++++++++++++-----
 dlls/oleaut32/typelib.c       |  4 +++-
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 593925b..4f43cfe 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -227,15 +227,13 @@ static void ref_count_test(LPCWSTR type_lib)
 
 static void test_TypeComp(void)
 {
+    ITypeComp *pTypeComp, *tcomp, *pTypeComp_tmp;
+    ITypeInfo *pTypeInfo, *ti, *pFontTypeInfo;
     ITypeLib *pTypeLib;
-    ITypeComp *pTypeComp;
     HRESULT hr;
     ULONG ulHash;
     DESCKIND desckind;
     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 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};
@@ -436,6 +434,17 @@ static void test_TypeComp(void)
     hr = ITypeInfo_GetTypeComp(pFontTypeInfo, &pTypeComp);
     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);
     hr = ITypeComp_Bind(pTypeComp, wszClone, ulHash, 0, &pTypeInfo, &desckind, &bindptr);
     ok_ole_success(hr, ITypeComp_Bind);
@@ -1684,7 +1693,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
     ITypeInfo *interface1, *interface2, *dual, *unknown, *dispatch, *ti;
     ITypeInfo *tinfos[2];
     ITypeInfo2 *ti2;
-    ITypeComp *tcomp;
+    ITypeComp *tcomp, *tcomp2;
     MEMBERID memids[2];
     FUNCDESC funcdesc, *pfuncdesc;
     ELEMDESC elemdesc[5], *edesc;
@@ -3599,6 +3608,11 @@ static void test_CreateTypeLib(SYSKIND sys) {
     hres = ITypeInfo_GetTypeComp(ti, &tcomp);
     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);
     ok(hres == S_OK, "got %08x\n", hres);
     ok(desckind == DESCKIND_FUNCDESC, "got wrong desckind: 0x%x\n", desckind);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 6f87279..b0ee5f2 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -5583,9 +5583,11 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
     else if(IsEqualIID(riid, &IID_ICreateTypeInfo) ||
              IsEqualIID(riid, &IID_ICreateTypeInfo2))
         *ppvObject = &This->ICreateTypeInfo2_iface;
+    else if(IsEqualIID(riid, &IID_ITypeComp))
+        *ppvObject = &This->ITypeComp_iface;
 
     if(*ppvObject){
-        ITypeInfo2_AddRef(iface);
+        IUnknown_AddRef((IUnknown*)*ppvObject);
         TRACE("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject);
         return S_OK;
     }




More information about the wine-cvs mailing list