From b08f9581579536204b93d4c649ddd32652925437 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Fri, 14 Jan 2005 16:21:07 +0000 Subject: [PATCH] In int21_ioctl - get device data-, set the "is console" bits if the device handle is a tty or a proper console io handle. --- dlls/winedos/int21.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c index a487df6666f..c22af6b56f5 100644 --- a/dlls/winedos/int21.c +++ b/dlls/winedos/int21.c @@ -46,6 +46,7 @@ #include "wine/debug.h" #include "wine/exception.h" +BOOL WINAPI VerifyConsoleIoHandle(HANDLE); /* * Note: * - Most of the file related functions are wrong. NT's kernel32 @@ -2731,27 +2732,34 @@ static void INT21_Ioctl_Char( CONTEXT86 *context ) { struct stat st; int status, i, fd; + int IsConsoleIOHandle = 0; HANDLE handle = DosFileHandleToWin32Handle(BX_reg(context)); status = wine_server_handle_to_fd( handle, 0, &fd, NULL ); if (status) { - SET_AX( context, RtlNtStatusToDosError(status) ); - SET_CFLAG( context ); - return; - } - fstat( fd, &st ); - wine_server_release_fd( handle, fd ); - - for (i = 0; i < NB_MAGIC_DEVICES; i++) - { - if (!magic_devices[i].handle) continue; - if (magic_devices[i].dev == st.st_dev && magic_devices[i].ino == st.st_ino) - { - /* found it */ - magic_devices[i].ioctl_handler( context ); + if( VerifyConsoleIoHandle( handle)) + IsConsoleIOHandle = 1; + else { + SET_AX( context, RtlNtStatusToDosError(status) ); + SET_CFLAG( context ); return; } + } else { + fstat( fd, &st ); + IsConsoleIOHandle = isatty( fd); + wine_server_release_fd( handle, fd ); + for (i = 0; i < NB_MAGIC_DEVICES; i++) + { + if (!magic_devices[i].handle) continue; + if (magic_devices[i].dev == st.st_dev && + magic_devices[i].ino == st.st_ino) + { + /* found it */ + magic_devices[i].ioctl_handler( context ); + return; + } + } } /* no magic device found, do default handling */ @@ -2760,7 +2768,7 @@ static void INT21_Ioctl_Char( CONTEXT86 *context ) { case 0x00: /* GET DEVICE INFORMATION */ TRACE( "IOCTL - GET DEVICE INFORMATION - %d\n", BX_reg(context) ); - if (S_ISCHR(st.st_mode)) + if (IsConsoleIOHandle || S_ISCHR(st.st_mode)) { /* * Returns attribute word in DX: @@ -2774,10 +2782,10 @@ static void INT21_Ioctl_Char( CONTEXT86 *context ) * Bit 4 - Device is special (uses int29). * Bit 3 - Clock device. * Bit 2 - NUL device. - * Bit 1 - Standard output. - * Bit 0 - Standard input. + * Bit 1 - Console output device. + * Bit 0 - Console input device. */ - SET_DX( context, 0x80c0 /* FIXME */ ); + SET_DX( context, IsConsoleIOHandle ? 0x80c3 : 0x80c0 /* FIXME */ ); } else {