Locked files

  • Thread starter Thread starter Cameron
  • Start date Start date
Hi Cameron,

What I did was verify that the file exists and than attempt to open the file
in ReadWrite mode. If this fails, I than try to open in Read mode. If it
still fails, than the file is open and locked for exclusive access.

-Joe
 
Doesn't that seem excessively heavy? If you look at something like
handle.exe, it can give you a complete list of all of the locked files
on your system, (really quickly), but some how I can't see it attempting
to open every file in write mode.

There has to be a API somewhere that can give this type of information.

-Cam
 
No it's not that heavy, beside, Handle.exe doesn't give you the information
you really need, it only says that a (file)handle is associated with a
certain file, but it doesn't say how the file is opened and how it can be
shared.
It's not because a file is opened by process A that it cannot be used by
process B, all depends on the open mode and the share mode, no-one stops you
from opening a file in read mode multiple times, note that it's even
possible to open a file for shared write access, how would handle.exe be of
any help here?

Willy.
 
Back
Top