Module: wine Branch: master Commit: 80c870251fd0341b519f8351ac736bdf1b7142fc URL: http://source.winehq.org/git/wine.git/?a=commit;h=80c870251fd0341b519f8351ac...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue Aug 25 15:09:50 2009 -0500
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