Commit dc672b49 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Introduce IOCTL_CONDRV_GET_INPUT_INFO ioctl.

parent e5493e34
/*
* Console driver ioctls
*
* Copyright 2020 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _INC_CONDRV
#define _INC_CONDRV
#include "winioctl.h"
/* console input ioctls */
#define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_READ_PROPERTIES)
/* IOCTL_CONDRV_GET_INPUT_INFO result */
struct condrv_input_info
{
unsigned int input_count; /* number of available input records */
};
#endif /* _INC_CONDRV */
......@@ -38,6 +38,7 @@
#include "unicode.h"
#include "wincon.h"
#include "winternl.h"
#include "wine/condrv.h"
struct screen_buffer;
struct console_input_events;
......@@ -200,6 +201,7 @@ static const struct object_ops screen_buffer_ops =
};
static enum server_fd_type console_get_fd_type( struct fd *fd );
static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_fd_ops =
{
......@@ -211,7 +213,7 @@ static const struct fd_ops console_fd_ops =
no_fd_flush, /* flush */
no_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
console_ioctl, /* ioctl */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
......@@ -1487,6 +1489,30 @@ static void scroll_console_output( struct screen_buffer *screen_buffer, int xsrc
console_input_events_append( screen_buffer->input, &evt );
}
static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
{
struct console_input *console = get_fd_user( fd );
switch (code)
{
case IOCTL_CONDRV_GET_INPUT_INFO:
{
struct condrv_input_info info;
if (get_reply_max_size() != sizeof(info))
{
set_error( STATUS_INVALID_PARAMETER );
return 0;
}
info.input_count = console->recnum;
return set_reply_data( &info, sizeof(info) ) != NULL;
}
default:
set_error( STATUS_INVALID_HANDLE );
return 0;
}
}
static struct object_type *console_device_get_type( struct object *obj )
{
static const WCHAR name[] = {'D','e','v','i','c','e'};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment