Jacek Caban : kernelbase: Use IOCTL_CONDRV_SET_TITLE in SetConsoleTitleW.

Alexandre Julliard julliard at winehq.org
Tue Aug 18 16:34:24 CDT 2020


Module: wine
Branch: master
Commit: 6cff65900dd299f596636ca5449b0f99e825cf97
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6cff65900dd299f596636ca5449b0f99e825cf97

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Aug 17 15:07:39 2020 +0200

kernelbase: Use IOCTL_CONDRV_SET_TITLE in SetConsoleTitleW.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/console.c |  4 ++++
 dlls/kernelbase/console.c     | 14 +++-----------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 1adf4af064..3a374c7797 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -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);
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index 2611fd5864..e5a9fbd501 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -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 );
 }
 
 




More information about the wine-cvs mailing list