Xref: utzoo comp.sys.att:2877 comp.sys.misc:1308 Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!duke!jwg From: jwg@duke.cs.duke.edu (Jeffrey William Gillette) Newsgroups: comp.sys.att,comp.sys.misc Subject: Re: Seeking a method to "read" a DOS directory Message-ID: <11422@duke.cs.duke.edu> Date: 28 Mar 88 02:37:57 GMT References: <902@cblpe.ATT.COM> <1001@mcgill-vision.UUCP> Reply-To: jwg@duke.UUCP (Jeffrey William Gillette) Organization: Duke University Lines: 44 Posted: Sun Mar 27 21:37:57 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