🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #138

How to find out who has an open file?

#138
From: Steve Frampton
Date: Wed, 04 Nov 1992 03:32
29 lines
1867 bytes
Hi everyone:

I've got a rogue program who is opening a file and then leaving it open
before exiting, but I'm not sure which one is responsible for doing so.
Basically for some reason this program is opening 'NUL' and leaving it
open, which just happens to be the file I open to check if SHARE is
loaded on a network.

Whenever this "rogue" program opens the file in this manner, my program
will fail its check and report that SHARE must be loaded.  As well, if
you 'COPY CON NUL' at the DOS prompt you will get "Sharing Violation"
so there is the proof that it is still open.

I'm just wondering if anyone has a fool-proof piece of code that would
allow me to enter the file name or handle and be told which process was
responsible for opening the file...or is this information not kept in
memory at all?

Please respond via e-mail to preserve bandwidth, I'll followup here with
a summary of responses received.

Thanks in advance!

+-----------------------------------------------+--------------------+
| Steve Frampton - frampton@vicuna.ocunix.on.ca | Steve Frampton     |
| I collect postcards!  If you send me one from | 501-A Princess St. |
| your area, I'll send one in return.  Send to >| Kingston, Ontario  |
| (Don't forget both email and mailing address) | CANADA   K7L 1C3   |
+-----------------------------------------------+--------------------+
Technical Details
Message-ID: <1o4oTB1w165w@vicuna.ocunix.on.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!torn!news.ccs.queensu.ca!qucis.queensu.ca!ember!vicuna!frampton

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!torn!news.ccs.queensu.ca!qucis.queensu.ca!ember!vicuna!frampton
From: frampton@vicuna.ocunix.on.ca (Steve Frampton)
Newsgroups: comp.os.msdos.programmer
Subject: How to find out who has an open file?
Message-ID: <1o4oTB1w165w@vicuna.ocunix.on.ca>
Date: 4 Nov 92 03:32:35 GMT
Reply-To: frampton@vicuna.ocunix.on.ca
Followup-To: comp.os.msdos.programmer
Organization: Vicuna Systems, Kingston, ON (613) 547-5066
Lines: 29
Content-Type: text