[PATCH 6/9] oleaut32: Fix the missing argument handling for non-byref variant arguments.

Robert Shearman rob at codeweavers.com
Tue Feb 6 13:24:12 CST 2007


---
  dlls/oleaut32/typelib.c |   19 ++++++++++++++-----
  1 files changed, 14 insertions(+), 5 deletions(-)
-------------- next part --------------
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index a21aeec..3a0afbc 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -5562,11 +5562,20 @@ static HRESULT WINAPI ITypeInfo_fnInvoke
                     }
                     else
                     {
-                        VARIANTARG *missing_arg = INVBUF_GET_MISSING_ARG_ARRAY(buffer, func_desc->cParams);
-                        V_VT(arg) = VT_VARIANT | VT_BYREF;
-                        V_VARIANTREF(arg) = &missing_arg[i];
-                        V_VT(V_VARIANTREF(arg)) = VT_ERROR;
-                        V_ERROR(V_VARIANTREF(arg)) = DISP_E_PARAMNOTFOUND;
+                        VARIANTARG *missing_arg;
+                        /* if the function wants a pointer to a variant then
+                         * set that up, otherwise just pass the VT_ERROR in
+                         * the argument by value */
+                        if (rgvt[i] & VT_BYREF)
+                        {
+                            missing_arg = INVBUF_GET_MISSING_ARG_ARRAY(buffer, func_desc->cParams) + i;
+                            V_VT(arg) = VT_VARIANT | VT_BYREF;
+                            V_VARIANTREF(arg) = missing_arg;
+                        }
+                        else
+                            missing_arg = arg;
+                        V_VT(missing_arg) = VT_ERROR;
+                        V_ERROR(missing_arg) = DISP_E_PARAMNOTFOUND;
                     }
                 }
                 else


More information about the wine-patches mailing list