From 65ef22fd0fbacc3ff4d954baed6b6ead0de54f34 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 25 Aug 2009 15:09:50 -0500 Subject: [PATCH] oleaut32: make ITypeInfo2::GetCustData succeed when data is not found --- dlls/oleaut32/tests/typelib.c | 22 ++++++++++++++++++++++ dlls/oleaut32/typelib.c | 11 +++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 2748ed0..9834d10 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -449,6 +449,7 @@ static void test_TypeInfo(void) { ITypeLib *pTypeLib; ITypeInfo *pTypeInfo; + ITypeInfo2 *pTypeInfo2; HRESULT hr; static WCHAR wszBogus[] = { 'b','o','g','u','s',0 }; static WCHAR wszGetTypeInfo[] = { 'G','e','t','T','y','p','e','I','n','f','o',0 }; @@ -458,6 +459,8 @@ static void test_TypeInfo(void) OLECHAR* pwszClone = wszClone; DISPID dispidMember; DISPPARAMS dispparams; + GUID bogusguid = {0x806afb4f,0x13f7,0x42d2,{0x89,0x2c,0x6c,0x97,0xc3,0x6a,0x36,0xc1}}; + VARIANT var; hr = LoadTypeLib(wszStdOle2, &pTypeLib); ok_ole_success(hr, LoadTypeLib); @@ -503,6 +506,25 @@ static void test_TypeInfo(void) hr = ITypeInfo_GetIDsOfNames(pTypeInfo, &pwszGetTypeInfo, 1, &dispidMember); ok_ole_success(hr, ITypeInfo_GetIDsOfNames); + hr = ITypeInfo_QueryInterface(pTypeInfo, &IID_ITypeInfo2, (void**)&pTypeInfo2); + ok_ole_success(hr, ITypeInfo_QueryInterface); + + if (SUCCEEDED(hr)) + { + VariantInit(&var); + + V_VT(&var) = VT_I4; + + /* test unknown guid passed to GetCustData */ + hr = ITypeInfo2_GetCustData(pTypeInfo2, &bogusguid, &var); + ok_ole_success(hr, ITypeInfo_GetCustData); + ok(V_VT(&var) == VT_EMPTY, "got %i, expected VT_EMPTY\n", V_VT(&var)); + + ITypeInfo2_Release(pTypeInfo2); + + VariantClear(&var); + } + /* test invoking a method with a [restricted] keyword */ hr = ITypeInfo_Invoke(pTypeInfo, NULL, dispidMember, DISPATCH_METHOD, &dispparams, NULL, NULL, NULL); todo_wine { diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index e87095b..b86109c 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -7047,13 +7047,12 @@ static HRESULT WINAPI ITypeInfo2_fnGetCustData( TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT"); - if(pCData) - { - VariantInit( pVarVal); + VariantInit( pVarVal); + if (pCData) VariantCopy( pVarVal, &pCData->data); - return S_OK; - } - return E_INVALIDARG; /* FIXME: correct? */ + else + VariantClear( pVarVal ); + return S_OK; } /* ITypeInfo2::GetFuncCustData -- 1.5.4.3