mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:50:52 +00:00
oleaut32: Fix automatic value getting in ITypeInfo::Invoke.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
baba9a8e48
commit
61c18632b8
3 changed files with 125 additions and 4 deletions
|
@ -130,6 +130,15 @@ library register_test
|
|||
interface Iole_from_disp;
|
||||
}
|
||||
|
||||
[
|
||||
uuid(fed318b2-c2ed-11e7-abc4-cec278b6b50a)
|
||||
]
|
||||
interface ICollection : IDispatch
|
||||
{
|
||||
[id(DISPID_VALUE)]
|
||||
HRESULT Item([in] int i, [out, retval] int *p);
|
||||
}
|
||||
|
||||
[
|
||||
uuid(f1b68c3b-02a3-4110-bc4c-cf9bc7e7f177)
|
||||
]
|
||||
|
@ -143,6 +152,8 @@ library register_test
|
|||
LONG testprop2([in] IUnknown *i);
|
||||
[id(3)]
|
||||
HRESULT testfunc([in] int i, [out, retval] int *p);
|
||||
[propget, id(4)]
|
||||
HRESULT testget([out, retval] ICollection **p);
|
||||
}
|
||||
|
||||
/* uuid is same as for test_struct2 in test_tlb.idl, fields are different */
|
||||
|
|
|
@ -98,6 +98,91 @@ static const BOOL abi_supports_stdcall = TRUE;
|
|||
static const BOOL abi_supports_stdcall = FALSE;
|
||||
#endif
|
||||
|
||||
static HRESULT WINAPI collection_QueryInterface(ICollection *iface, REFIID riid, void **ret)
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDispatch) ||
|
||||
IsEqualIID(riid, &IID_ICollection))
|
||||
{
|
||||
*ret = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI collection_AddRef(ICollection *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI collection_Release(ICollection *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI collection_GetTypeInfoCount(ICollection *iface, UINT *cnt)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
*cnt = 0;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI collection_GetTypeInfo(ICollection *iface, UINT index, LCID lcid, ITypeInfo **ti)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI collection_GetIDsOfNames(ICollection *iface, REFIID riid, LPOLESTR *names,
|
||||
UINT cnt, LCID lcid, DISPID *dispid)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI collection_Invoke(ICollection *iface, DISPID dispid, REFIID riid,
|
||||
LCID lcid, WORD flags, DISPPARAMS *dispparams, VARIANT *res, EXCEPINFO *ei, UINT *argerr)
|
||||
{
|
||||
if(dispid != DISPID_VALUE) {
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
ok(flags == (DISPATCH_METHOD|DISPATCH_PROPERTYGET), "flags = %x\n", flags);
|
||||
ok(dispparams != NULL, "dispparams == NULL\n");
|
||||
ok(!dispparams->rgdispidNamedArgs, "dispparams->rgdispidNamedArgs != NULL\n");
|
||||
ok(dispparams->cArgs == 1, "dispparams->cArgs = %d\n", dispparams->cArgs);
|
||||
ok(!dispparams->cNamedArgs, "dispparams->cNamedArgs = %d\n", dispparams->cNamedArgs);
|
||||
ok(V_VT(dispparams->rgvarg) == VT_I4, "V_VT(dispparams->rgvarg) = %d\n", V_VT(dispparams->rgvarg));
|
||||
ok(V_I4(dispparams->rgvarg) == 7, "V_I4(dispparams->rgvarg) = %d\n", V_I4(dispparams->rgvarg));
|
||||
ok(res != NULL, "res == NULL\n");
|
||||
ok(V_VT(res) == VT_EMPTY, "V_VT(res) = %d\n", V_VT(res));
|
||||
|
||||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = 15;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI collection_Item(ICollection *iface, int i, int *p)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ICollectionVtbl collectionvtbl = {
|
||||
collection_QueryInterface,
|
||||
collection_AddRef,
|
||||
collection_Release,
|
||||
collection_GetTypeInfoCount,
|
||||
collection_GetTypeInfo,
|
||||
collection_GetIDsOfNames,
|
||||
collection_Invoke,
|
||||
collection_Item
|
||||
};
|
||||
|
||||
static ICollection collection = { &collectionvtbl };
|
||||
|
||||
static HRESULT WINAPI invoketest_QueryInterface(IInvokeTest *iface, REFIID riid, void **ret)
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
|
@ -169,6 +254,13 @@ static HRESULT WINAPI invoketest_testfunc(IInvokeTest *iface, int i, int *p)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI invoketest_testget(IInvokeTest *iface, ICollection **p)
|
||||
{
|
||||
*p = &collection;
|
||||
ICollection_AddRef(&collection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IInvokeTestVtbl invoketestvtbl = {
|
||||
invoketest_QueryInterface,
|
||||
invoketest_AddRef,
|
||||
|
@ -180,7 +272,8 @@ static const IInvokeTestVtbl invoketestvtbl = {
|
|||
invoketest_get_test,
|
||||
invoketest_putref_testprop,
|
||||
invoketest_putref_testprop2,
|
||||
invoketest_testfunc
|
||||
invoketest_testfunc,
|
||||
invoketest_testget
|
||||
};
|
||||
|
||||
static IInvokeTest invoketest = { &invoketestvtbl };
|
||||
|
@ -968,6 +1061,22 @@ static void test_TypeInfo(void)
|
|||
ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res));
|
||||
ok(V_I4(&res) == 1, "got %d\n", V_I4(&res));
|
||||
|
||||
/* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
|
||||
V_VT(&args[0]) = VT_I4;
|
||||
V_I4(&args[0]) = 7;
|
||||
|
||||
dispparams.cArgs = 1;
|
||||
dispparams.rgvarg = args;
|
||||
|
||||
i = 0;
|
||||
V_VT(&res) = VT_EMPTY;
|
||||
V_I4(&res) = 0;
|
||||
hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 4, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, &res, NULL, &i);
|
||||
ok(hr == S_OK, "got 0x%08x, %d\n", hr, i);
|
||||
ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res));
|
||||
ok(V_I4(&res) == 15, "got %d\n", V_I4(&res));
|
||||
|
||||
|
||||
/* DISPATCH_PROPERTYPUTREF */
|
||||
l = 1;
|
||||
V_VT(&args[0]) = VT_I4|VT_BYREF;
|
||||
|
@ -4837,7 +4946,7 @@ static void test_register_typelib(BOOL system_registration)
|
|||
{
|
||||
TYPEKIND kind;
|
||||
WORD flags;
|
||||
} attrs[13] =
|
||||
} attrs[] =
|
||||
{
|
||||
{ TKIND_INTERFACE, 0 },
|
||||
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
|
||||
|
@ -4851,6 +4960,7 @@ static void test_register_typelib(BOOL system_registration)
|
|||
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
|
||||
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
|
||||
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
|
||||
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
|
||||
{ TKIND_RECORD, 0 }
|
||||
};
|
||||
|
||||
|
@ -4886,7 +4996,7 @@ static void test_register_typelib(BOOL system_registration)
|
|||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
count = ITypeLib_GetTypeInfoCount(typelib);
|
||||
ok(count == 13, "got %d\n", count);
|
||||
ok(count == 14, "got %d\n", count);
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
|
|
|
@ -7496,7 +7496,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
|||
* pointer to be valid */
|
||||
VariantInit(pVarResult);
|
||||
hres = IDispatch_Invoke(pDispatch, DISPID_VALUE, &IID_NULL,
|
||||
GetSystemDefaultLCID(), INVOKE_PROPERTYGET,
|
||||
GetSystemDefaultLCID(), wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, pArgErr);
|
||||
IDispatch_Release(pDispatch);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue