Listview notify_dispinfoT Messageformat

Robert Shearman rob at codeweavers.com
Wed Oct 27 15:28:33 CDT 2004


Thorsten Kani wrote:

> Hello,
> Testing showed that the current implementation of notify_dispinfoT 
> doesnt work with W2K. (or at least not with SP4 (:   )
> The attached patch corrects that our Listview doesnt display anything 
> on native.
>
> Following assumption proved to be wrong for the Message LVN_GETDISPINFOW:
> /*
> With testing on Windows 2000 it looks like the notify format
> has nothing to do with this message. It ALWAYS seems to be
> in ansi format. */
>
> This time, only LVN_*ETDISPINFOW is patched, anything else is untouched.
> -Anybody please tell me if you see problems with this Fix since i dont 
> want to break things.-


I have seen exactly the same problem with the IShellView implementation 
in native shell32. I have attached the patch I did at the time. I didn't 
submit it, because I soon got into a tangled mess where the function 
name was wrong and the isW parameter completely unnecessary and a whole 
bunch of functions calling it were also wrong.

To summarise: *all* common control notifications should be sent in the 
same format (ANSI/Unicode) as their parent (except if overriden by the 
CCS_SETUNICODEFORMAT message). It should not be based on the message 
sent to the control.

Rob
-------------- next part --------------
Index: listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.394
diff -u -p -r1.394 listview.c
--- listview.c	2 Sep 2004 23:00:53 -0000	1.394
+++ listview.c	27 Oct 2004 20:16:51 -0000
@@ -818,10 +818,6 @@ static int get_ansi_notification(INT uni
 }
 
 /*
-  With testing on Windows 2000 it looks like the notify format
-  has nothing to do with this message. It ALWAYS seems to be
-  in ansi format.
-
   infoPtr : listview struct
   notificationCode : *Unicode* notification code
   pdi : dispinfo structure (can be unicode or ansi)
@@ -830,14 +826,10 @@ static int get_ansi_notification(INT uni
 static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW)
 {
     BOOL bResult = FALSE;
-    BOOL convertToAnsi = FALSE;
     INT cchTempBufMax = 0, savCchTextMax = 0;
     LPWSTR pszTempBuf = NULL, savPszText = NULL;
 
-    if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW))
-	    convertToAnsi = isW;
-
-    if (convertToAnsi)
+    if ((pdi->item.mask & LVIF_TEXT) && (infoPtr->notifyFormat == NFR_ANSI))
     {
 	if (notificationCode != LVN_GETDISPINFOW)
 	{
@@ -861,15 +853,16 @@ static BOOL notify_dispinfoT(LISTVIEW_IN
         savPszText = pdi->item.pszText;
         pdi->item.pszText = pszTempBuf;
         pdi->item.cchTextMax = cchTempBufMax;
+
+        notificationCode = get_ansi_notification(notificationCode);
     }
 
     TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat !=
            NFR_ANSI));
 
-    bResult = notify_hdr(infoPtr, get_ansi_notification(notificationCode),
-                        (LPNMHDR)pdi);
+    bResult = notify_hdr(infoPtr, notificationCode, &pdi->hdr);
 
-    if (convertToAnsi)
+    if ((pdi->item.mask & LVIF_TEXT) && (infoPtr->notifyFormat == NFR_ANSI))
     {
         MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
                             savPszText, savCchTextMax);


More information about the wine-devel mailing list