oleaut32: Handle NULL arguments to ITypeComp::BindType.

This commit is contained in:
David Hedberg 2011-01-11 10:10:00 +01:00 committed by Alexandre Julliard
parent 8c0a69430c
commit 454b1fca24
2 changed files with 39 additions and 0 deletions

View File

@ -109,6 +109,7 @@ static void test_TypeComp(void)
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};
@ -255,6 +256,41 @@ static void test_TypeComp(void)
ok(!pTypeInfo, "pTypeInfo should have been set to NULL\n");
ok(!bindptr.lptcomp, "bindptr should have been set to NULL\n");
/* test basic BindType argument handling */
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszGUID);
hr = ITypeComp_BindType(pTypeComp, wszGUID, ulHash, NULL, NULL);
ok(hr == E_INVALIDARG, "Got %08x\n", hr);
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszGUID);
pTypeInfo = (void*)0xdeadbeef;
hr = ITypeComp_BindType(pTypeComp, wszGUID, ulHash, &pTypeInfo, NULL);
ok(hr == E_INVALIDARG, "Got %08x\n", hr);
ok(pTypeInfo == (void*)0xdeadbeef, "Got %p\n", pTypeInfo);
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszGUID);
pTypeComp_tmp = (void*)0xdeadbeef;
hr = ITypeComp_BindType(pTypeComp, wszGUID, ulHash, NULL, &pTypeComp_tmp);
ok(hr == E_INVALIDARG, "Got %08x\n", hr);
ok(pTypeComp_tmp == (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp);
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszGUID);
pTypeComp_tmp = (void*)0xdeadbeef;
pTypeInfo = (void*)0xdeadbeef;
hr = ITypeComp_BindType(pTypeComp, NULL, ulHash, &pTypeInfo, &pTypeComp_tmp);
ok(hr == E_INVALIDARG, "Got %08x\n", hr);
ok(pTypeInfo == (void*)0xdeadbeef, "Got %p\n", pTypeInfo);
ok(pTypeComp_tmp == (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp);
ulHash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, wszGUID);
pTypeComp_tmp = (void*)0xdeadbeef;
pTypeInfo = (void*)0xdeadbeef;
hr = ITypeComp_BindType(pTypeComp, wszGUID, ulHash, &pTypeInfo, &pTypeComp_tmp);
ok_ole_success(hr, ITypeComp_BindType);
ok(pTypeInfo != NULL, "Got NULL pTypeInfo\n");
todo_wine ok(pTypeComp_tmp == NULL, "Got pTypeComp_tmp %p\n", pTypeComp_tmp);
ITypeInfo_Release(pTypeInfo);
if(pTypeComp_tmp) ITypeComp_Release(pTypeComp_tmp); /* fixme */
ITypeComp_Release(pTypeComp);
/* tests for ITypeComp on an interface */

View File

@ -4908,6 +4908,9 @@ static HRESULT WINAPI ITypeLibComp_fnBindType(
TRACE("(%s, %x, %p, %p)\n", debugstr_w(szName), lHash, ppTInfo, ppTComp);
if(!szName || !ppTInfo || !ppTComp)
return E_INVALIDARG;
for (pTypeInfo = This->pTypeInfo; pTypeInfo; pTypeInfo = pTypeInfo->next)
{
/* FIXME: should use lHash to do the search */