Commit dd677948 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

oleaut32: Fix the error code returned by ITypeComp on an interface when the name…

oleaut32: Fix the error code returned by ITypeComp on an interface when the name matches, but the flags don't.
parent 409c6dc7
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "oleauto.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) #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) ...@@ -71,6 +72,7 @@ static void test_TypeComp(void)
DESCKIND desckind; DESCKIND desckind;
BINDPTR bindptr; BINDPTR bindptr;
ITypeInfo *pTypeInfo; ITypeInfo *pTypeInfo;
ITypeInfo *pFontTypeInfo;
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};
...@@ -80,6 +82,7 @@ static void test_TypeComp(void) ...@@ -80,6 +82,7 @@ static void test_TypeComp(void)
static WCHAR wszGUID[] = {'G','U','I','D',0}; static WCHAR wszGUID[] = {'G','U','I','D',0};
static WCHAR wszStdPicture[] = {'S','t','d','P','i','c','t','u','r','e',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 wszOLE_COLOR[] = {'O','L','E','_','C','O','L','O','R',0};
static WCHAR wszClone[] = {'C','l','o','n','e',0};
hr = LoadTypeLib(wszStdOle2, &pTypeLib); hr = LoadTypeLib(wszStdOle2, &pTypeLib);
ok_ole_success(hr, LoadTypeLib); ok_ole_success(hr, LoadTypeLib);
...@@ -213,6 +216,37 @@ static void test_TypeComp(void) ...@@ -213,6 +216,37 @@ static void test_TypeComp(void)
ok(!bindptr.lptcomp, "bindptr should have been set to NULL\n"); ok(!bindptr.lptcomp, "bindptr should have been set to NULL\n");
ITypeComp_Release(pTypeComp); 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); ITypeLib_Release(pTypeLib);
} }
......
...@@ -6535,6 +6535,7 @@ static HRESULT WINAPI ITypeComp_fnBind( ...@@ -6535,6 +6535,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
ITypeInfoImpl *This = info_impl_from_ITypeComp(iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
const TLBFuncDesc *pFDesc; const TLBFuncDesc *pFDesc;
const TLBVarDesc *pVDesc; 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); 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( ...@@ -6543,10 +6544,13 @@ static HRESULT WINAPI ITypeComp_fnBind(
*ppTInfo = NULL; *ppTInfo = NULL;
for(pFDesc = This->funclist; pFDesc; pFDesc = pFDesc->next) 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; break;
} else
/* name found, but wrong flags */
hr = TYPE_E_TYPEMISMATCH;
}
if (pFDesc) if (pFDesc)
{ {
...@@ -6574,7 +6578,7 @@ static HRESULT WINAPI ITypeComp_fnBind( ...@@ -6574,7 +6578,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
} }
} }
/* FIXME: search each inherited interface, not just the first */ /* FIXME: search each inherited interface, not just the first */
if (This->TypeAttr.cImplTypes) { if (hr == DISP_E_MEMBERNOTFOUND && This->TypeAttr.cImplTypes) {
/* recursive search */ /* recursive search */
ITypeInfo *pTInfo; ITypeInfo *pTInfo;
ITypeComp *pTComp; ITypeComp *pTComp;
...@@ -6594,7 +6598,7 @@ static HRESULT WINAPI ITypeComp_fnBind( ...@@ -6594,7 +6598,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
WARN("Could not search inherited interface!\n"); WARN("Could not search inherited interface!\n");
} }
WARN("did not find member with name %s, flags 0x%x!\n", debugstr_w(szName), wFlags); 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( static HRESULT WINAPI ITypeComp_fnBindType(
......
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