oleaut32: Interfaces that derive from IDispatch should be marshaled as VT_DISPATCH.

This commit is contained in:
Huw Davies 2007-06-22 14:38:50 +01:00 committed by Alexandre Julliard
parent 102a0a3b79
commit 17fca45d41
4 changed files with 38 additions and 2 deletions

View File

@ -515,6 +515,15 @@ HRESULT WINAPI Widget_Error(
return E_NOTIMPL;
}
HRESULT WINAPI Widget_CloneInterface(
IWidget __RPC_FAR * iface,
ISomethingFromDispatch **ppVal)
{
trace("CloneInterface()\n");
*ppVal = 0;
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable =
{
Widget_QueryInterface,
@ -540,7 +549,8 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_VariantArrayPtr,
Widget_Variant,
Widget_VarArg,
Widget_Error
Widget_Error,
Widget_CloneInterface
};
@ -914,6 +924,18 @@ static void test_typelibmarshal(void)
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_CLONE, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_PROPERTYGET, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, IDispatch_Invoke);
ok(V_VT(&varresult) == VT_DISPATCH, "vt %x\n", V_VT(&varresult));
VariantClear(&varresult);
/* call CloneInterface */
dispparams.cNamedArgs = 0;
dispparams.cArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = NULL;
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_CLONEINTERFACE, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_PROPERTYGET, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, IDispatch_Invoke);
ok(V_VT(&varresult) == VT_DISPATCH, "vt %x\n", V_VT(&varresult));
VariantClear(&varresult);
/* call CloneDispatch with automatic value getting */

View File

@ -37,6 +37,15 @@ library TestTypelib
coclass ApplicationObject2;
[
odl,
uuid(12345678-1234-4321-1234-121212121212)
]
interface ISomethingFromDispatch : IDispatch
{
HRESULT anotherfn(void);
}
[
odl,
uuid(a1f8cae3-c947-4c5f-b57d-c87b9b5f3586),
@ -93,6 +102,10 @@ library TestTypelib
[id(DISPID_TM_ERROR)]
HRESULT Error();
[propget, id(DISPID_TM_CLONEINTERFACE)]
HRESULT CloneInterface([out, retval] ISomethingFromDispatch **ppVal);
}
[

View File

@ -31,5 +31,6 @@
#define DISPID_TM_VARIANT 12
#define DISPID_TM_VARARG 13
#define DISPID_TM_ERROR 14
#define DISPID_TM_CLONEINTERFACE 15
#define DISPID_NOA_BSTRRET 1

View File

@ -5307,7 +5307,7 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
break;
case TKIND_INTERFACE:
if (IsEqualIID(&IID_IDispatch, &tattr->guid))
if (tattr->wTypeFlags & TYPEFLAG_FDISPATCHABLE)
*vt |= VT_DISPATCH;
else
*vt |= VT_UNKNOWN;