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


How can I find out which process a specific file is opened, and their open, reach and share mode? In addition, is it possible to change these values ​​for the process? Or is it possible to open a file to read it, if it is already opened for the exclusive use from another process?

Please note that I do not want to invalidate the handle of the file opening process. I just want to be able to use the file (if possible).

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

Edit: I got some answers for my first question. Edit 2: Thank you everyone for the tools you mentioned, but I'm mainly looking for programming techniques (like using the Win32 API).


Comments