ID Number: Q32736
2.x 3.x 4.00 4.00a 4.01 4.01a 5.00
MS-DOS
Summary:
SYMPTOMS
Given a file handle number for an open file handle, there is no way
to get the file specification (the filename) of this open file
handle.
CAUSE
Normally, this information is not needed, since there are usually
two situations in which an application has a file handle. The most
common one is that it has opened the file itself; in this case, the
application should have the filename already and should not forget
it. If it inherited this file from a parent process, it should not
need to know what the filename is, since the application is in the
process of redirection, and should "trust" its parent process in
its choice of input and output files.
RESOLUTION
One workaround for this problem is to have an interrupt service
routine (ISR) trap the MS-DOS system service for opening a file
(interrupt 21h service 3Dh) and store the filename information,
along with the PSP (process ID) of the process that opened it.
Then, this ISR could in turn allocate one of the user-definable
interrupts (60h through 67h). Given a process ID and a handle
number, it could conceivably return the actual filename. However,
this would be difficult to write, since it would be very hard for
the ISR to determine which process owned the file.
Additional reference words: 2.x 3.x 4.00 4.00a 4.01 4.01a 5.00