Jacek Caban : conhost: Use dedicated ioctl for GetConsoleWindow.

Alexandre Julliard julliard at winehq.org
Tue Aug 17 16:26:52 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug 17 12:29:09 2021 +0200

conhost: Use dedicated ioctl for GetConsoleWindow.

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

---

 dlls/kernel32/console.c    |  6 +++---
 include/wine/condrv.h      |  2 +-
 programs/conhost/conhost.c | 11 ++++++++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 8c61d28e8c6..6f12ddfe7b2 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -54,12 +54,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(console);
  */
 HWND WINAPI GetConsoleWindow(void)
 {
-    struct condrv_input_info info;
+    condrv_handle_t win;
     BOOL ret;
 
     ret = DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
-                           IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL );
-    return ret ? LongToHandle( info.win ) : NULL;
+                           IOCTL_CONDRV_GET_WINDOW, NULL, 0, &win, sizeof(win), NULL, NULL );
+    return ret ? LongToHandle( win ) : NULL;
 }
 
 
diff --git a/include/wine/condrv.h b/include/wine/condrv.h
index add08be20c8..4d2332a1ee9 100644
--- a/include/wine/condrv.h
+++ b/include/wine/condrv.h
@@ -42,6 +42,7 @@
 #define IOCTL_CONDRV_CTRL_EVENT            CTL_CODE(FILE_DEVICE_CONSOLE, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_CONDRV_BEEP                  CTL_CODE(FILE_DEVICE_CONSOLE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_CONDRV_FLUSH                 CTL_CODE(FILE_DEVICE_CONSOLE, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_CONDRV_GET_WINDOW            CTL_CODE(FILE_DEVICE_CONSOLE, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
 /* console output ioctls */
 #define IOCTL_CONDRV_WRITE_CONSOLE         CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
@@ -87,7 +88,6 @@ struct condrv_input_info
     unsigned int  input_cp;       /* console input codepage */
     unsigned int  output_cp;      /* console output codepage */
     unsigned int  input_count;    /* number of available input records */
-    condrv_handle_t win;          /* renderer window handle */
 };
 
 /* IOCTL_CONDRV_SET_INPUT_INFO params */
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index ecfdd082a81..eeca9e62a3f 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -2519,11 +2519,20 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
             if (!(info = alloc_ioctl_buffer( sizeof(*info )))) return STATUS_NO_MEMORY;
             info->input_cp    = console->input_cp;
             info->output_cp   = console->output_cp;
-            info->win         = condrv_handle( console->win );
             info->input_count = console->record_count;
             return STATUS_SUCCESS;
         }
 
+    case IOCTL_CONDRV_GET_WINDOW:
+        {
+            condrv_handle_t *result;
+            TRACE( "get window\n" );
+            if (in_size || *out_size != sizeof(*result)) return STATUS_INVALID_PARAMETER;
+            if (!(result = alloc_ioctl_buffer( sizeof(*result )))) return STATUS_NO_MEMORY;
+            *result = condrv_handle( console->win );
+            return STATUS_SUCCESS;
+        }
+
     case IOCTL_CONDRV_SET_INPUT_INFO:
         {
             const struct condrv_input_info_params *params = in_data;




More information about the wine-cvs mailing list