Jacek Caban : conhost: Implement IOCTL_CONDRV_GET_MODE.

Alexandre Julliard julliard at winehq.org
Fri Aug 21 16:43:26 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 20 23:51:17 2020 +0200

conhost: Implement IOCTL_CONDRV_GET_MODE.

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

---

 dlls/kernel32/tests/console.c |  2 --
 programs/conhost/conhost.c    | 24 ++++++++++++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 42fd26efe5..b45e707ac8 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -4121,9 +4121,7 @@ START_TEST(console)
         DWORD mode;
 
         ret = GetConsoleMode(hConIn, &mode);
-        todo_wine
         ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
-        todo_wine
         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);
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 2014ca2260..dae30d1576 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -25,6 +25,7 @@
 #include <winuser.h>
 #include <winternl.h>
 
+#include "wine/condrv.h"
 #include "wine/server.h"
 #include "wine/debug.h"
 
@@ -33,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(conhost);
 struct console
 {
     HANDLE                server;        /* console server handle */
+    unsigned int          mode;          /* input mode */
 };
 
 static void *ioctl_buffer;
@@ -53,8 +55,22 @@ static void *alloc_ioctl_buffer( size_t size )
 static NTSTATUS console_input_ioctl( struct console *console, unsigned int code, const void *in_data,
                                      size_t in_size, size_t *out_size )
 {
-    FIXME( "unsupported ioctl %x\n", code );
-    return STATUS_NOT_SUPPORTED;
+    switch (code)
+    {
+    case IOCTL_CONDRV_GET_MODE:
+        {
+            DWORD *mode;
+            TRACE( "returning mode %x\n", console->mode );
+            if (in_size || *out_size != sizeof(*mode)) return STATUS_INVALID_PARAMETER;
+            if (!(mode = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY;
+            *mode = console->mode;
+            return STATUS_SUCCESS;
+        }
+
+    default:
+        FIXME( "unsupported ioctl %x\n", code );
+        return STATUS_NOT_SUPPORTED;
+    }
 }
 
 static NTSTATUS process_console_ioctls( struct console *console )
@@ -162,6 +178,10 @@ int __cdecl wmain(int argc, WCHAR *argv[])
     for (i = 0; i < argc; i++) TRACE("%s ", wine_dbgstr_w(argv[i]));
     TRACE("\n");
 
+    console.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;
+
     for (i = 1; i < argc; i++)
     {
         if (!wcscmp( argv[i], L"--headless"))




More information about the wine-cvs mailing list