conhost: Use dedicated ioctl for GetConsoleWindow.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-08-17 12:29:09 +02:00 committed by Alexandre Julliard
parent 3057388ff8
commit 365e99c022
3 changed files with 14 additions and 5 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;