Commit 7444aa42 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernelbase: Use IOCTL_CONDRV_GET_TITLE in GetConsoleTitleW.

parent 35762584
......@@ -3589,7 +3589,9 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output)
static void test_FreeConsole(void)
{
WCHAR title[16];
HANDLE handle;
DWORD size;
UINT cp;
BOOL ret;
......@@ -3637,6 +3639,13 @@ static void test_FreeConsole(void)
ok(!cp, "cp = %x\n", cp);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
SetLastError(0xdeadbeef);
memset( title, 0xc0, sizeof(title) );
size = GetConsoleTitleW( title, ARRAY_SIZE(title) );
ok(!size, "GetConsoleTitleW returned %u\n", size);
ok(title[0] == 0xc0c0, "title byffer changed\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
if (!skip_nt)
{
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );
......
......@@ -739,20 +739,15 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx( HANDLE handle,
*/
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW( LPWSTR title, DWORD size )
{
DWORD ret = 0;
if (!size) return 0;
SERVER_START_REQ( get_console_input_info )
{
req->handle = 0;
wine_server_set_reply( req, title, (size - 1) * sizeof(WCHAR) );
if (!wine_server_call_err( req ))
{
ret = wine_server_reply_size(reply) / sizeof(WCHAR);
title[ret] = 0;
}
}
SERVER_END_REQ;
return ret;
if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, IOCTL_CONDRV_GET_TITLE,
NULL, 0, title, (size - 1) * sizeof(WCHAR), &size ))
return 0;
size /= sizeof(WCHAR);
title[size] = 0;
return size + 1;
}
......
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