The DOS device/file-handle table (Internal)
The DOS-handle table(s) contains information about open-files
and devices. The format is (a least in DOS 3.30):
Offset Size Contens
──────────────────────────────────────────────────────────────
00-03 DWord Pointer to next table (0000FFFF if last)
04-05 Word Number of entries in table
06- Entryes (see below)
DOS device/file-handle table (single entry)
Offset Size Contens
──────────────────────────────────────────────────────────────
00-01 Word Number of file handles, using this entry
02-03 Word File open-mode (specified in AL when the file
is opened by INT 21h, 3Dh).
04 Byte File attribute (specified by CREATE or CHMOD).
05-06 Word Handle flags/drive
0-5: Drive (A=0, B=1 etc.)
6: 0=Handle must be flushed before closing
(there has been written to the file).
7: 1=Character device, 0=Block device
8-B: Unknown (always zero)
C: 1 if handle is owned by current process
D-F: Unknown (always zero)
07-0A DWord Address of device-driver used by this handle
0B-0C Word First cluster in file
0D-0E Word File time in packed format
0F-10 Word File date in packed format
11-14 DWord Current file length
15-18 DWord Current address of read/write pointer
19-1A Word Number of clusters owned by handle
1B-1C Word Current cluster
1D-1E Word Sector containing directory entry (Note: for some
reason DOS uses the sector-number here and not the
cluster number. I expect this to change with
DOS 4.x).
1F Byte Directory-entry-number in sector (see above).
20-27 Bytes File/device name
28-2A Bytes File/device extension
2B-30 Unknown (always zero)
31-32 Word Segment of owners PSP
33-34 Unknown (always zero)