Seeking a method to "read" a DOS directory

Jeffrey William Gillette jwg at duke.cs.duke.edu
Mon Mar 28 12:37:57 AEST 1988


[]

	Actually, reading a DOS directory is a bit more involved than
simply setting up a set of Find First / Find Next calls (int 21h, AH =
4Eh / 4Fh).

	Whoever set up the Find First / Find Next interface (perhaps a
disgruntled employee in his last week at Microsoft :-) decided that the
logical portion of memory to exchange directory information was the Disk
Transfer Area (DTA - starts out as bytes 80h - FFh in the Program Segment
Prefix).  Since your compiler may well change the location of the DTA, you
will need to get the current Disk Transfer Address (int 21h, AH = 2Fh) and
declare a data structure like "FCB far *fcb = dta_address".  FCB is the
File Control Block which DOS will set up, but expects *you* to keep track
of!

	If you intend to do any disk activity while searching the
directory, you will need to assume responsibility for the integrity of
the FCB buffer.  You will need either to preserve a copy of the FCB after
each Find First / Find Next call (and place a current image of the FCB in
the DTA immediately before the next call), or you will need to change the
DTA temporarily every time you make a Find First / Find Next call.

	N.B.  Perhaps this mess is the reason Microsoft didn't bother 
including a reasonable directory search routine in Windows 1.x.  Given
the obvious dangers in playing with the Disk Transfer Address in a quasi-
multitasking environment, I sent a TAR to Microsoft.  The response translated
to, "We're going to bury our heads in the sand until the problem goes away, 
or until we can't ignore it any longer."

Peace,

Jeff

Jeffrey William Gillette	uucp:   jwg at duke.edu
Duke University                 bitnet: DYBBUK at TUCCVM



	

-- 
Jeffrey William Gillette	uucp:   jwg at duke.edu
Duke University                 bitnet: DYBBUK at TUCCVM



More information about the Comp.sys.att mailing list