Jacek Caban : conhost: Implement IOCTL_CONDRV_GET_MODE.

Alexandre Julliard julliard at winehq.org
Thu Aug 27 15:26:50 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 27 15:05:25 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 |  8 ++++++--
 programs/conhost/conhost.c    | 12 ++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 09c48ee705..5efe4ee38c 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3945,7 +3945,7 @@ static void test_AllocConsole(void)
     CloseHandle(pipe_write);
 }
 
-static void test_pseudo_console_child(HANDLE input)
+static void test_pseudo_console_child(HANDLE input, HANDLE output)
 {
     DWORD mode;
     BOOL ret;
@@ -3967,6 +3967,10 @@ static void test_pseudo_console_child(HANDLE input)
     ret = SetConsoleMode(input, mode | ENABLE_AUTO_POSITION);
     ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
 
+    ret = GetConsoleMode(output, &mode);
+    ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
+    ok(mode == (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT), "mode = %x\n", mode);
+
     test_console_title();
     test_WriteConsoleInputW(input);
 }
@@ -4144,7 +4148,7 @@ START_TEST(console)
 
     if (using_pseudo_console)
     {
-        test_pseudo_console_child(hConIn);
+        test_pseudo_console_child(hConIn, hConOut);
         return;
     }
 
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index a5d9a8feeb..06d2b15d2a 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -67,6 +67,7 @@ struct screen_buffer
 {
     struct console       *console;       /* console reference */
     unsigned int          id;            /* screen buffer id */
+    unsigned int          mode;          /* output mode */
     unsigned int          width;         /* size (w-h) of the screen buffer */
     unsigned int          height;
     struct wine_rb_entry  entry;         /* map entry */
@@ -102,6 +103,7 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
     if (!(screen_buffer = malloc( sizeof(*screen_buffer) ))) return NULL;
     screen_buffer->console        = console;
     screen_buffer->id             = id;
+    screen_buffer->mode           = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
     screen_buffer->width          = width;
     screen_buffer->height         = height;
 
@@ -232,6 +234,16 @@ static NTSTATUS screen_buffer_ioctl( struct screen_buffer *screen_buffer, unsign
         screen_buffer->console->active = screen_buffer;
         return STATUS_SUCCESS;
 
+    case IOCTL_CONDRV_GET_MODE:
+        {
+            DWORD *mode;
+            TRACE( "returning mode %x\n", screen_buffer->mode );
+            if (in_size || *out_size != sizeof(*mode)) return STATUS_INVALID_PARAMETER;
+            if (!(mode = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY;
+            *mode = screen_buffer->mode;
+            return STATUS_SUCCESS;
+        }
+
     default:
         FIXME( "unsupported ioctl %x\n", code );
         return STATUS_NOT_SUPPORTED;




More information about the wine-cvs mailing list