如何枚举进程的句柄? [英] How to enumerate process' handles?

查看:23
本文介绍了如何枚举进程的句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以在windows中枚举给定PID的进程,并获取他所有打开的句柄(锁定文件等)的列表?

Is there any way how to enumerate process with given PID in windows, and get list of all his opened handles(locked files, etc.)?

我不关心语言.如果它在 .NET 中,我会很高兴,如果在 WinApi (C) 中,它不会受到伤害.如果在别的地方,我想我可以重写它:-)

I dont care about language. If it is in .NET, I'd be glad, if in WinApi (C), it won't hurt. If in something else, I think I can rewrite it :-)

推荐答案

我进行了深入的谷歌搜索,发现了这个 文章.这篇文章给出了下载源代码的链接:

I did a deep googling and found this article. This article gave a link to download source code:

我尝试了 NtSystemInfoTest.cpp(下载的源代码)中的方法,效果很好.

I tried method in NtSystemInfoTest.cpp ( downloaded source code ) and it worked superbly.

void ListHandles( DWORD processID, LPCTSTR lpFilter )

代码具有以下声明:

// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com
// For companies(Austin,TX): If you would like to get my resume, send an email.
//
// The source is free, but if you want to use it, mention my name and e-mail address
//
//////////////////////////////////////////////////////////////////////////////////////
//

希望对你有帮助.

这篇关于如何枚举进程的句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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