Commit 623abfca authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Fix null parameters handling in ICreateTypeLib2::CreateTypeInfo().

parent c71998d7
...@@ -1406,6 +1406,16 @@ static void test_CreateTypeLib(void) { ...@@ -1406,6 +1406,16 @@ static void test_CreateTypeLib(void) {
SysFreeString(name); SysFreeString(name);
SysFreeString(helpfile); SysFreeString(helpfile);
/* invalid parameters */
hres = ICreateTypeLib_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, &createti);
ok(hres == E_INVALIDARG, "got %08x\n", hres);
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, NULL);
ok(hres == E_INVALIDARG, "got %08x\n", hres);
hres = ICreateTypeLib_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, NULL);
ok(hres == E_INVALIDARG, "got %08x\n", hres);
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti); hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
......
...@@ -4389,20 +4389,21 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo( ...@@ -4389,20 +4389,21 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(
ICreateTypeLib2 * iface, ICreateTypeLib2 * iface,
LPOLESTR szName, LPOLESTR szName,
TYPEKIND tkind, TYPEKIND tkind,
ICreateTypeInfo **ppCTInfo) ICreateTypeInfo **tinfo)
{ {
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface; ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
char *name; char *name;
TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, ppCTInfo); TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, tinfo);
if (!szName || !tinfo) return E_INVALIDARG;
ctl2_encode_name(This, szName, &name); ctl2_encode_name(This, szName, &name);
if(ctl2_find_name(This, name) != -1) if(ctl2_find_name(This, name) != -1)
return TYPE_E_NAMECONFLICT; return TYPE_E_NAMECONFLICT;
*ppCTInfo = (ICreateTypeInfo *)ICreateTypeInfo2_Constructor(This, szName, tkind); *tinfo = (ICreateTypeInfo *)ICreateTypeInfo2_Constructor(This, szName, tkind);
if (!*tinfo) return E_OUTOFMEMORY;
if (!*ppCTInfo) return E_OUTOFMEMORY;
return S_OK; return S_OK;
} }
......
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