Jacek Caban : conhost: Implement IOCTL_CONDRV_SET_MODE.

Alexandre Julliard julliard at winehq.org
Mon Aug 24 15:58:51 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Aug 24 13:20:53 2020 +0200

conhost: Implement IOCTL_CONDRV_SET_MODE.

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

---

 dlls/kernel32/tests/console.c | 31 ++++++++++++++++++++++++-------
 programs/conhost/conhost.c    |  6 ++++++
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index b45e707ac8..922a250993 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3945,6 +3945,29 @@ static void test_AllocConsole(void)
     CloseHandle(pipe_write);
 }
 
+static void test_pseudo_console_child(HANDLE input)
+{
+    DWORD mode;
+    BOOL ret;
+
+    ret = GetConsoleMode(input, &mode);
+    ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
+    ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
+                ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION),
+       "mode = %x\n", mode);
+
+    ret = SetConsoleMode(input, mode & ~ENABLE_AUTO_POSITION);
+    ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
+
+    ret = GetConsoleMode(input, &mode);
+    ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
+    ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
+                ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS), "mode = %x\n", mode);
+
+    ret = SetConsoleMode(input, mode | ENABLE_AUTO_POSITION);
+    ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
+}
+
 static DWORD WINAPI read_pipe_proc( void *handle )
 {
     char buf[64];
@@ -4118,13 +4141,7 @@ START_TEST(console)
 
     if (using_pseudo_console)
     {
-        DWORD mode;
-
-        ret = GetConsoleMode(hConIn, &mode);
-        ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
-        ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
-                    ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION),
-           "mode = %x\n", mode);
+        test_pseudo_console_child(hConIn);
         return;
     }
 
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index dae30d1576..6eedfc9d65 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -67,6 +67,12 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
             return STATUS_SUCCESS;
         }
 
+    case IOCTL_CONDRV_SET_MODE:
+        if (in_size != sizeof(unsigned int) || *out_size) return STATUS_INVALID_PARAMETER;
+        console->mode = *(unsigned int *)in_data;
+        TRACE( "set %x mode\n", console->mode );
+        return STATUS_SUCCESS;
+
     default:
         FIXME( "unsupported ioctl %x\n", code );
         return STATUS_NOT_SUPPORTED;




More information about the wine-cvs mailing list