Note: This API call is for DOS and Win16 personality only. Use Family API for portability.

Int 21H, AH=11H

Version

1 and higher

Brief

FIND FIRST MATCHING FILE USING FCB

Family API

DosFindFirst

Input

AH = 11h
DS:DX -> unopened FCB (see #01345), may contain '?' wildcards

Return

AL = status
00h successful
[DTA] unopened FCB for first matching file
FFh no matching filename, or bad FCB

Notes

the type of the returned FCB depends on whether the input FCB was a

normal or an extended FCB
the data returned in the DTA (disk transfer area) is actually the
drive number (or extended FCB header and drive number) followed by
the file's directory entry (see #01352); this format happens to be
compatible with an unopened FCB
for extended FCBs with search attribute 08h, the volume label (if any)
will be returned even if the current directory is not the root dir.
DOS 3.0+ also allows the '*' wildcard
the search FCB at DS:DX must not be modified if AH=12h will be used to
continue searching; DOS 3.3 has set the following parts of the FCB:
0Ch BYTE ???
0Dh WORD directory entry number of matching file
0Fh WORD cluster number of current directory
11h 4 BYTEs ???
15h BYTE drive number (1=A:)
this function is used by many copy protection schemes to obtain the
starting cluster of a file

BUG: under Windows95, if a .EXE program (“MZ” header) rather than a true

.COM calls this function from a DOS box, the ten bytes of the
directory entry from 0Ch to 15h may be filled with zeros rather than
the additional file times

Format of DOS directory entry: Offset Size Description (Table 01352) 00h 8 BYTEs blank-padded filename

first character is set to E5h for deleted files (05h for
pending delete files under Novell DOS / OpenDOS)

08h 3 BYTEs blank-padded file extension 0Bh BYTE attributes 0Ch 10 BYTEs (MS-DOS 1.0-6.22) reserved

(DR DOS) used to store file password / owner (see #01354)
(see also INT 21/AX=4302h)
(Novell DOS 7) DELWATCH data (see #01354)
(MS-DOS 7/Windows95) additional file times (see #01353)

16h WORD time of creation or last update (see #01665 at AX=5700h) 18h WORD date of creation or last update (see #01666 at AX=5700h) 1Ah WORD starting cluster number (see also AX=440Dh/CX=0871h)

(may not be set in INT 21/AH=11h return data for FAT32 drives)

1Ch DWORD file size SeeAlso: #01355,#02628,#02629

Format of MS-DOS 7/Windows95 additional file times: Offset Size Description (Table 01353) 00h BYTE reserved 01h BYTE 10-millisecond units past creation time below 02h WORD file creation time 04h WORD file creation date 06h WORD last-access date 08h WORD (FAT32) high word of starting cluster number Note: this data is stored beginning at offset 0Ch in a standard directory

entry

SeeAlso: #01352

Format of DR DOS 6/Novell DOS 7 additional file information: Offset Size Description (Table 01354) 0Ch BYTE reserved (00h)

(DOSPLUS v1.2) user-defined attributes for CP/M compatibility
(bit 7 = F1,...,bit 4 = F4, bits 3-0 reserved (0))

0Dh BYTE first character of original filename for deleted file 0Eh WORD encrypted file/directory password 10h WORD reserved (00h)

(Novell DOS 7 DELWATCH) original file time
cleared when file is undeleted or purged

12h WORD (DR DOS 6) file owner ID

(Novell DOS 7 DELWATCH) original file date
cleared when file is undeleted or purged

14h WORD single/multiuser file/directory access rights (see AX=4302h) —deleted files— 16h WORD (Novell DOS 7 DELWATCH) time of deletion 18h WORD (Novell DOS 7 DELWATCH) date of deletion Note: offsets are within the full directory entry SeeAlso: #01352

Format of MS-DOS 7/Windows95 long-filename directory entry: Offset Size Description (Table 01355) 00h BYTE LFN record sequence and flags

bits 5-0: sequence number
bit 6: set if last long-filename record for file
bit 7: set if file deleted

01h 10 BYTEs long filename, first part 0Bh BYTE 0Fh (otherwise impossible file attribute, used as signature) 0Ch BYTE reserved??? (00h) 0Dh BYTE checksum for short filename 0Eh 12 BYTEs long filename, second part 1Ah WORD first cluster number (always 0000h for LFN records) 1Ch 4 BYTEs long filename, third part Notes: long-filename entries are always stored in the directory just prior

to the short-name entry for a file
multiple LFN records are used if the long filename does not fit into
a single record
the short-filename checksum byte is computed by adding up the
eleven bytes of the short filename, rotating the intermediate
sum right one bit before adding the next character
the long filename is encoded as 16-bit Unicode characters; for most
filenames, this appears in the directory as the ASCII character
followed by 00h

SeeAlso: #01352,INT 21/AX=5704h,INT 21/AH=71h

See also

SeeAlso: AH=12h,AH=1Ah,AH=4Eh,INT 2F/AX=111Bh

Note

Text based on Ralf Brown Interrupt List Release 61

DOS API
Process manager	INT 20H, INT 21H: 00H, 25H, 26H, 31H, 34H, 35H, 4BH, 4CH, 4DH, 50H, 51H, 52H, 55H, 62H, INT 22H, INT 27H, INT 28H
File manager	INT 25H, INT 26H, INT 21H: 0DH, 0EH, 0FH, 10H, 11H, 12H, 13H, 14H, 15H, 16H, 17H, 19H, 1AH, 1BH, 1CH, 21H, 22H, 23H, 24H, 27H, 28H, 29H, 2EH, 2FH, 32H, 3305H, 36H, 39H, 3AH, 3BH, 3CH, 3DH, 3EH, 3FH, 40H, 41H, 42H, 4300H, 4301H, 45H, 45H, 46H, 4EH, 4FH, 54H, 56H, 5700H, 5701H, 5AH, 5BH, 5c00H, 5c01H, 60H, 67H, 68H, 6900H, 6901H, 6AH, 6CH
Character Device I/O	INT 29H, INT 21H: 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H, 0AH, 0BH, 0AH, 0CH, 5D07H, 5D08H, 5D09H, 5D0AH
Signals	INT 23H, INT 24H, INT 21H: 3300H, 3301H, 3302H
Memory manager	INT 21H: 48H, 49H, 4AH, 5800H, 5801H, 5802H, 5803H
Date and Time	INT 21H: 2AH, 2BH, 2CH, 2DH
Misc	INT 21H: 30H, 3306H, 3700H, 3701H, 3702H, 3703H, 59H
NLS	INT 21H: 3303H, 3304H, 3800H, 3801H, 6300H, 6301H, 6301H, 6500H, 6501H, 6502H, 6503H, 6504H, 6505H, 6506H, 6507H, 6520H, 6521H, 6522H, 6523H, 65A0H, 65A1H, 65A2H, 6601H, 6602H
Devices	INT 21H: 4400H, 4401H, 4402H, 4403H, 4404H, 4405H, 4406H, 4407H, 4408H, 4409H, 440AH, 440BH, 440CH, 440DH, 440EH, 440FH, 4410H, 4411H, 53H
Network	INT 21H: 5E00H, 5E01H, 5E02H, 5E03H, 5E04H, 5E05H, 5F00H, 5F01H, 5F02H, 5F03H, 5F04H, 5F05H, 5F07H, 5F08H
osFree Macro Library
Video I/O	@SetMode @SetCurSz @SetCurPos @GetCur @SetPage @ScrollUp @ScrollDn @Scroll @GetChAtr @PutChAtr @PutCh @SetPalet @SetColor @SetDot @GetDot @WrtTTY @VideoState @GetMode @GetDisplay @GetVideoState @GetEGAInfo @Cls
Hardware info	@Equipment @MemSize
Serial I/O	@AuxInit @AuxSendChar @AuxRecieveChar @AuxStatus
Tape I/O	@TapeOn @TapeOff @TapeRead @TapeWrite
Keyboard I/O	@KbdStatus @CharIn @CharPeek
Printer I/O	@PrnPrint @PrnInit @PrnStatus
Disk I/O	@DskReset @DskStatus @DskRead @DskWrite @DskVerify @DskFormat
Date and Time	@SetTime @GetTime
Mouse	@MouInit @MouShowPointer @MouStatus @MouSetPos @MouSetMickey @MouRegion
Memory manager	@ModBlok SET_BLOCK
Family API
DOS	Process Manager	DosBeep DosExit DosSleep DosExecPgm
File Manager	DosChDir DosChgFilePtr DosClose DosDelete DosDupHandle DosMkDir DosMove DosQCurDir DosQCurDisk DosSetFileMode DosOpen DosQFileInfo DosRead DosQFileMode DosQFSInfo DosQVerify DosRmDir DosSelectDisk DosFindClose DosFindFirst DosFindNext DosSetFileInfo DosSetVerify DosWrite DosFileLocks DosSetFHandState DosNewSize DosBufReset DosQFHandState DosSetFSinfo DosShutdown
Memory Manager	DosFreeSeg DosSubAlloc DosSubFree DosSubSet DosAllocHuge DosAllocSeg DosReallocHuge DosReallocSeg DosGetHugeShift DosCreateCSAlias
NLS	DosCaseMap DosGetCtryInfo DosGetDBCSEv DosSetCtryCode DosGetCollate DosGetMessage DosInsMessage DosPutMessage
Date and Time	DosSetDateTime DosGetDateTime
Devices	DosDevConfig DosDevIOCtl DosDevIOCtl2
Signals	DosHoldSignal DosSetSigHandler
Misc	BadDynLink DosGetEnv DosGetMachineMode DosGetVersion DosError DosErrClass DosSetVec
KBD	KbdCharIn KbdFlushBuffer KbdGetStatus KbdSetStatus KbdStringIn KbdPeek
VIO	VioGetBuf VioGetConfig VioGetCurPos VioGetCurType VioGetPhysBuf VioReadCellStr VioReadCharStr VioScrollUp VioScrollDn VioScrollLf VioScrollRt VioScrUnLock VioSetCurPos VioSetCurType VioSetMode VioGetMode VioShowBuf VioWrtCellStr VioWrtCharStr VioWrtCharStrAtt VioWrtNAttr VioWrtNCell VioWrtNChar VioWrtTTY VioScrLock VioPopUp
Tools	BIND
Modules	DOSCALLS.DLL VIOCALLS.DLL KBDCALLS.DLL MSG.DLL
Libraries	API.LIB OS2386.LIB FAPI.LIB DOSCALLS.LIB SUBCALLS.LIB