开发者

Getting the file handles of given process [duplicate]

This question already has answers here: How do I get the list of open file handles by process in C#? (7 answers) 开发者_如何转开发 Closed last year.

I need a way for getting all of the file handles of a given process.

for example, given a the winword.exe process handle, i would like to get the list of the file handles of that process (doc files etc).

i'm using the Win32 api via C#/pInvoke.

Thanks!


An easy solution would be to use handle.exe and read its output. Another solution is to use P/Invoke with NtQuerySystemInformation function. This and this forum post on SysInternals has more details as well as this article on CodeProject. Doing it in managed code could be very difficult as you will need to write a driver to read the kernel address space.

I would suggest you to expose the needed functionality in a Win32 function that you could call from managed code.


In complement to Darin answer, see also this codeguru page and this sysinternal forum post

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜