74 Commits

Author SHA1 Message Date
Gabriel Ivăncescu
087c24dfdc shell32/autocomplete: Send some messages directly to the edit control's procedure.
Send some of the messages directly to the edit control's window procedure
to match Windows behavior and to be able to process WM_SETTEXT.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:29 +02:00
Gabriel Ivăncescu
ce254b5f6d shell32/autocomplete: Don't autocomplete at all on most control characters.
Most control characters sent via some CTRL+key combination should not
autocomplete at all. ^C is one example, where just copying some text should
not show the auto-suggestion box (if not visible). ^V is another example,
where it is already handled in WM_PASTE, so it has to be a no-op here,
else auto-append from WM_PASTE would complete the text and then the ^V
autocompletion would remove every other suggestion in the listbox.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:29 +02:00
Gabriel Ivăncescu
cefa84e5d9 shell32/autocomplete: Forward to the edit control outside of the switch to simplify the code.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu
a2cb1ab0b3 shell32/autocomplete: Handle more messages for autocompletion.
The user can right-click on the editbox control and choose one of these
operations, so they need to be handled separately regardless.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu
cb8bd825b9 shell32/autocomplete: Fix going up through the suggestion listbox.
When going up past the topmost item in the listbox, go through txtbackup
first before wrapping around, just like when going down. This matches
Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-21 23:58:56 +02:00
Gabriel Ivăncescu
644358bdf7 shell32/autocomplete: Remove the property after replacing the callback instead of before.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:20:24 +02:00
Gabriel Ivăncescu
2a8df60a8c shell32/autocomplete: Avoid another buffer overflow and handle arbitrary sizes for the auto-append string.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:41 +02:00
Gabriel Ivăncescu
72d8b7befd shell32/autocomplete: Simplify a calculation.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:32 +02:00
Gabriel Ivăncescu
9644205540 shell32/autocomplete: Don't auto-append on control characters.
We must not auto-append on control characters, most notably Backspace,
but also ^X (cut) and so on.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 17:19:20 +02:00
Gabriel Ivăncescu
a118459adf shell32/autocomplete: Redesign the window proc to trigger on key presses instead of key release.
AutoComplete currently shows up when the user releases a key, which is
wrong. Windows does it when the user presses a key, so use both WM_KEYDOWN
and WM_CHAR and redesign it so that it matches Windows behavior.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-18 20:59:38 +02:00
Gabriel Ivăncescu
779c513462 shell32/autocomplete: Move the autocomplete processing and WM_KEYUP to separate functions.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-18 20:59:38 +02:00
Gabriel Ivăncescu
cbbbb70cf2 shell32/autocomplete: Dynamically allocate hwndText so it can handle arbitrary sizes.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-13 12:54:38 +02:00
Gabriel Ivăncescu
7f659eb5f9 shell32/autocomplete: Get rid of control and filled BOOLs and simplify the code.
There's no need to have filled, since cpt can already provide the same
information.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:10:32 +02:00
Gabriel Ivăncescu
cd8d3c6de6 shell32/autocomplete: Don't call ShowWindow unless auto-suggest listbox is enabled.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:10:23 +02:00
Gabriel Ivăncescu
a435fbc646 shell32/autocomplete: Reduce the strlen calls because they are redundant.
We can retrieve the length of the string from the SendMessage calls already.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:10:18 +02:00
Gabriel Ivăncescu
97006eb661 shell32/autocomplete: Handle heap_alloc failure.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:09:58 +02:00
Gabriel Ivăncescu
74c0c0574e shell32/autocomplete: Fix a vulnerability by avoiding the use of snprintf.
The quickComplete format can have more than one % argument, or stuff like
%*.* or %1234s, which can be exploited since the format string can be read
from the registry, so handle it manually instead of using sprintf.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-11 14:09:52 +02:00
Gabriel Ivăncescu
0c049b6791 shell32/autocomplete: Fix handling of Backspace and Delete.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22255
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-07 13:03:18 +02:00
Gabriel Ivăncescu
2964b975ac shell32/autocomplete: Revamp pwzsRegKeyPath handling so it can deal with arbitrary sizes and make it more robust.
Handle heap_alloc failure, reg strings without a \ character at all,
try harder to find the reg path (if only value fails the lookup), and
read the registry value with any size.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-07 13:03:09 +02:00
Gabriel Ivăncescu
9c2217216c shell32/autocomplete: Don't crash when there's another AutoComplete object on the same edit control.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22333
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-30 19:55:24 +02:00
Nikolay Sivov
612a194133 shell32: Use ARRAY_SIZE macro.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-19 12:35:12 +01:00
Nikolay Sivov
e3b200bd8a shell32: Use global memory allocation helpers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-22 14:16:33 +01:00
Nikolay Sivov
f74e1b1fb1 shell32: Fix string leak.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 10:02:13 +02:00
Nikolay Sivov
0de2514f39 shell32: Consistently return interface pointer instead of implementation pointer. 2013-09-03 20:02:55 +02:00
Nikolay Sivov
c91e9db0cc shell32: Use string comparison as autocompletion check. 2012-02-06 10:19:32 -06:00
Detlef Riekenberg
cbfb15e8eb shell32: Reorder functions to avoid forward declarations. 2012-01-13 18:17:34 +01:00
Nikolay Sivov
46a2ec0209 shell32/autocomplete: Remove redundant memory initialization. 2011-07-25 13:41:21 +02:00
Nikolay Sivov
5354b974a1 shell32/autocomplete: Really append suggested part instead of replacing whole string. 2011-07-25 13:41:15 +02:00
Nikolay Sivov
2210e9bbf0 shell32/autocomplete: Autocompletion should be case insensitive for string comparison. 2011-07-25 13:41:06 +02:00
Michael Stefaniuc
cd3cdf6226 shell32: COM cleanup in autocomplete.c. 2011-05-30 17:22:07 +02:00
Andrew Nguyen
fff50be3e8 shell32: Keep at least one reference to the autocompletion object at initialization until the edit window is destroyed.
Spotted with Valgrind.
2011-02-01 12:38:48 +01:00
Andrew Nguyen
4145fe0ec2 shell32: Store the autocompletion object pointer in a window property rather than in the window user data. 2011-02-01 12:10:40 +01:00
Andrew Nguyen
4dc304489f shell32: Improve initialization state and parameter handling in IAutoComplete::Init. 2011-02-01 12:10:35 +01:00
Andrew Nguyen
7a6c0d2f46 shell32: Fix initial reference count for a new IAutoComplete instance. 2011-01-21 13:39:12 +01:00
Alexandre Julliard
1346740a57 shell32: Don't use the instance of the owner window for the autocomplete listbox. 2009-12-28 12:27:17 +01:00
Alexandre Julliard
6562b25b96 shell32: Remove unnecessary linefeeds in traces. 2009-05-21 17:17:26 +02:00
Michael Stefaniuc
6c54ad3dba shell32: Remove superfluous pointer casts. 2009-02-19 12:52:02 +01:00
Michael Stefaniuc
8324ed6cc9 shell32: Remove superfluous pointer casts from macros. 2009-02-19 12:51:57 +01:00
Jan de Mooij
f1bf550c63 shell32/autocomplete: Fix handling of WM_KILLFOCUS messages. 2008-12-03 09:46:59 +01:00
Michael Stefaniuc
b7de266082 shell32: Remove superfluous casts; mostly of void pointers. 2008-11-06 11:09:51 +01:00
Michael Stefaniuc
cc41ac4c16 shell32: Do not cast NULL. 2008-11-03 13:41:44 +01:00
Alexandre Julliard
2f2ec7ca89 shell32: Convert source files to utf-8. 2008-10-18 19:20:53 +02:00
Michael Stefaniuc
f6baf97629 shell32: Use FAILED instead of !SUCCEEDED. 2008-10-08 13:41:52 +02:00
Mikołaj Zalewski
a72fbdd023 shell32: autocomplete: Remove some obsolete FIXMEs, update some comments. 2008-09-18 12:53:25 +02:00
Mikołaj Zalewski
d9190052a2 shell32: autocomplete: Implement GetDropDownStatus. 2008-09-18 12:53:18 +02:00
Mikołaj Zalewski
ba6ddf28b4 shell32: autocomplete: Make SetOptions handle setting the ACO_AUTOSUGGEST after Init, fix ACO_AUTOSUGGEST|ACO_AUTOAPPEND case. 2008-09-18 12:53:07 +02:00
Mikołaj Zalewski
db74fed6d1 shell32: autocomplete: Fix a logical AND to a bitwise AND. 2008-09-18 12:52:44 +02:00
Mikołaj Zalewski
a4fd5a1f40 shell32: autocomplete: Add stub IAutoCompleteDropDown interface. 2008-09-18 12:52:31 +02:00
Mikołaj Zalewski
8525f6950f shell32: autocomplete: There is no need for separate IAutoComplete and IAutoComplete2 vtbls. 2008-07-30 12:44:00 +02:00
Mikołaj Zalewski
763018e176 shell32: autocomplete: Don't pass NULL pceltFetched to IEnumString_Next. 2008-07-24 13:03:30 +02:00