Robert Shearman : oleaut: Support conversion of VT_SAFEARRAY into VT_ARRAY|type.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 12 06:43:07 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 9227902714c2b2111ca311375c47d485427e66cc
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=9227902714c2b2111ca311375c47d485427e66cc

Author: Robert Shearman <rob at codeweavers.com>
Date:   Thu Jan 12 11:53:47 2006 +0100

oleaut: Support conversion of VT_SAFEARRAY into VT_ARRAY|type.
Typelib variant types that cannot be converted should return
DISP_E_BADVARTYPE.
Don't call DispCallFunc if conversion of one of the arguments failed.

---

 dlls/oleaut32/typelib.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index b808243..31f5bad 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -5008,7 +5008,7 @@ static HRESULT typedescvt_to_variantvt(I
     HRESULT hr = S_OK;
 
     /* enforce only one level of pointer indirection */
-    if (!(*vt & VT_BYREF) && (tdesc->vt == VT_PTR))
+    if (!(*vt & VT_BYREF) && !(*vt & VT_ARRAY) && (tdesc->vt == VT_PTR))
     {
         tdesc = tdesc->u.lptdesc;
 
@@ -5045,9 +5045,17 @@ static HRESULT typedescvt_to_variantvt(I
     case VT_USERDEFINED:
         hr = userdefined_to_variantvt(tinfo, tdesc, vt);
         break;
+    case VT_VOID:
+    case VT_CARRAY:
     case VT_PTR:
-        ERR("cannot convert VT_PTR into variant VT\n");
-        hr = E_FAIL;
+    case VT_LPSTR:
+    case VT_LPWSTR:
+        ERR("cannot convert type %d into variant VT\n", tdesc->vt);
+        hr = DISP_E_BADVARTYPE;
+        break;
+    case VT_SAFEARRAY:
+        *vt |= VT_ARRAY;
+        hr = typedescvt_to_variantvt(tinfo, tdesc->u.lptdesc, vt);
         break;
     default:
         *vt |= tdesc->vt;
@@ -5288,6 +5296,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke
                     break;
                 }
             }
+            if (FAILED(hres)) goto func_fail; /* FIXME: we don't free changed types here */
             if (func_desc->cParamsOpt < 0)
             {
                 FIXME("Does not support safearray optional parameters\n");




More information about the wine-cvs mailing list