How do I get the list of open file handles by process in C#?

后端 未结 7 1543
春和景丽
春和景丽 2020-11-22 13:01

How do I get the list of open file handles by process id in C#?

I\'m interested in digging down and getting the file names as well.

Looking for the program

7条回答
  •  -上瘾入骨i
    2020-11-22 13:42

    Ouch this is going to be hard to do from managed code.

    There is a sample on codeproject

    Most of the stuff can be done in interop, but you need a driver to get the filename cause it lives in the kernel's address space. Process Explorer embeds the driver in its resources. Getting this all hooked up from C# and supporting 64bit as well as 32, is going to be a major headache.

提交回复
热议问题