Commit afadda8f authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

kernel32: Handle STD_*_HANDLE in GetFileType.

parent 52bc06af
......@@ -817,6 +817,10 @@ DWORD WINAPI GetFileType( HANDLE hFile )
IO_STATUS_BLOCK io;
NTSTATUS status;
if (hFile == (HANDLE)STD_INPUT_HANDLE || hFile == (HANDLE)STD_OUTPUT_HANDLE
|| hFile == (HANDLE)STD_ERROR_HANDLE)
hFile = GetStdHandle((DWORD_PTR)hFile);
if (is_console_handle( hFile )) return FILE_TYPE_CHAR;
status = NtQueryVolumeInformationFile( hFile, &io, &info, sizeof(info), FileFsDeviceInformation );
......
......@@ -2686,7 +2686,7 @@ static void test_MapFile(void)
static void test_GetFileType(void)
{
DWORD type;
DWORD type, type2;
HANDLE h = CreateFileA( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 );
ok( h != INVALID_HANDLE_VALUE, "open %s failed\n", filename );
type = GetFileType(h);
......@@ -2698,6 +2698,11 @@ static void test_GetFileType(void)
ok( type == FILE_TYPE_CHAR, "expected type char for nul got %d\n", type );
CloseHandle( h );
DeleteFileA( filename );
h = GetStdHandle( STD_OUTPUT_HANDLE );
ok( h != INVALID_HANDLE_VALUE, "GetStdHandle failed\n" );
type = GetFileType( (HANDLE)STD_OUTPUT_HANDLE );
type2 = GetFileType( h );
ok(type == type2, "expected type %d for STD_OUTPUT_HANDLE got %d\n", type2, type);
}
static int completion_count;
......
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