Jacek Caban : server: Introduce IOCTL_CONDRV_GET_INPUT_INFO ioctl.
Alexandre Julliard
julliard at winehq.org
Mon Jul 6 16:20:46 CDT 2020
Module: wine
Branch: master
Commit: dc672b49ca887c78a3e20854d96e7a56e967c072
URL: https://source.winehq.org/git/wine.git/?a=commit;h=dc672b49ca887c78a3e20854d96e7a56e967c072
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Jul 6 19:26:56 2020 +0200
server: Introduce IOCTL_CONDRV_GET_INPUT_INFO ioctl.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
include/wine/condrv.h | 35 +++++++++++++++++++++++++++++++++++
server/console.c | 28 +++++++++++++++++++++++++++-
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/include/wine/condrv.h b/include/wine/condrv.h
new file mode 100644
index 0000000000..dc1250a43f
--- /dev/null
+++ b/include/wine/condrv.h
@@ -0,0 +1,35 @@
+/*
+ * 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 */
diff --git a/server/console.c b/server/console.c
index fc12a3a8f3..8902943776 100644
--- a/server/console.c
+++ b/server/console.c
@@ -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'};
More information about the wine-cvs
mailing list