From: Aida JonikienÄ— aidas957@gmail.com
Zadig passes a fixed string length to WM_GETTEXT in one place regardless of the string: https://github.com/pbatard/libwdi/blob/9b23b82a2dd1cbffc16d46c212f92c6bf8c0c... (which causes a segfault with NULL strings on Wine but not on Windows).
This fixes an unrelated issue in https://bugs.winehq.org/show_bug.cgi?id=54750 (but not the main one). --- dlls/comctl32/edit.c | 2 +- dlls/win32u/window.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 4b950412617..b7fd50a75e9 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -3183,7 +3183,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y) */ static INT EDIT_WM_GetText(const EDITSTATE *es, INT count, LPWSTR dst) { - if (!count) + if (!count || !dst) return 0;
lstrcpynW(dst, es->text, count); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3fa97d9a107..532d8e7a789 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2228,9 +2228,10 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ if (surface) window_surface_release( surface );
if (!(flags & ULW_COLORKEY)) key = CLR_INVALID; - if (!(user_driver->pCreateLayeredWindow( hwnd, &surface_rect, key, &surface )) || !surface) return FALSE; + if (IsRectEmpty( &surface_rect )) window_surface_add_ref( (surface = &dummy_surface) ); + else if (!(user_driver->pCreateLayeredWindow( hwnd, &surface_rect, key, &surface )) || !surface) return FALSE;
- if (!hdc_src) ret = TRUE; + if (!hdc_src || surface == &dummy_surface) ret = TRUE; else { BLENDFUNCTION src_blend = { AC_SRC_OVER, 0, 255, 0 };