From 6d5827e7ce20b9ab7e40c0fc5b07e2ac66e73957 Mon Sep 17 00:00:00 2001 From: "E. C. Masloch" Date: Thu, 8 Oct 2026 22:40:27 +0200 Subject: [PATCH] add and update 21.4400, 21.4401, MS-DOS v4 Handle_Fail_I24 Reference: https://github.com/FDOS/kernel/issues/266 Reference: https://github.com/dosemu2/dosemu2/issues/3149 --- ...400 DOS 2 IOCTL GET DEVICE INFORMATION.txt | 25 ++++++++++++++----- ...401 DOS 2 IOCTL SET DEVICE INFORMATION.txt | 19 +++++++++++--- ...S 2 internal SYSVARS GET LIST OF LISTS.txt | 1 + 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/source/Interrupt List/INT 21 DOS Function Calls/INT 214400 DOS 2 IOCTL GET DEVICE INFORMATION.txt b/source/Interrupt List/INT 21 DOS Function Calls/INT 214400 DOS 2 IOCTL GET DEVICE INFORMATION.txt index b874c25ef..1d43d7def 100644 --- a/source/Interrupt List/INT 21 DOS Function Calls/INT 214400 DOS 2 IOCTL GET DEVICE INFORMATION.txt +++ b/source/Interrupt List/INT 21 DOS Function Calls/INT 214400 DOS 2 IOCTL GET DEVICE INFORMATION.txt @@ -9,11 +9,13 @@ INT 21 - DOS 2+ - IOCTL - GET DEVICE INFORMATION BX = handle Return: CF clear if successful DX = device information word (see #01423) - AX destroyed + AX destroyed (= DX in MS-DOS v4.00, v4.01, v5, v7.10) CF set on error AX = error code (01h,05h,06h) (see #01680 at AH=59h/BX=0000h) Notes: value in DH corresponds to high byte of device driver's attribute word - if handle refers to a character device + if handle refers to a character device. + DH appears to be all-zeroes if handle refers to a disk file, at least + on MS-DOS v4.00, v4.01, v5, and v7.10 Novell NetWare reportedly does not return a drive number in bits 5-0 for a disk file this function was not supported by Digital Research's DOS Plus @@ -22,6 +24,7 @@ SeeAlso: AX=4401h,INT 2F/AX=122Bh Bitfields for device information word: Bit(s) Description (Table 01423) character device + 15 set (indicates that a device is a character device) 14 device driver can process IOCTL requests (see AX=4402h"DOS 2+") 13 output until busy supported 11 driver supports OPEN/CLOSE calls @@ -34,14 +37,24 @@ Bit(s) Description (Table 01423) 2 NUL device 1 standard output 0 standard input - disk file + disk file (internal, not returned(?) by function AX=4400h) 15 file is remote (DOS 3.0+) 14 don't set file date/time on closing (DOS 3.0+) 11 media not removable - 8 (DOS 4 only) generate INT 24 if no disk space on write or read past - end of file + 8 (DOS 4 only) generate INT 24 if no disk space on write disk full + or read past end of file, equate is called "Handle_Fail_I24" + disk file (returned by function AX=4400h) 7 clear (indicates file) 6 file has not been written 5-0 drive number (0 = A:) +Notes: bit 8 can be set on MS-DOS v4, both for disk files or character + devices, using AX=4401h but it apparently cannot be reset + using any system call. + bit 8 seen set with no AX=4401h call on dosemu2 mfs redirector. + this is considered a bug in dosemu2, reported on 2026-10-08 on + a change added 2019-10-16. + bit 8 is never returned from the SFT entry on AX=4400h. for disk + files, DH is always all-zeroes. for character devices, DH is + always set from the device header's attributes, not the SFT. + tested on MS-DOS v4.00, v4.01, v5, v7.10 as yet. SeeAlso: INT 29 - diff --git a/source/Interrupt List/INT 21 DOS Function Calls/INT 214401 DOS 2 IOCTL SET DEVICE INFORMATION.txt b/source/Interrupt List/INT 21 DOS Function Calls/INT 214401 DOS 2 IOCTL SET DEVICE INFORMATION.txt index a6e6f3b85..636a818d3 100644 --- a/source/Interrupt List/INT 21 DOS Function Calls/INT 214401 DOS 2 IOCTL SET DEVICE INFORMATION.txt +++ b/source/Interrupt List/INT 21 DOS Function Calls/INT 214401 DOS 2 IOCTL SET DEVICE INFORMATION.txt @@ -6,12 +6,25 @@ INT 21 - DOS 2+ - IOCTL - SET DEVICE INFORMATION AX = 4401h - BX = handle (must refer to character device) + BX = handle (must refer to character device on MS-DOS v5 and v7.10) DX = device information word (see #01423) - (DH must be zero for DOS version prior to 6.x) + (DH must be zero for MS-DOS v5 and v7.10 at least) + (DH may be zero or one for MS-DOS v4.00 and v4.01) Return: CF clear if successful + (undocumented) AL = prior SFT flags low byte CF set on error AX = error code (01h,05h,06h,0Dh) (see #01680 at AH=59h/BX=0000h) Notes: this function was not supported by Digital Research's DOS Plus + calling this function on character devices will set the SFT flags + low byte to whatever was passed in DL, except that bit 7 is always + forced set so the SFT entry remains marked as a character device. + on MS-DOS v4.00 and v4.01, the handle may refer to either a disk + file or a character device. disk files only use the low bit of DH, + which can set "Handle_Fail_I24", ignoring what was passed in DL. + for character devices, the low bit of DH can be set to set the + "Handle_Fail_I24" flag. there's no way to clear "Handle_Fail_I24". + errors are checked as follows: error 06h if invalid handle, then + error 0Dh if invalid bits set in DH, then error 01h if on MS-DOS + v5 or v7.10 and a disk file handle was passed. SeeAlso: AX=4400h,INT 2F/AX=122Bh - + diff --git a/source/Interrupt List/INT 21 DOS Function Calls/INT 2152 DOS 2 internal SYSVARS GET LIST OF LISTS.txt b/source/Interrupt List/INT 21 DOS Function Calls/INT 2152 DOS 2 internal SYSVARS GET LIST OF LISTS.txt index b2a3a70a4..d9c6bc124 100644 --- a/source/Interrupt List/INT 21 DOS Function Calls/INT 2152 DOS 2 internal SYSVARS GET LIST OF LISTS.txt +++ b/source/Interrupt List/INT 21 DOS Function Calls/INT 2152 DOS 2 internal SYSVARS GET LIST OF LISTS.txt @@ -596,6 +596,7 @@ Offset Size Description (Table 01642) bit 13 set if named pipe bit 12 set if no inherit bit 11 set if network spooler + bit 8 "Handle_Fail_I24", MS-DOS v4 AX=4401h can set bit 7 set if device, clear if file (only if local) bits 6-0 as for AX=4400h 07h DWORD pointer to device driver header if character device