winedos fix: get device data
Rein Klazes
wijn at wanadoo.nl
Thu Jan 13 05:44:34 CST 2005
Hi,
This fixes LHA.EXE (archiver for LZH files), used by an installer of an
old windows program, SeedMaster.
Changelog:
dlls/winedos : int21.c
In int21_ioctl - get device data-, set the "is console" bits if
the device handle is a tty or a proper console io handle.
Rein.
-------------- next part --------------
--- wine/dlls/winedos/int21.c 2004-12-29 12:10:32.000000000 +0100
+++ mywine/dlls/winedos/int21.c 2005-01-13 08:34:05.000000000 +0100
@@ -2731,27 +2731,34 @@ static void INT21_Ioctl_Char( CONTEXT86
{
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 +2767,7 @@ static void INT21_Ioctl_Char( CONTEXT86
{
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 +2781,10 @@ static void INT21_Ioctl_Char( CONTEXT86
* 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
{
More information about the wine-patches
mailing list