PATCH: tmarshal

Marcus Meissner marcus at jet.franken.de
Mon May 6 13:36:15 CDT 2002


Hi,

I was not getting BSTR marshalling NULL pointer exceptions due to a hack
in the DOS support, which unprotected the 0 page all the time.

Ciao, Marcus

License: LGPL
Changelog:
	BSTRs can be NULL, handle them seperately.

Index: tmarshal.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tmarshal.c,v
retrieving revision 1.2
diff -u -r1.2 tmarshal.c
--- tmarshal.c	9 Mar 2002 23:39:10 -0000	1.2
+++ tmarshal.c	6 May 2002 19:42:34 -0000
@@ -369,10 +369,17 @@
     case VT_NULL:
 	return S_OK;
     case VT_BSTR: {	/* DWORD size, string data */
-	    DWORD *bstr = ((DWORD*)(*arg))-1;
 
-	    if (relaydeb) MESSAGE("%s",debugstr_w((LPWSTR)(bstr+1)));
-	    return xbuf_add(buf,(LPBYTE)bstr,bstr[0]+4);
+	    if (*arg) {
+		DWORD *bstr = ((DWORD*)(*arg))-1;
+
+		if (relaydeb) MESSAGE("%s",debugstr_w((LPWSTR)(bstr+1)));
+		return xbuf_add(buf,(LPBYTE)bstr,bstr[0]+4);
+	    } else {
+		DWORD xnull = 0;
+
+		return xbuf_add(buf,(LPBYTE)&xnull,sizeof(xnull));
+	    }
 	}
     case VT_BOOL:
     case VT_I4:



More information about the wine-patches mailing list