oleaut32: Fix GetLibAttr for null argument, plus error handling.

This commit is contained in:
Nikolay Sivov 2010-12-22 04:10:37 +03:00 committed by Alexandre Julliard
parent c395ae563e
commit 6408679e44
2 changed files with 16 additions and 4 deletions

View File

@ -518,6 +518,9 @@ static void test_TypeInfo(void)
hr = ITypeLib_GetTypeInfo(pTypeLib, 0, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITypeLib_GetLibAttr(pTypeLib, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITypeLib_GetTypeInfoType(pTypeLib, count, &kind);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "got 0x%08x\n", hr);
@ -1362,6 +1365,9 @@ static void test_CreateTypeLib(void) {
hres = ITypeLib_GetTypeInfoType(tl, 0, NULL);
ok(hres == E_INVALIDARG, "got 0x%08x\n", hres);
hres = ITypeLib_GetLibAttr(tl, NULL);
ok(hres == E_INVALIDARG, "got %08x\n", hres);
hres = ITypeLib_GetLibAttr(tl, &libattr);
ok(hres == S_OK, "got %08x\n", hres);

View File

@ -4351,12 +4351,18 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid(
*/
static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLib2 *iface,
LPTLIBATTR *ppTLibAttr)
LPTLIBATTR *attr)
{
ITypeLibImpl *This = (ITypeLibImpl *)iface;
TRACE("(%p)\n",This);
*ppTLibAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTLibAttr));
**ppTLibAttr = This->LibAttr;
TRACE("(%p, %p)\n", This, attr);
if (!attr) return E_INVALIDARG;
*attr = HeapAlloc(GetProcessHeap(), 0, sizeof(**attr));
if (!*attr) return E_OUTOFMEMORY;
**attr = This->LibAttr;
return S_OK;
}