Module: wine Branch: master Commit: cbca9f847f60773b4e7e5408f6a079f4896c5c1e URL: https://source.winehq.org/git/wine.git/?a=commit;h=cbca9f847f60773b4e7e5408f...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Nov 27 18:14:22 2020 +0100
kernelbase: Use FileFsDeviceInformation for console handles in GetFileType.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/tests/console.c | 7 ++++++- dlls/kernelbase/file.c | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index ea6af85c15a..cab036243dc 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3777,7 +3777,7 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) static void test_FreeConsole(void) { HANDLE handle, unbound_output = NULL, unbound_input = NULL; - DWORD size, mode; + DWORD size, mode, type; WCHAR title[16]; char buf[32]; HWND hwnd; @@ -3889,6 +3889,11 @@ static void test_FreeConsole(void) ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "GetConsoleMode returned %x %u\n", ret, GetLastError());
+ type = GetFileType(unbound_input); + ok(type == FILE_TYPE_CHAR, "GetFileType returned %u\n", type); + type = GetFileType(unbound_output); + ok(type == FILE_TYPE_CHAR, "GetFileType returned %u\n", type); + CloseHandle(unbound_input); CloseHandle(unbound_output); } diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index bfa44b4da50..7d0c4d63aa8 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -3099,8 +3099,6 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetFileType( HANDLE file ) file == (HANDLE)STD_ERROR_HANDLE) file = GetStdHandle( (DWORD_PTR)file );
- if (is_console_handle( file )) return FILE_TYPE_CHAR; - if (!set_ntstatus( NtQueryVolumeInformationFile( file, &io, &info, sizeof(info), FileFsDeviceInformation ))) return FILE_TYPE_UNKNOWN; @@ -3108,6 +3106,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetFileType( HANDLE file ) switch (info.DeviceType) { case FILE_DEVICE_NULL: + case FILE_DEVICE_CONSOLE: case FILE_DEVICE_SERIAL_PORT: case FILE_DEVICE_PARALLEL_PORT: case FILE_DEVICE_TAPE: