Jacek Caban : server: Properly handle NtQueryInformationFile on console handles.
Alexandre Julliard
julliard at winehq.org
Mon Nov 23 15:43:23 CST 2020
Module: wine
Branch: master
Commit: 382b2072e35e921e2697bfb3e54444cd97269e0a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=382b2072e35e921e2697bfb3e54444cd97269e0a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Nov 20 15:39:44 2020 +0100
server: Properly handle NtQueryInformationFile on console handles.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/console.c | 28 ++++++++++++++++++++++++++++
server/console.c | 10 ++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index a306a5144a3..5943213fb17 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3942,6 +3942,33 @@ static void test_console_title(void)
}
}
+static void test_file_info(HANDLE input, HANDLE output)
+{
+ FILE_STANDARD_INFORMATION std_info;
+ LARGE_INTEGER size;
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ BOOL ret;
+
+ if (skip_nt) return;
+
+ status = NtQueryInformationFile(input, &io, &std_info, sizeof(std_info), FileStandardInformation);
+ ok(status == STATUS_INVALID_DEVICE_REQUEST, "NtQueryInformationFile returned: %#x\n", status);
+
+ status = NtQueryInformationFile(output, &io, &std_info, sizeof(std_info), FileStandardInformation);
+ ok(status == STATUS_INVALID_DEVICE_REQUEST, "NtQueryInformationFile returned: %#x\n", status);
+
+ ret = GetFileSizeEx(input, &size);
+ todo_wine
+ ok(!ret && GetLastError() == ERROR_INVALID_FUNCTION,
+ "GetFileSizeEx returned %x(%u)\n", ret, GetLastError());
+
+ ret = GetFileSizeEx(output, &size);
+ todo_wine
+ ok(!ret && GetLastError() == ERROR_INVALID_FUNCTION,
+ "GetFileSizeEx returned %x(%u)\n", ret, GetLastError());
+}
+
static void test_AttachConsole_child(DWORD console_pid)
{
HANDLE pipe_in, pipe_out;
@@ -4479,6 +4506,7 @@ START_TEST(console)
}
test_GetConsoleScreenBufferInfoEx(hConOut);
test_SetConsoleScreenBufferInfoEx(hConOut);
+ test_file_info(hConIn, hConOut);
test_console_title();
if (!test_current)
{
diff --git a/server/console.c b/server/console.c
index 48f92dd66e6..cecd1455d60 100644
--- a/server/console.c
+++ b/server/console.c
@@ -98,6 +98,7 @@ static const struct object_ops console_input_ops =
};
static enum server_fd_type console_get_fd_type( struct fd *fd );
+static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos );
static int console_input_flush( struct fd *fd, struct async *async );
static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
@@ -110,7 +111,7 @@ static const struct fd_ops console_input_fd_ops =
console_input_read, /* read */
no_fd_write, /* write */
console_input_flush, /* flush */
- no_fd_get_file_info, /* get_file_info */
+ console_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
console_input_ioctl, /* ioctl */
default_fd_queue_async, /* queue_async */
@@ -248,7 +249,7 @@ static const struct fd_ops screen_buffer_fd_ops =
no_fd_read, /* read */
screen_buffer_write, /* write */
no_fd_flush, /* flush */
- no_fd_get_file_info, /* get_file_info */
+ console_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
screen_buffer_ioctl, /* ioctl */
default_fd_queue_async, /* queue_async */
@@ -420,6 +421,11 @@ static enum server_fd_type console_get_fd_type( struct fd *fd )
return FD_TYPE_CHAR;
}
+static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class )
+{
+ set_error( STATUS_INVALID_DEVICE_REQUEST );
+}
+
static struct object *create_console_input(void)
{
struct console_input *console_input;
More information about the wine-cvs
mailing list