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).