 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Fabio Guest
|
Posted: Thu Jan 29, 2004 4:27 pm Post subject: Deleting opened files |
|
|
I need to create an install for my application, that should have
updated some DLLs, but when I try to delete the old DLL the windows
doesn't leave.
how do I detect and I delete files/dlls that are in execution or
openeds?
|
|
| Back to top |
|
 |
Dragon Lord Guest
|
Posted: Sun Feb 01, 2004 5:32 am Post subject: Re: Deleting opened files |
|
|
2 Ways, Try to delete it, and if it doesn't delete, then you A) don't have
permissions and B) its being used. or #2, write a kernel driver, or use
another, that keeps track of opened file handles and the names to them. I
know Windows 2k/XP's oh.exe requires that you install a kernel level driver,
and "FileMon" by SysInternals. Also, you could try
var
MyFile: TFileStream;
MyFile := TFileStream.Create(Filename, fmOpenRead or fmShareExclusive);
that should raise an Exception if you don't have permissions or the file is
opened by another process. There is not a nice way of getting the
program(s) that have that file opened unless you install a kernel driver to
do it. But I have some delphi code that will copy a resource (in your
executable) to the disk, and auto install it at a kernel driver, its pretty
scary that 2k/xp lets you install kernel filters without user confirmation.
"Fabio" <fpinheiro (AT) bol (DOT) com.br> wrote
| Quote: | I need to create an install for my application, that should have
updated some DLLs, but when I try to delete the old DLL the windows
doesn't leave.
how do I detect and I delete files/dlls that are in execution or
openeds?
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|