如何枚举过程的句柄? [英] How to enumerate process' handles?
本文介绍了如何枚举过程的句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以枚举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 )
代码具有以下免责声明:
The code has following declaimer:
// 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屋!
查看全文