PATCH: copy_arg on itypelib::invoke problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thanks to MikeH for bugging me sufficiently.

This is one InstallShield regression down, the "Error Number: 0x80020008"
(DISP_E_TYPE_MISMATCH) regression.

Ciao, Marcus

Changelog:
	Do not coerce arguments of ITypeLib::Invoke in-place, or we get 
	corrupted variants.
	Handle V_ARRAY | somthing -> VT_SAFEARRAY, as this is a NOP.

Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.102
diff -u -r1.102 typelib.c
--- dlls/oleaut32/typelib.c	16 Oct 2003 19:09:41 -0000	1.102
+++ dlls/oleaut32/typelib.c	2 Nov 2003 17:00:47 -0000
@@ -4335,6 +4335,7 @@
 ) {
     UINT arglen = _argsize(vt)*sizeof(DWORD);
     VARTYPE	oldvt;
+    VARIANT	va;
 
     if ((vt==VT_PTR) && tdesc && (tdesc->u.lptdesc->vt == VT_VARIANT)) {
 	memcpy(argpos,&arg,sizeof(void*));
@@ -4345,7 +4346,12 @@
 	memcpy(argpos, &V_UNION(arg,lVal), arglen);
 	return S_OK;
     }
-    
+
+    if (V_ISARRAY(arg) && (vt == VT_SAFEARRAY)) {
+	memcpy(argpos, &V_UNION(arg,parray), sizeof(SAFEARRAY*));
+	return S_OK;
+    }
+
     if (vt == VT_VARIANT) {
 	memcpy(argpos, arg, arglen);
 	return S_OK;
@@ -4362,6 +4368,7 @@
     }
     if ((vt == VT_PTR) && tdesc)
 	return _copy_arg(tinfo, tdesc->u.lptdesc, argpos, arg, tdesc->u.lptdesc->vt);
+
     if ((vt == VT_USERDEFINED) && tdesc && tinfo) {
 	ITypeInfo	*tinfo2;
 	TYPEATTR	*tattr;
@@ -4432,10 +4439,14 @@
 	}
 	return E_FAIL;
     }
+
     oldvt = V_VT(arg);
-    if (VariantChangeType(arg,arg,0,vt)==S_OK) {
-    	FIXME("argument was coerced in-place (0x%x -> 0x%x); source data has been modified!!!\n", oldvt, vt);
-	memcpy(argpos,&V_UNION(arg,lVal), arglen);
+    VariantInit(&va);
+    if (VariantChangeType(&va,arg,0,vt)==S_OK) {
+	memcpy(argpos,&V_UNION(&va,lVal), arglen);
+	FIXME("Should not use VariantChangeType here. (conversion from 0x%x -> 0x%x)\n",
+		V_VT(arg), vt
+	);
 	return S_OK;
     }
     ERR("Set arg to disparg type 0x%x vs 0x%x\n",V_VT(arg),vt);


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux