Commit 90c13be9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserInternalGetWindowText implementation from user32.

parent a5ba63b8
......@@ -173,7 +173,7 @@ static inline WCHAR *get_button_text( HWND hwnd )
{
static const INT len = 512;
WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
if (buffer) InternalGetWindowText( hwnd, buffer, len + 1 );
if (buffer) NtUserInternalGetWindowText( hwnd, buffer, len + 1 );
return buffer;
}
......
......@@ -452,7 +452,7 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
buf[0] = '&';
buf[1] = '0' + visible;
buf[2] = ' ';
InternalGetWindowText(ci->child[i], buf + 3, ARRAY_SIZE(buf) - 3);
NtUserInternalGetWindowText(ci->child[i], buf + 3, ARRAY_SIZE(buf) - 3);
TRACE("Adding %p, id %u %s\n", ci->child[i], id, debugstr_w(buf));
AppendMenuW(ci->hWindowMenu, MF_STRING, id, buf);
......@@ -1911,7 +1911,7 @@ static INT_PTR WINAPI MDI_MoreWindowsDlgProc (HWND hDlg, UINT iMsg, WPARAM wPara
{
WCHAR buffer[MDI_MAXTITLELENGTH];
if (!InternalGetWindowText(ci->child[i], buffer, ARRAY_SIZE(buffer)))
if (!NtUserInternalGetWindowText(ci->child[i], buffer, ARRAY_SIZE(buffer)))
continue;
SendMessageW(hListBox, LB_ADDSTRING, 0, (LPARAM)buffer );
SendMessageW(hListBox, LB_SETITEMDATA, i, (LPARAM)ci->child[i] );
......
......@@ -2186,7 +2186,7 @@ static void SPY_GetWndName( SPY_INSTANCE *sp_e )
SPY_GetClassName( sp_e );
len = InternalGetWindowText(sp_e->msg_hwnd, sp_e->wnd_name, ARRAY_SIZE(sp_e->wnd_name));
len = NtUserInternalGetWindowText( sp_e->msg_hwnd, sp_e->wnd_name, ARRAY_SIZE(sp_e->wnd_name) );
if(!len) /* get class name */
{
LPWSTR dst = sp_e->wnd_name;
......
......@@ -635,7 +635,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style )
if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) )))
goto no_TextOut;
while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
while ((len = NtUserInternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
{
buf_size *= 2;
if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) )))
......
......@@ -8308,6 +8308,11 @@ static void test_gettext(void)
ok( !strcmp(buf, "blah"), "got %s\n", buf );
ok( num_gettext_msgs == 0, "got %u WM_GETTEXT messages\n", num_gettext_msgs );
bufW[0] = 0xcc;
buf_len = InternalGetWindowText( hwnd, bufW, ARRAYSIZE(bufW) );
ok( buf_len == ARRAYSIZE("caption") - 1, "expected a nonempty window text\n" );
ok( !lstrcmpW( bufW, L"caption" ), "got %s\n", debugstr_w(bufW) );
g_wm_gettext_override.enabled = FALSE;
/* same for W window */
......
......@@ -446,7 +446,7 @@
@ stdcall InsertMenuItemW(long long long ptr)
@ stdcall InsertMenuW(long long long long ptr)
@ stdcall InternalGetWindowIcon(ptr long)
@ stdcall InternalGetWindowText(long ptr long)
@ stdcall InternalGetWindowText(long ptr long) NtUserInternalGetWindowText
@ stdcall IntersectRect(ptr ptr ptr)
@ stdcall InvalidateRect(long ptr long)
@ stdcall InvalidateRgn(long long long)
......
......@@ -2037,7 +2037,7 @@ HWND WINAPI FindWindowExW( HWND parent, HWND child, LPCWSTR className, LPCWSTR t
{
while (list[i])
{
if (InternalGetWindowText( list[i], buffer, len + 1 ))
if (NtUserInternalGetWindowText( list[i], buffer, len + 1 ))
{
if (!wcsicmp( buffer, title )) break;
}
......@@ -2945,30 +2945,6 @@ INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
/*******************************************************************
* InternalGetWindowText (USER32.@)
*/
INT WINAPI InternalGetWindowText(HWND hwnd,LPWSTR lpString,INT nMaxCount )
{
WND *win;
if (nMaxCount <= 0) return 0;
if (!(win = WIN_GetPtr( hwnd ))) return 0;
if (win == WND_DESKTOP) lpString[0] = 0;
else if (win != WND_OTHER_PROCESS)
{
if (win->text) lstrcpynW( lpString, win->text, nMaxCount );
else lpString[0] = 0;
WIN_ReleasePtr( win );
}
else
{
get_server_window_text( hwnd, lpString, nMaxCount );
}
return lstrlenW(lpString);
}
/*******************************************************************
* GetWindowTextW (USER32.@)
*/
INT WINAPI GetWindowTextW( HWND hwnd, LPWSTR lpString, INT nMaxCount )
......
......@@ -139,6 +139,7 @@ static void * const syscalls[] =
NtUserGetSystemDpiForProcess,
NtUserGetThreadDesktop,
NtUserInitializeClientPfnArrays,
NtUserInternalGetWindowText,
NtUserNotifyWinEvent,
NtUserOpenDesktop,
NtUserOpenInputDesktop,
......
......@@ -1045,7 +1045,7 @@
@ stub NtUserInjectTouchInput
@ stub NtUserInteractiveControlQueryUsage
@ stub NtUserInternalGetWindowIcon
@ stub NtUserInternalGetWindowText
@ stdcall -syscall NtUserInternalGetWindowText(long ptr long)
@ stub NtUserInternalToUnicode
@ stub NtUserInvalidateRect
@ stub NtUserInvalidateRgn
......
......@@ -425,6 +425,49 @@ NTSTATUS WINAPI NtUserBuildHwndList( HDESK desktop, ULONG unk2, ULONG unk3, ULON
return STATUS_SUCCESS;
}
/* 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;
}
/*******************************************************************
* NtUserInternalGetWindowText (win32u.@)
*/
INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count )
{
WND *win;
if (count <= 0) return 0;
if (!(win = get_win_ptr( hwnd ))) return 0;
if (win == WND_DESKTOP) text[0] = 0;
else if (win != WND_OTHER_PROCESS)
{
if (win->text) lstrcpynW( text, win->text, count );
else text[0] = 0;
release_win_ptr( win );
}
else
{
get_server_window_text( hwnd, text, count );
}
return lstrlenW(text);
}
/*****************************************************************************
* NtUserCallHwnd (win32u.@)
*/
......
......@@ -124,6 +124,7 @@
SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
SYSCALL_ENTRY( NtUserInitializeClientPfnArrays ) \
SYSCALL_ENTRY( NtUserInternalGetWindowText ) \
SYSCALL_ENTRY( NtUserNotifyWinEvent ) \
SYSCALL_ENTRY( NtUserOpenDesktop ) \
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
......
......@@ -214,6 +214,15 @@ NTSTATUS WINAPI wow64_NtUserBuildHwndList( UINT *args )
return status;
}
NTSTATUS WINAPI wow64_NtUserInternalGetWindowText( UINT *args )
{
HWND hwnd = get_handle( &args );
WCHAR *text = get_ptr( &args );
INT count = get_ulong( &args );
return NtUserInternalGetWindowText( hwnd, text, count );
}
NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
{
HWND hwnd = get_handle( &args );
......
......@@ -312,6 +312,7 @@ BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT
NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs *client_procsA,
const struct user_client_procs *client_procsW,
const void *client_workers, HINSTANCE user_module );
INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count );
BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format );
UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout );
void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG child_id );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment