kernelbase: Use IOCTL_CONDRV_SET_TITLE in SetConsoleTitleW.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-08-17 15:07:39 +02:00 committed by Alexandre Julliard
parent 32eb41de8c
commit 6cff65900d
2 changed files with 7 additions and 11 deletions

View file

@ -3655,6 +3655,10 @@ static void test_FreeConsole(void)
ok(title[0] == 0xc0c0, "title byffer changed\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SetConsoleTitleW( L"test" );
ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "SetConsoleTitleW returned %x(%u)\n", ret, GetLastError());
SetLastError(0xdeadbeef);
hwnd = GetConsoleWindow();
ok(!hwnd, "hwnd = %p\n", hwnd);

View file

@ -1305,18 +1305,10 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTextAttribute( HANDLE handle, WORD attr
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleW( LPCWSTR title )
{
BOOL ret;
TRACE( "%s\n", debugstr_w( title ));
SERVER_START_REQ( set_console_input_info )
{
req->handle = 0;
req->mask = SET_CONSOLE_INPUT_INFO_TITLE;
wine_server_add_data( req, title, lstrlenW(title) * sizeof(WCHAR) );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
return ret;
return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, IOCTL_CONDRV_SET_TITLE,
(void *)title, lstrlenW(title) * sizeof(WCHAR), NULL, 0, NULL );
}