Int 21 Fn 4E - Dos 2+ - "findfirst" - Find First Matching File [D]
AH = 4Eh
AL = special flag for use by APPEND (refer to note below)
CX = file attribute mask (see #1107 at AX=4301h) (bits 0 and 5 ignored)
0088h (Novell DOS 7) find first deleted file
DS:DX -> ASCIZ file specification (may include path and wildcards)
Return: CF clear if successful
Disk Transfer Area filled with FindFirst data block (see #1312)
CF set on error
AX = error code (02h,03h,12h) (see #1366 at AH=59h/BX=0000h)
Notes: for search attributes other than 08h, all files with at MOST the
specified combination of hidden, system, and directory attributes
will be returned. Under DOS 2.x, searching for attribute 08h
(volume label) will also return normal files, while under DOS 3.0+
only the volume label (if any) will be returned.
this call also returns successfully if given the name of a character
device without wildcards. DOS 2.x returns attribute 00h, size 0,
and the current date and time. DOS 3.0+ returns attribute 40h and
the current date and time.
immediately after an INT 2F/AX=B711h (APPEND return found name), the
name at DS:DX will be overwritten; if AL=00h on entry, the actual
found pathname will be stored, otherwise, the actual found path
will be prepended to the original filespec without a path.
under LANtastic, this call may be used to obtain a list of a server's
shared resources by searching for "\\SERVER\*.*"; a list of printer
resources may be obtained by searching for "\\SERVER\@*.*"
under the FlashTek X-32 DOS extender, the filespec pointer is in DS:EDX
BUGS: under DOS 3.x and 4.x, the second and subsequent calls to this function
with a character device name (no wildcards) and search attributes
which include the volume-label bit (08h) will fail unless there is
an intervening DOS call which implicitly or explicity performs a
directory search without the volume-label bit. Such implicit
searches are performed by CREATE (AH=3Ch), OPEN (AH=3Dh), UNLINK
(AH=41h), and RENAME (AH=56h)
DR DOS 3.41 and 5.0 return the Directory attribute for the volume label
See Also: AH=11h,AH=4Fh,AX=4301h,AX=714Eh,AX=71A1h,AX=F257h/SF=02h
See Also: INT 2F/AX=111Bh,INT 2F/AX=B711h
Format of FindFirst data block:
Offset Size Description (Table 1312)
---PC-DOS 3.10, PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
00h BYTE drive letter (bits 0-6), remote if bit 7 set
01h 11 BYTEs search template
0Ch BYTE search attributes
---DOS 2.x (and some DOS 3.x???)---
00h BYTE search attributes
01h BYTE drive letter
02h 11 BYTEs search template
---WILDUNIX.COM---
00h 12 BYTEs 15-character wildcard search pattern and drive letter (packed)
0Ch BYTE search attributes
---DOS 2.x and most 3.x---
0Dh WORD entry count within directory
0Fh DWORD pointer to DTA???
13h WORD cluster number of start of parent directory
---PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
0Dh WORD entry count within directory
0Fh WORD cluster number of start of parent directory
11h 4 BYTEs reserved
---OS/2 MVDM---
00h WORD "OS2_BMP_handle"
02h WORD "OS2_LastEnt"
04h DWORD "OS2_Checksum"
08h BYTE "OS2_usi_flag"
09h DWORD used by DOS emulator for second pass for volume-label searches
0Dh WORD (ret) "DOS_LastEnt" entry count within directory
0Fh BYTE OS/2 Processed-FindFirst flag
00h FindFirst processed by DOS
42h FindFirst processed by OS/2
10h 5 BYTEs reserved for future use
---all versions, documented fields---
15h BYTE attribute of file found
16h WORD file time (see #1351 at AX=5700h)
18h WORD file date (see #1352 at AX=5700h)
1Ah DWORD file size
1Eh 13 BYTEs ASCIZ filename+extension