tags:

views:

1170

answers:

2

If I read or write to a file and receive a 33 or 32 error, I would like to log a message containing the name of the other process(es) that have the file opened. There must be a Win32 API I could use to get this info. Process Explorer displays it. Of course, Process Explorer also has info about all processes in memory. I'd prefer to find the culprit without interrogating all processes.

+1  A: 

This seems to do what you want.

obviously it uses some hidden API such as NtQueryInformationProcess.

shoosh
+1  A: 

The Handle program from SysInternals does this as well, but I'm not sure how. I don't think there is a single documented API to do this. I think you have to iterate over the processes, enumerate each of the handles in the process, and then determine the filename associated with that handle.

Nick