safearray patch

Ove Kaaven ovehk at ping.uio.no
Wed Jan 2 11:19:36 CST 2002


Some InstallShield stuff seems to behave badly and not initialize the
destination argument for SafeArrayGetElement on a variant array. This
patch fixes that, but I haven't checked what Windows does...
maybe someone may want to do that.

Log:
Ove Kaaven <ovek at transgaming.com>
If SafeArrayGetElement is called on a variant array, initialize
destination variant before copying the array element to it, some badly
behaved apps don't seem to do it themselves.

Index: dlls/oleaut32/safearray.c
===================================================================
RCS file: /cvsroot/winex/wine/dlls/oleaut32/safearray.c,v
retrieving revision 1.1.1.9
retrieving revision 1.3
diff -u -r1.1.1.9 -r1.3
--- dlls/oleaut32/safearray.c	2001/10/28 14:14:55	1.1.1.9
+++ dlls/oleaut32/safearray.c	2001/10/16 17:33:01	1.3
@@ -356,7 +356,9 @@
         *((BSTR*)pv) = pbstrReturnedStr; 
     }
     else if( psa->fFeatures == FADF_VARIANT) {
-      HRESULT hr = VariantCopy(pv, elementStorageAddress);
+      HRESULT hr;
+      VariantInit(pv);
+      hr = VariantCopy(pv, elementStorageAddress);
       if (FAILED(hr)) {
         SafeArrayUnlock(psa);
         return hr;





More information about the wine-patches mailing list