Robert Shearman : oleaut32:
Fix the error code returned by ITypeComp on an interface when the name
matches , but the flags don't.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 7 07:56:02 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: dd677948b4728fc2be461a665b688828235b3bc0
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=dd677948b4728fc2be461a665b688828235b3bc0
Author: Robert Shearman <rob at codeweavers.com>
Date: Thu Jul 6 12:54:48 2006 +0100
oleaut32: Fix the error code returned by ITypeComp on an interface when the name matches, but the flags don't.
---
dlls/oleaut32/tests/typelib.c | 34 ++++++++++++++++++++++++++++++++++
dlls/oleaut32/typelib.c | 14 +++++++++-----
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index b8e615b..8aa7b0f 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -28,6 +28,7 @@ #include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "oleauto.h"
+#include "ocidl.h"
#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08lx\n", hr)
@@ -71,6 +72,7 @@ static void test_TypeComp(void)
DESCKIND desckind;
BINDPTR bindptr;
ITypeInfo *pTypeInfo;
+ ITypeInfo *pFontTypeInfo;
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};
@@ -80,6 +82,7 @@ static void test_TypeComp(void)
static WCHAR wszGUID[] = {'G','U','I','D',0};
static WCHAR wszStdPicture[] = {'S','t','d','P','i','c','t','u','r','e',0};
static WCHAR wszOLE_COLOR[] = {'O','L','E','_','C','O','L','O','R',0};
+ static WCHAR wszClone[] = {'C','l','o','n','e',0};
hr = LoadTypeLib(wszStdOle2, &pTypeLib);
ok_ole_success(hr, LoadTypeLib);
@@ -213,6 +216,37 @@ static void test_TypeComp(void)
ok(!bindptr.lptcomp, "bindptr should have been set to NULL\n");
ITypeComp_Release(pTypeComp);
+
+ /* tests for ITypeComp on an interface */
+ hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IFont, &pFontTypeInfo);
+ ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid);
+
+ hr = ITypeInfo_GetTypeComp(pFontTypeInfo, &pTypeComp);
+ ok_ole_success(hr, ITypeLib_GetTypeComp);
+
+ ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszClone);
+ hr = ITypeComp_Bind(pTypeComp, wszClone, ulHash, 0, &pTypeInfo, &desckind, &bindptr);
+ ok_ole_success(hr, ITypeComp_Bind);
+
+ ok(desckind == DESCKIND_FUNCDESC,
+ "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
+ desckind);
+ ok(bindptr.lpfuncdesc != NULL, "bindptr.lpfuncdesc should not have been set to NULL\n");
+ ITypeInfo_ReleaseFuncDesc(pTypeInfo, bindptr.lpfuncdesc);
+ ITypeInfo_Release(pTypeInfo);
+
+ ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszClone);
+ hr = ITypeComp_Bind(pTypeComp, wszClone, ulHash, INVOKE_PROPERTYGET, &pTypeInfo, &desckind, &bindptr);
+ ok(hr == TYPE_E_TYPEMISMATCH, "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08lx\n", hr);
+
+ ok(desckind == DESCKIND_NONE,
+ "desckind should have been DESCKIND_NONE instead of %d\n",
+ desckind);
+ ok(!pTypeInfo, "pTypeInfo should have been set to NULL\n");
+ ok(!bindptr.lptcomp, "bindptr should have been set to NULL\n");
+
+ ITypeComp_Release(pTypeComp);
+ ITypeInfo_Release(pFontTypeInfo);
ITypeLib_Release(pTypeLib);
}
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 8483aa9..dedea02 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -6535,6 +6535,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
const TLBFuncDesc *pFDesc;
const TLBVarDesc *pVDesc;
+ HRESULT hr = DISP_E_MEMBERNOTFOUND;
TRACE("(%s, %lx, 0x%x, %p, %p, %p)\n", debugstr_w(szName), lHash, wFlags, ppTInfo, pDescKind, pBindPtr);
@@ -6543,10 +6544,13 @@ static HRESULT WINAPI ITypeComp_fnBind(
*ppTInfo = NULL;
for(pFDesc = This->funclist; pFDesc; pFDesc = pFDesc->next)
- if (!wFlags || (pFDesc->funcdesc.invkind & wFlags))
- if (!strcmpW(pFDesc->Name, szName)) {
+ if (!strcmpW(pFDesc->Name, szName)) {
+ if (!wFlags || (pFDesc->funcdesc.invkind & wFlags))
break;
- }
+ else
+ /* name found, but wrong flags */
+ hr = TYPE_E_TYPEMISMATCH;
+ }
if (pFDesc)
{
@@ -6574,7 +6578,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
}
}
/* FIXME: search each inherited interface, not just the first */
- if (This->TypeAttr.cImplTypes) {
+ if (hr == DISP_E_MEMBERNOTFOUND && This->TypeAttr.cImplTypes) {
/* recursive search */
ITypeInfo *pTInfo;
ITypeComp *pTComp;
@@ -6594,7 +6598,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
WARN("Could not search inherited interface!\n");
}
WARN("did not find member with name %s, flags 0x%x!\n", debugstr_w(szName), wFlags);
- return DISP_E_MEMBERNOTFOUND;
+ return hr;
}
static HRESULT WINAPI ITypeComp_fnBindType(
More information about the wine-cvs
mailing list