Commit 454b1fca authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

oleaut32: Handle NULL arguments to ITypeComp::BindType.

parent 8c0a6943
...@@ -109,6 +109,7 @@ static void test_TypeComp(void) ...@@ -109,6 +109,7 @@ static void test_TypeComp(void)
BINDPTR bindptr; BINDPTR bindptr;
ITypeInfo *pTypeInfo; ITypeInfo *pTypeInfo;
ITypeInfo *pFontTypeInfo; 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};
...@@ -255,6 +256,41 @@ static void test_TypeComp(void) ...@@ -255,6 +256,41 @@ static void test_TypeComp(void)
ok(!pTypeInfo, "pTypeInfo should have been set to NULL\n"); ok(!pTypeInfo, "pTypeInfo should have been set to NULL\n");
ok(!bindptr.lptcomp, "bindptr 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); ITypeComp_Release(pTypeComp);
/* tests for ITypeComp on an interface */ /* tests for ITypeComp on an interface */
......
...@@ -4908,6 +4908,9 @@ static HRESULT WINAPI ITypeLibComp_fnBindType( ...@@ -4908,6 +4908,9 @@ static HRESULT WINAPI ITypeLibComp_fnBindType(
TRACE("(%s, %x, %p, %p)\n", debugstr_w(szName), lHash, ppTInfo, ppTComp); 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) for (pTypeInfo = This->pTypeInfo; pTypeInfo; pTypeInfo = pTypeInfo->next)
{ {
/* FIXME: should use lHash to do the search */ /* FIXME: should use lHash to do the search */
......
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