From d312083e0add3a5752f6fd6e265a667f22d71af7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 8 Mar 2022 14:23:45 +0100 Subject: [PATCH] win32u: Move GetWindowTextLength implementation from user32. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/win.c | 29 ++--------------------------- dlls/win32u/window.c | 2 ++ include/ntuser.h | 1 + 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 9c2ceedd6a3..0aa0a0b6f08 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -399,31 +399,6 @@ void update_window_state( HWND hwnd ) } -/******************************************************************* - * get_server_window_text - * - * Retrieve the window text from the server. - */ -static data_size_t get_server_window_text( HWND hwnd, WCHAR *text, data_size_t count ) -{ - data_size_t len = 0, needed = 0; - - SERVER_START_REQ( get_window_text ) - { - req->handle = wine_server_user_handle( hwnd ); - if (count) wine_server_set_reply( req, text, (count - 1) * sizeof(WCHAR) ); - if (!wine_server_call_err( req )) - { - needed = reply->length; - len = wine_server_reply_size(reply); - } - } - SERVER_END_REQ; - if (text) text[len / sizeof(WCHAR)] = 0; - return needed; -} - - /******************************************************************* * get_hwnd_message_parent * @@ -3023,7 +2998,7 @@ INT WINAPI GetWindowTextLengthA( HWND hwnd ) /* when window belongs to other process, don't send a message */ GetCPInfo( CP_ACP, &info ); - return get_server_window_text( hwnd, NULL, 0 ) * info.MaxCharSize; + return NtUserCallHwnd( hwnd, NtUserGetWindowTextLength ) * info.MaxCharSize; } /******************************************************************* @@ -3034,7 +3009,7 @@ INT WINAPI GetWindowTextLengthW( HWND hwnd ) if (WIN_IsCurrentProcess( hwnd )) return SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ); /* when window belongs to other process, don't send a message */ - return get_server_window_text( hwnd, NULL, 0 ); + return NtUserCallHwnd( hwnd, NtUserGetWindowTextLength ); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 93ee0ffd164..168195dcd44 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -475,6 +475,8 @@ DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) { switch (code) { + case NtUserGetWindowTextLength: + return get_server_window_text( hwnd, NULL, 0 ); case NtUserIsWindow: return is_window( hwnd ); default: diff --git a/include/ntuser.h b/include/ntuser.h index 34d75f4f726..ab46a1a5b09 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -139,6 +139,7 @@ enum /* NtUserCallHwnd codes, not compatible with Windows */ enum { + NtUserGetWindowTextLength, NtUserIsWindow, };