kernel32: Handle STD_*_HANDLE in GetFileType.

This commit is contained in:
Piotr Caban 2014-02-07 15:40:06 +01:00 committed by Alexandre Julliard
parent 52bc06af7b
commit afadda8ff7
2 changed files with 10 additions and 1 deletions

View File

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

View File

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