mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
oleaut32: [restricted] members with negative dispids may still be called.
This commit is contained in:
parent
5c8edb0449
commit
0425a110d9
4 changed files with 52 additions and 1 deletions
|
@ -660,6 +660,20 @@ static HRESULT WINAPI Widget_put_prop_req_arg(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Widget_restrict(IWidget* iface, INT *i)
|
||||
{
|
||||
trace("restrict\n");
|
||||
*i = DISPID_TM_RESTRICTED;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Widget_neg_restrict(IWidget* iface, INT *i)
|
||||
{
|
||||
trace("neg_restrict\n");
|
||||
*i = DISPID_TM_NEG_RESTRICTED;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IWidgetVtbl Widget_VTable =
|
||||
{
|
||||
Widget_QueryInterface,
|
||||
|
@ -696,6 +710,8 @@ static const struct IWidgetVtbl Widget_VTable =
|
|||
Widget_ByRefUInt,
|
||||
Widget_put_prop_opt_arg,
|
||||
Widget_put_prop_req_arg,
|
||||
Widget_restrict,
|
||||
Widget_neg_restrict
|
||||
};
|
||||
|
||||
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
|
||||
|
@ -1511,6 +1527,28 @@ static void test_typelibmarshal(void)
|
|||
ok_ole_success(hr, ITypeInfo_Invoke);
|
||||
VariantClear(&varresult);
|
||||
|
||||
/* restricted member */
|
||||
dispparams.cNamedArgs = 0;
|
||||
dispparams.rgdispidNamedArgs = NULL;
|
||||
dispparams.cArgs = 0;
|
||||
dispparams.rgvarg = NULL;
|
||||
VariantInit(&varresult);
|
||||
hr = IDispatch_Invoke(pDispatch, DISPID_TM_RESTRICTED, &IID_NULL, 0x40c, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
|
||||
ok( hr == DISP_E_MEMBERNOTFOUND, "got %08x\n", hr );
|
||||
VariantClear(&varresult);
|
||||
|
||||
/* restricted member with -ve memid (not restricted) */
|
||||
dispparams.cNamedArgs = 0;
|
||||
dispparams.rgdispidNamedArgs = NULL;
|
||||
dispparams.cArgs = 0;
|
||||
dispparams.rgvarg = NULL;
|
||||
VariantInit(&varresult);
|
||||
hr = IDispatch_Invoke(pDispatch, DISPID_TM_NEG_RESTRICTED, &IID_NULL, 0x40c, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok(V_VT(&varresult) == VT_I4, "got %x\n", V_VT(&varresult));
|
||||
ok(V_I4(&varresult) == DISPID_TM_NEG_RESTRICTED, "got %x\n", V_I4(&varresult));
|
||||
VariantClear(&varresult);
|
||||
|
||||
IDispatch_Release(pDispatch);
|
||||
IWidget_Release(pWidget);
|
||||
|
||||
|
|
|
@ -149,6 +149,12 @@ library TestTypelib
|
|||
|
||||
[id(DISPID_TM_PROP_REQ_ARG), propput]
|
||||
HRESULT prop_req_arg([in] INT req, [in] INT i);
|
||||
|
||||
[id(DISPID_TM_RESTRICTED), restricted]
|
||||
HRESULT restrict([out, retval] INT *i);
|
||||
|
||||
[id(DISPID_TM_NEG_RESTRICTED), restricted]
|
||||
HRESULT neg_restrict([out, retval] INT *i);
|
||||
}
|
||||
|
||||
[
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#define DISPID_TM_PROP_OPT_ARG 22
|
||||
#define DISPID_TM_PROP_REQ_ARG 23
|
||||
#define DISPID_TM_VARCARRAY 24
|
||||
#define DISPID_TM_RESTRICTED 25
|
||||
#define DISPID_TM_NEG_RESTRICTED -26
|
||||
|
||||
#define DISPID_NOA_BSTRRET 1
|
||||
#define DISPID_NOA_ERROR 2
|
||||
|
|
|
@ -6241,6 +6241,11 @@ DispCallFunc(
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline BOOL func_restricted( const FUNCDESC *desc )
|
||||
{
|
||||
return (desc->wFuncFlags & FUNCFLAG_FRESTRICTED) && (desc->memid >= 0);
|
||||
}
|
||||
|
||||
#define INVBUF_ELEMENT_SIZE \
|
||||
(sizeof(VARIANTARG) + sizeof(VARIANTARG) + sizeof(VARIANTARG *) + sizeof(VARTYPE))
|
||||
#define INVBUF_GET_ARG_ARRAY(buffer, params) (buffer)
|
||||
|
@ -6297,7 +6302,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
|||
pFuncInfo = &This->funcdescs[fdc];
|
||||
if ((memid == pFuncInfo->funcdesc.memid) &&
|
||||
(wFlags & pFuncInfo->funcdesc.invkind) &&
|
||||
(pFuncInfo->funcdesc.wFuncFlags & FUNCFLAG_FRESTRICTED) == 0)
|
||||
!func_restricted( &pFuncInfo->funcdesc ))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue