OPENFILES - Unit to show list of open files.
Written by D.J. Murdoch for the public domain.
This unit interfaces three routines, which look in the
(undocumented) DOS list of open files for the filenames. One
routine prints a list of open files, another returns the list in a
collection of strings, and the third calls a user routine once for
each open file. If compiled for DOS, it automatically installs an
exit handler to call the print routine, so if your program bombs
because it runs out of file handles, you'll see the list of what's
open.
Not all versions of TP support collections of strings, and not all
users of those that do install the Objects unit, so I've added a
conditional compilation symbol "Collections" which can be used to
control the inclusion of the object-oriented code.
For details of parameters etc., see the source code OPENFILES.PAS or
the sample program TEST.PAS.
I've tested this unit in TP 6, BP 7 (all modes), TPW 1.5, MSDOS 3.2,
4.01, 5 and 6; it should work in the other DOS versions from 2 to 6,
but I'd like to hear from you if it doesn't.
Fidonet: DJ Murdoch at 1:249/99.5
Internet: dmurdoch@mast.queensu.ca
CIS: 71631,122
History:
1. 21 Oct 91 - First release to PDN echo.
2. 26 Oct 91 - Added check of PSP segment, and DOS 3.0 record
format. Set Allfiles to true to get previous
behaviour.
3. 24 Jun 93 - Added DOS 6 and DPMI support
4. 24 Aug 94 - Added BP 7 Windows support, a bit more flexibility
in ways to call
5. 29 Aug 94 - Added conditional Collections, added PSPseg to
information passed to for_each_open_file action
routine.
Thanks are due to Berend de Boer for a series of articles explaining
how to make real mode interrupt calls from protected mode. His
hints let me add the DPMI support.
|