From bca3ec21758ca9016aa4fb6f09f00e7f3da42782 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 9 Nov 2002 19:34:04 +0000 Subject: [PATCH] * Hopefully innocent hack to deal with NDN in ioctl.c (ignore upper bits of the drive number) * use subst bit 15 for int21/ax=4409. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@463 6ac86273-5f31-0410-b378-82cca8765d1b --- hdr/device.h | 1 + kernel/ioctl.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/hdr/device.h b/hdr/device.h index 022d33f..6a5e763 100644 --- a/hdr/device.h +++ b/hdr/device.h @@ -131,6 +131,7 @@ struct dhdr { BYTE dh_name[8]; }; +#define ATTR_SUBST 0x8000 #define ATTR_CHAR 0x8000 #define ATTR_IOCTL 0x4000 #define ATTR_BLDFAT 0x2000 diff --git a/kernel/ioctl.c b/kernel/ioctl.c index 1a68c62..c4937e4 100644 --- a/kernel/ioctl.c +++ b/kernel/ioctl.c @@ -199,7 +199,14 @@ COUNT DosDevIOctl(lregs * r) /* JPP - changed to use default drive if drive=0 */ /* JT Fixed it */ +#define NDN_HACK +/* NDN feeds the actual ASCII drive letter to this function */ +#ifdef NDN_HACK + CharReqHdr.r_unit = ((r->BL & 0x1f) == 0 ? default_drive : + (r->BL & 0x1f) - 1); +#else CharReqHdr.r_unit = (r->BL == 0 ? default_drive : r->BL - 1); +#endif dpbp = get_dpb(CharReqHdr.r_unit); @@ -223,10 +230,12 @@ COUNT DosDevIOctl(lregs * r) } return DE_INVLDFUNC; case 0x09: - if (get_cds(CharReqHdr.r_unit) != NULL && dpbp == NULL) + { + struct cds FAR *cdsp = get_cds(CharReqHdr.r_unit); + r->AX = S_DONE | S_BUSY; + if (cdsp != NULL && dpbp == NULL) { r->DX = ATTR_REMOTE; - r->AX = S_DONE | S_BUSY; } else { @@ -234,11 +243,14 @@ COUNT DosDevIOctl(lregs * r) { return DE_INVLDDRV; } -/* Need to add subst bit 15 */ r->DX = dpbp->dpb_device->dh_attr; - r->AX = S_DONE | S_BUSY; + } + if (cdsp->cdsFlags & CDSSUBST) + { + r->DX |= ATTR_SUBST; } break; + } case 0x0d: nMode = C_GENIOCTL; goto IoBlockCommon;