-- v2: conhost: Start input thread for GetNumberOfConsoleInputEvents.
From: Piotr Caban piotr@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56697 --- dlls/kernelbase/console.c | 7 ++----- include/wine/condrv.h | 2 +- programs/conhost/conhost.c | 12 +++++++++++- 3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 4209d2e6991..10c8bb25037 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -1203,11 +1203,8 @@ COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize( HANDLE handle ) */ BOOL WINAPI DECLSPEC_HOTPATCH GetNumberOfConsoleInputEvents( HANDLE handle, DWORD *count ) { - struct condrv_input_info info; - if (!console_ioctl( handle, IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL )) - return FALSE; - *count = info.input_count; - return TRUE; + return console_ioctl( handle, IOCTL_CONDRV_GET_INPUT_COUNT, NULL, 0, + count, sizeof(*count), NULL ); }
diff --git a/include/wine/condrv.h b/include/wine/condrv.h index 51534720444..72e9262fdab 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -45,6 +45,7 @@ #define IOCTL_CONDRV_GET_WINDOW CTL_CODE(FILE_DEVICE_CONSOLE, 22, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_CONDRV_GET_PROCESS_LIST CTL_CODE(FILE_DEVICE_CONSOLE, 23, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_CONDRV_READ_CONSOLE_CONTROL CTL_CODE(FILE_DEVICE_CONSOLE, 24, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_CONDRV_GET_INPUT_COUNT CTL_CODE(FILE_DEVICE_CONSOLE, 25, METHOD_BUFFERED, FILE_READ_ACCESS)
/* console output ioctls */ #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS) @@ -89,7 +90,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 */ };
/* IOCTL_CONDRV_SET_INPUT_INFO params */ diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 7610cb69c72..708696100d0 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -2694,7 +2694,17 @@ 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->input_count = console->record_count; + return STATUS_SUCCESS; + } + + case IOCTL_CONDRV_GET_INPUT_COUNT: + { + DWORD *count; + TRACE( "get input count\n" ); + if (in_size || *out_size != sizeof(*count)) return STATUS_INVALID_PARAMETER; + ensure_tty_input_thread( console ); + if (!(count = alloc_ioctl_buffer( sizeof(*count )))) return STATUS_NO_MEMORY; + *count = console->record_count; return STATUS_SUCCESS; }
On Tue Oct 15 17:51:17 2024 +0000, Piotr Caban wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/6676/diffs?diff_id=138204&start_sha=3c24975b78c6072260e921a4a9738035a3fa3bd3#d1f6ceee9c59eda45dd9dd99f99c894449cab85d_2694_2694)
I've pushed a version that adds IOCTL_CONDRV_GET_INPUT_COUNT ioctl.