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