dispex: Use the upper WORD of the flags parameter to indicate whether the optional [out] parameters are NULL.

This commit is contained in:
Huw Davies 2010-03-19 14:17:45 +00:00 committed by Alexandre Julliard
parent 594de90ccd
commit afb1a08b5f
2 changed files with 20 additions and 15 deletions

View File

@ -244,9 +244,7 @@ static HRESULT WINAPI dispex_InvokeEx(IDispatchEx* iface,
if(id == 1) if(id == 1)
{ {
ok(pdp->cArgs == 0, "got %d\n", pdp->cArgs); ok(pdp->cArgs == 0, "got %d\n", pdp->cArgs);
todo_wine
ok(pei == NULL, "got non-NULL excepinfo\n"); ok(pei == NULL, "got non-NULL excepinfo\n");
todo_wine
ok(pvarRes == NULL, "got non-NULL result\n"); ok(pvarRes == NULL, "got non-NULL result\n");
} }
else if(id == 2) else if(id == 2)
@ -266,7 +264,6 @@ todo_wine
} }
else if(id == 4) else if(id == 4)
{ {
todo_wine
ok(wFlags == 0xf, "got %04x\n", wFlags); ok(wFlags == 0xf, "got %04x\n", wFlags);
} }
return S_OK; return S_OK;

View File

@ -37,6 +37,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define NULL_RESULT 0x20000
#define NULL_EXCEPINFO 0x40000
HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID lcid, WORD wFlags, HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID lcid, WORD wFlags,
DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei,
IServiceProvider *pspCaller) IServiceProvider *pspCaller)
@ -47,12 +50,22 @@ HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID l
UINT byref_args, arg; UINT byref_args, arg;
VARIANT dummy_arg, *ref_arg = &dummy_arg, *copy_arg, *orig_arg = NULL; VARIANT dummy_arg, *ref_arg = &dummy_arg, *copy_arg, *orig_arg = NULL;
UINT *ref_idx = NULL; UINT *ref_idx = NULL;
DWORD dword_flags = wFlags & 0xf;
TRACE("(%p)->(%08x, %04x, %04x, %p, %p, %p, %p)\n", This, id, lcid, wFlags, TRACE("(%p)->(%08x, %04x, %04x, %p, %p, %p, %p)\n", This, id, lcid, wFlags,
pdp, pvarRes, pei, pspCaller); pdp, pvarRes, pei, pspCaller);
if(!pvarRes) pvarRes = &result; if(!pvarRes)
if(!pei) pei = &excep_info; {
pvarRes = &result;
dword_flags |= NULL_RESULT;
}
if(!pei)
{
pei = &excep_info;
dword_flags |= NULL_EXCEPINFO;
}
for(arg = 0, byref_args = 0; arg < pdp->cArgs; arg++) for(arg = 0, byref_args = 0; arg < pdp->cArgs; arg++)
if(V_ISBYREF(pdp->rgvarg + arg)) byref_args++; if(V_ISBYREF(pdp->rgvarg + arg)) byref_args++;
@ -86,7 +99,7 @@ HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID l
pdp->rgvarg = copy_arg; pdp->rgvarg = copy_arg;
} }
hr = IDispatchEx_RemoteInvokeEx_Proxy(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller, hr = IDispatchEx_RemoteInvokeEx_Proxy(This, id, lcid, dword_flags, pdp, pvarRes, pei, pspCaller,
byref_args, ref_idx, ref_arg); byref_args, ref_idx, ref_arg);
if(byref_args) if(byref_args)
@ -95,14 +108,6 @@ HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID l
pdp->rgvarg = orig_arg; pdp->rgvarg = orig_arg;
} }
if(pvarRes == &result) VariantClear(pvarRes);
if(pei == &excep_info)
{
SysFreeString(pei->bstrSource);
SysFreeString(pei->bstrDescription);
SysFreeString(pei->bstrHelpFile);
}
return hr; return hr;
} }
@ -123,7 +128,10 @@ HRESULT __RPC_STUB IDispatchEx_InvokeEx_Stub(IDispatchEx* This, DISPID id, LCID
for(arg = 0; arg < byref_args; arg++) for(arg = 0; arg < byref_args; arg++)
pdp->rgvarg[ref_idx[arg]] = ref_arg[arg]; pdp->rgvarg[ref_idx[arg]] = ref_arg[arg];
hr = IDispatchEx_InvokeEx(This, id, lcid, dwFlags, pdp, result, pei, pspCaller); if(dwFlags & NULL_RESULT) result = NULL;
if(dwFlags & NULL_EXCEPINFO) pei = NULL;
hr = IDispatchEx_InvokeEx(This, id, lcid, dwFlags & 0xffff, pdp, result, pei, pspCaller);
for(arg = 0; arg < byref_args; arg++) for(arg = 0; arg < byref_args; arg++)
VariantInit(pdp->rgvarg + ref_idx[arg]); VariantInit(pdp->rgvarg + ref_idx[arg]);