[PATCH v3 0/2] MR11492: oleaut32/tests: Add a test for Invoke() with typeinfo from CreateDispTypeInfo().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> -- v3: oleaut32/typelib: Make it possible to Invoke() through COCLASS type. oleaut32/tests: Add a test for Invoke() with typeinfo from CreateDispTypeInfo(). https://gitlab.winehq.org/wine/wine/-/merge_requests/11492
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/oleaut32/tests/typelib.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 87a5f48d060..40c8b02746f 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -671,12 +671,15 @@ static void test_CreateDispTypeInfo(void) HRESULT hr; INTERFACEDATA ifdata; METHODDATA methdata[4]; + VARIANT args[1], res; PARAMDATA parms1[2]; PARAMDATA parms3[1]; TYPEATTR *pTypeAttr; HREFTYPE href; FUNCDESC *pFuncDesc; + UINT argerr = 0; MEMBERID memid; + DISPPARAMS dp; static WCHAR func1[] = {'f','u','n','c','1',0}; static const WCHAR func2[] = {'f','u','n','c','2',0}; @@ -813,6 +816,10 @@ static void test_CreateDispTypeInfo(void) ok(hr == S_OK, "hr 0x%08lx\n", hr); ok(memid == 0x123, "memid 0x%08lx\n", memid); + hr = ITypeInfo_GetIDsOfNames(pTypeInfo, &methdata[1].szName, 1, &memid); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(memid == 0x124, "Unexpected id %#lx.\n", memid); + ITypeInfo_Release(pTI2); ITypeInfo_Release(pTypeInfo); @@ -823,6 +830,49 @@ static void test_CreateDispTypeInfo(void) SysFreeString(methdata[1].szName); SysFreeString(methdata[2].szName); SysFreeString(methdata[3].szName); + + /* Invoke test */ + memset(methdata, 0, sizeof(methdata)); + methdata[0].szName = SysAllocString(L"get_test"); + methdata[0].dispid = DISPID_VALUE; + methdata[0].iMeth = 7; + methdata[0].cc = CC_STDCALL; + methdata[0].wFlags = DISPATCH_PROPERTYGET; + methdata[0].vtReturn = VT_I4; + methdata[0].ppdata = parms1; + methdata[0].cArgs = 1; + memset(parms1, 0, sizeof(parms1)); + parms1[0].szName = SysAllocString(L"param"); + parms1[0].vt = VT_I4; + + ifdata.pmethdata = methdata; + ifdata.cMembers = 1; + + hr = CreateDispTypeInfo(&ifdata, LOCALE_NEUTRAL, &pTypeInfo); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = ITypeInfo_GetIDsOfNames(pTypeInfo, &methdata[0].szName, 1, &memid); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(memid == DISPID_VALUE, "Unexpected id %#lx.\n", memid); + + memset(&dp, 0, sizeof(dp)); + dp.cArgs = 1; + dp.rgvarg = args; + + V_VT(&args[0]) = VT_I4; + V_I4(&args[0]) = 0; + + memset(&res, 0, sizeof(res)); + hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, DISPID_VALUE, DISPATCH_PROPERTYGET, &dp, &res, NULL, &argerr); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); +if (hr == S_OK) +{ + ok(V_VT(&res) == VT_I4, "Unexpected return type %d.\n", V_VT(&res)); + ok(V_I4(&res) == 1, "Unexpected value %ld.\n", V_I4(&res)); +} + SysFreeString(methdata[0].szName); + ITypeInfo_Release(pTypeInfo); } static void write_typelib(int res_no, const WCHAR *filename) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11492
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/oleaut32/tests/typelib.c | 5 +---- dlls/oleaut32/typelib.c | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 40c8b02746f..9e848bf4d94 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -864,13 +864,10 @@ static void test_CreateDispTypeInfo(void) memset(&res, 0, sizeof(res)); hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, DISPID_VALUE, DISPATCH_PROPERTYGET, &dp, &res, NULL, &argerr); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); -if (hr == S_OK) -{ ok(V_VT(&res) == VT_I4, "Unexpected return type %d.\n", V_VT(&res)); ok(V_I4(&res) == 1, "Unexpected value %ld.\n", V_I4(&res)); -} + SysFreeString(methdata[0].szName); ITypeInfo_Release(pTypeInfo); } diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 9350dd415a1..52a1ce4723a 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -7686,7 +7686,10 @@ func_fail: /* not found, look for it in inherited interfaces */ ITypeInfo2_GetTypeKind(iface, &type_kind); - if(type_kind == TKIND_INTERFACE || type_kind == TKIND_DISPATCH) { + if (type_kind == TKIND_INTERFACE + || type_kind == TKIND_DISPATCH + || type_kind == TKIND_COCLASS) + { if(This->impltypes) { /* recursive search */ ITypeInfo *pTInfo; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11492
v3: fixed wrong dispparams, causing invoke failures. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11492#note_146957
Remaining test failures look unrelated. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11492#note_146963
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11492
participants (3)
-
Huw Davies (@huw) -
Nikolay Sivov -
Nikolay Sivov (@nsivov)