BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting opened files

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Fabio
Guest





PostPosted: Thu Jan 29, 2004 4:27 pm    Post subject: Deleting opened files Reply with 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
Dragon Lord
Guest





PostPosted: Sun Feb 01, 2004 5:32 am    Post subject: Re: Deleting opened files Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.