[PATCH v3 8/8] comctl32/listbox: Make LBS_NODATA listboxes error on any attempt to find a value

Nikolay Sivov nsivov at codeweavers.com
Sun Nov 11 08:03:24 CST 2018


On 11/11/18 1:05 PM, Gabriel Ivăncescu wrote:

> On Sat, Nov 10, 2018 at 11:46 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>> On 11/8/18 2:39 PM, Gabriel Ivăncescu wrote:
>>
>>> @@ -919,6 +919,9 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa
>>>        }
>>>        else
>>>        {
>>> +        if (descr->style & LBS_NODATA)
>>> +            return LB_ERR;
>>> +
>>>            if (exact && (descr->style & LBS_SORT))
>>>                /* If sorted, use a WM_COMPAREITEM binary search */
>>>                return LISTBOX_FindStringPos( descr, str, TRUE );
>>> @@ -2450,7 +2453,7 @@ static LRESULT LISTBOX_HandleChar( LB_DESCR *descr, WCHAR charW )
>>>                                    (LPARAM)descr->self );
>>>            if (caret == -2) return 0;
>>>        }
>>> -    if (caret == -1)
>>> +    if (caret == -1 && !(descr->style & LBS_NODATA))
>>>            caret = LISTBOX_FindString( descr, descr->focus_item, str, FALSE);
>>>        if (caret != -1)
>>>        {
>> Does it have to be deep in message handler? Can we skip right away if we
>> have to?
> No it doesn't have to be, it can be moved to the top of the function,
> I'll do that.

Thanks.


>
>> Also same issue, these are easily separable changes.
>>
> If you are referring to the caret == -1 change in HandleChar, then
> it's actually useless and can be skipped completely, since LB_ERR is
> -1 already.
>
> I had it done probably because when I also made the user32 changes, it
> had to set last error (but *only* the user32 variant does that, when I
> tested), so it only makes sense there. I'll remove it for comctl32.

Right, I included some last error tests in v5 patches. It's clearly 
different between user32 and newer variant, and I don't see any existing 
tests for that in user32.




More information about the wine-devel mailing list