comctl32: [Bug 17251] cchTextMax needs to be set for LVS_OWNERDATA as it uses LVN_GETDISPINFO notifications

Nikolay Sivov bunglehead at gmail.com
Mon Mar 15 07:26:52 CDT 2010


On 3/15/2010 15:08, Jeff Latimer wrote:
> On 13/03/10 20:30, Nikolay Sivov wrote:
>> On 3/13/2010 06:35, Jeff Latimer wrote:
>>>
>>> If not set then no value is returned and in the case of uTorrent the 
>>> next entry selected is renamed. 
>>> http://bugs.winehq.org/show_bug.cgi?id=17251
>> No value returned from what?
> LISTVIEW_GetItemW
Ok. From what I see now we have a special path for LVIF_TEXT:

---LISTVIEW_GetItemT---
         if (lpLVItem->mask & LVIF_TEXT)
         {
         if (lpLVItem->mask & LVIF_NORECOMPUTE)
             /* reset mask */
             dispInfo.item.mask &= ~(LVIF_TEXT | LVIF_NORECOMPUTE);
         else
         {
             dispInfo.item.pszText = lpLVItem->pszText;
             dispInfo.item.cchTextMax = lpLVItem->cchTextMax;
         }
         }
---

So if you request LVIF_TEXT cchTextMax should be overwritten here, if we 
are at LVIF_NORECOMPUTE we don't even request LVIF_TEXT.
Have you determine exact cause of failure returning text from 
LISTVIEW_GetItemW, including failing path? That's what we really need.

>>>       dispInfo.item.iItem = editedItem;
>>>       dispInfo.item.iSubItem = 0;
>>>       dispInfo.item.stateMask = ~0;
>>> +    dispInfo.item.cchTextMax = textlenT(pszText, isW)+2;
>>>       if (!LISTVIEW_GetItemW(infoPtr,&dispInfo.item))
>> Could you explain what this change fixes exactly? As I remember 
>> uTorrent uses an LVS_OWNERDATA listview, so this cchTextMax isn't 
>> processed in LISTVIEW_GetItemW.
> I have added some traces and a code fragment to 
> http://bugs.winehq.org/show_bug.cgi?id=17251 showing the before and 
> after inserting  dispInfo.item.cchTextMax = textlenT(pszText, isW)+2;
> into LISTVIEW_EndEditLabelT

>>
>> Also I'm not sure what you mean here
>> ---
>> textlenT(pszText, isW)+2
>> ---
>> pszText is Edit control text at this point (or NULL). How it's 
>> related to LISTVIEW_GetItemW? And what this +2 adding mean?
> Yes pszText is Edit control text or NULL.  textLenT returns the length 
> of the without  the trailing Null.  What's required here is a buffer 
> at least 1 character longer than pszText+Null so that when 
> LISTVIEW_GetItemW returns dispInfo.item.pszText we can determine 
> whether it is longer than pszText.  We need +2 at least for this.
I don't get it, sorry. What is a trick here? Assume I'm ok with +1 here, 
but how 'it is longer than pszText' is important?




More information about the wine-devel mailing list