Alex Villacís Lasso : oleaut32: Support for VT_DISPATCH in VarAbs.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 5 05:48:23 CDT 2007


Module: wine
Branch: master
Commit: 932fcac150e67968909aa9eaad4966d7d10db299
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=932fcac150e67968909aa9eaad4966d7d10db299

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Mon Jun  4 12:58:51 2007 -0500

oleaut32: Support for VT_DISPATCH in VarAbs.

---

 dlls/oleaut32/variant.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 5113363..03b4c31 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -4273,15 +4273,28 @@ HRESULT WINAPI VarAbs(LPVARIANT pVarIn, LPVARIANT pVarOut)
 {
     VARIANT varIn;
     HRESULT hRet = S_OK;
+    VARIANT temp;
+
+    VariantInit(&temp);
 
     TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn),
           debugstr_VF(pVarIn), pVarOut);
 
+    /* Handle VT_DISPATCH by storing and taking address of returned value */
+    if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0))
+    {
+        hRet = VARIANT_FetchDispatchValue(pVarIn, &temp);
+        if (FAILED(hRet)) goto VarAbs_Exit;
+        pVarIn = &temp;
+    }
+
     if (V_ISARRAY(pVarIn) || V_VT(pVarIn) == VT_UNKNOWN ||
         V_VT(pVarIn) == VT_DISPATCH || V_VT(pVarIn) == VT_RECORD ||
         V_VT(pVarIn) == VT_ERROR)
-        return DISP_E_TYPEMISMATCH;
-
+    {
+        hRet = DISP_E_TYPEMISMATCH;
+        goto VarAbs_Exit;
+    }
     *pVarOut = *pVarIn; /* Shallow copy the value, and invert it if needed */
 
 #define ABS_CASE(typ,min) \
@@ -4331,6 +4344,8 @@ HRESULT WINAPI VarAbs(LPVARIANT pVarIn, LPVARIANT pVarOut)
         hRet = DISP_E_BADVARTYPE;
     }
 
+VarAbs_Exit:
+    VariantClear(&temp);
     return hRet;
 }
 




More information about the wine-cvs mailing list