Listview K1

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

 



As I was saying a few days ago, we have to be conservative
when we send data to applications, some of them don't deal
with uninitialized data, as they should...

ChangeLog
  Do not send uninitialized data in notification to application
  (based on a patch by Alexandre Julliard <julliard@winehq.com>)

--- dlls/comctl32/listview.c.K0	Thu Oct  3 18:01:35 2002
+++ dlls/comctl32/listview.c	Thu Oct  3 23:53:11 2002
@@ -4871,10 +4871,20 @@
 	/* if we need to callback, do it now */
 	if ((lpLVItem->mask & ~LVIF_STATE) || infoPtr->uCallbackMask)
 	{
-	    memcpy(&dispInfo.item, lpLVItem, sizeof(LVITEMW));
-	    dispInfo.item.stateMask &= infoPtr->uCallbackMask;
+	    /* NOTE: copy only fields which we _know_ are initialized, some apps
+	     *       depend on the uninitialized fields being 0 */
+	    dispInfo.item.mask = lpLVItem->mask;
+	    dispInfo.item.iItem = lpLVItem->iItem;
+	    dispInfo.item.iSubItem = lpLVItem->iSubItem;
+	    if (lpLVItem->mask & LVIF_TEXT)
+	    {
+		dispInfo.item.pszText = lpLVItem->pszText;
+		dispInfo.item.cchTextMax = lpLVItem->cchTextMax;		
+	    }
+	    if (lpLVItem->mask & LVIF_STATE)
+	        dispInfo.item.stateMask = lpLVItem->stateMask & infoPtr->uCallbackMask;
 	    notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW);
-	    memcpy(lpLVItem, &dispInfo.item, sizeof(LVITEMW));      
+	    *lpLVItem = dispInfo.item;
 	    TRACE("   getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW));
 	}
 




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

  Powered by Linux