我如何在C#中打开文件的列表处理由过程? [英] How do I get the list of open file handles by process in C#?

查看:119
本文介绍了我如何在C#中打开文件的列表处理由过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在C#中打开文件的列表处理由进程id?

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 programmatic equivalent of what process explorer does.

这很可能将需要互操作。

Most likely this will require interop.

考虑在这个加赏金,实现是讨厌复杂。

Considering adding a bounty on this, the implementation is nasty complicated.

推荐答案

哎哟这将是很难从管理code做。

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

有一个<一个href="http://www.$c$cproject.com/KB/shell/OpenedFileFinder.aspx?fid=422864&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=2277170">sample在$ C $的CProject

大部分的东西可以互操作来完成,但你需要一个驱动程序来获取文件名,因为它生活在内核的地址空间。进程管理器嵌入在其资源的驱动程序。入门这一切都从C#和支持64位及32挂接,将是一大难题。

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.

这篇关于我如何在C#中打开文件的列表处理由过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆