[PATCH v3 1/6] shell32/autocomplete: Fill and display the auto-suggest listbox in a separate function
Gabriel Ivăncescu
gabrielopcode at gmail.com
Sat Oct 27 10:37:58 CDT 2018
On Sat, Oct 27, 2018 at 12:47 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> On 10/25/2018 09:04 PM, Gabriel Ivăncescu wrote:
>
> > + WCHAR *text;
> > + UINT size, len = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0);
> > +
> > + if (flag != autoappend_flag_displayempty && len == 0)
> > + {
> > + if (ac->options & ACO_AUTOSUGGEST)
> > hide_listbox(ac, ac->hwndListBox);
> > + return;
> > }
> > +
> > + size = len + 1;
> > + if (!(text = heap_alloc(size * sizeof(WCHAR))))
> > + return;
> > + len = SendMessageW(hwnd, WM_GETTEXT, size, (LPARAM)text);
> > + if (len + 1 != size)
> > + text = heap_realloc(text, (len + 1) * sizeof(WCHAR));
> Was this tested with some inconsistent WM_GETTEXT implementation? Why do
> you need to realloc?
>
>
When I wrote that (was awhile ago) IIRC I followed the APIs based on
MSDN docs, where it said the result can be smaller under certain
circumstances with ANSI<->Unicode conversion. I don't know if Wine
suffers from that, however since the edit control can be subclassed by
apps which maybe imitate MSDN's gimmicks, it's probably a safer bet
anyway.
Also note that this patch just moved that function as it was already
there, so if that's not needed, it should be done in a different
patch, if there's nothing else wrong with this series. (i.e. it's out
of scope for this patch at least)
More information about the wine-devel
mailing list