kernelbase: Use FileFsDeviceInformation for console handles in GetFileType.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-11-27 18:14:22 +01:00 committed by Alexandre Julliard
parent 2a132a1839
commit cbca9f847f
2 changed files with 7 additions and 3 deletions

View file

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

View file

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