How can I find which process has opened a specific file?

Posted by Hosam Aly on Stack Overflow See other posts from Stack Overflow or by Hosam Aly
Published on 2009-02-01T09:00:48Z Indexed on 2011/01/17 9:53 UTC
Read the original article Hit count: 389

Filed under:
|

How can I find which processes have a specific file opened, and their open, access and share modes? Additionally, is it possible to change these values for a process? Or is it even possible to open a file for reading if it is already opened for exclusive access by another process?

Please note that I don't want to invalidate the handle of the process having the file opened. I just want to be able to access the file (if possible).

(I'm mainly asking about Windows, but solutions for other platforms are welcome, since they contribute to the community's knowledge.)

Edit: I found some answers for my first question here and there.

Edit 2: Thanks everybody for the tools you mentioned, but I am mainly looking for programmatical techniques (e.g. using Win32 APIs).

© Stack Overflow or respective owner

Related posts about winapi

Related posts about files