Huw Davies : dispex: Use the upper WORD of the flags parameter to indicate whether the optional [out] parameters are NULL.
Alexandre Julliard
julliard at winehq.org
Mon Mar 22 11:12:04 CDT 2010
Module: wine
Branch: master
Commit: afb1a08b5f501dc555d254146a5b06b06dade051
URL: http://source.winehq.org/git/wine.git/?a=commit;h=afb1a08b5f501dc555d254146a5b06b06dade051
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Mar 19 14:17:45 2010 +0000
dispex: Use the upper WORD of the flags parameter to indicate whether the optional [out] parameters are NULL.
---
dlls/dispex/tests/marshal.c | 3 ---
dlls/dispex/usrmarshal.c | 32 ++++++++++++++++++++------------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/dlls/dispex/tests/marshal.c b/dlls/dispex/tests/marshal.c
index e0b7127..847f54e 100644
--- a/dlls/dispex/tests/marshal.c
+++ b/dlls/dispex/tests/marshal.c
@@ -244,9 +244,7 @@ static HRESULT WINAPI dispex_InvokeEx(IDispatchEx* iface,
if(id == 1)
{
ok(pdp->cArgs == 0, "got %d\n", pdp->cArgs);
-todo_wine
ok(pei == NULL, "got non-NULL excepinfo\n");
-todo_wine
ok(pvarRes == NULL, "got non-NULL result\n");
}
else if(id == 2)
@@ -266,7 +264,6 @@ todo_wine
}
else if(id == 4)
{
-todo_wine
ok(wFlags == 0xf, "got %04x\n", wFlags);
}
return S_OK;
diff --git a/dlls/dispex/usrmarshal.c b/dlls/dispex/usrmarshal.c
index cdb1b03..c8c3563 100644
--- a/dlls/dispex/usrmarshal.c
+++ b/dlls/dispex/usrmarshal.c
@@ -37,6 +37,9 @@
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,
DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei,
IServiceProvider *pspCaller)
@@ -47,12 +50,22 @@ HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID l
UINT byref_args, arg;
VARIANT dummy_arg, *ref_arg = &dummy_arg, *copy_arg, *orig_arg = NULL;
UINT *ref_idx = NULL;
+ DWORD dword_flags = wFlags & 0xf;
TRACE("(%p)->(%08x, %04x, %04x, %p, %p, %p, %p)\n", This, id, lcid, wFlags,
pdp, pvarRes, pei, pspCaller);
- if(!pvarRes) pvarRes = &result;
- if(!pei) pei = &excep_info;
+ if(!pvarRes)
+ {
+ 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++)
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;
}
- 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);
if(byref_args)
@@ -95,14 +108,6 @@ HRESULT CALLBACK IDispatchEx_InvokeEx_Proxy(IDispatchEx* This, DISPID id, LCID l
pdp->rgvarg = orig_arg;
}
- if(pvarRes == &result) VariantClear(pvarRes);
- if(pei == &excep_info)
- {
- SysFreeString(pei->bstrSource);
- SysFreeString(pei->bstrDescription);
- SysFreeString(pei->bstrHelpFile);
- }
-
return hr;
}
@@ -123,7 +128,10 @@ HRESULT __RPC_STUB IDispatchEx_InvokeEx_Stub(IDispatchEx* This, DISPID id, LCID
for(arg = 0; arg < byref_args; 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++)
VariantInit(pdp->rgvarg + ref_idx[arg]);
More information about the wine-cvs
mailing list