Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Mon, 7 Apr 2008 14:57:23 +0800,    group: microsoft.public.win32.programmer.wmi        back       


File Handle Count of each Process   
1)Is there a way to get the File Handle Count of each process                
                                         . runnning on my system using WMI?
2)Whats the "HandleCount" property with 
Win32_PerfFormattedData_PerfProc_Process Class, I mean its the count of what 
type of Handles?

url:http://www.ureader.com/gp/1486-1.aspx
date: Mon, 7 Apr 2008 14:57:23 +0800   author:   Akash

RE: File Handle Count of each Process   
Hi Akash,

This WMI counter is the handle count of the process, including File Handle, 
Desktop Handle, Process Handle etc.... Also, in Windows NT not only files 
which reside on disk are represented by a file object. File objects are 
also used to access communication devices, input/output devices and so on.

I do not believe there is any user-mode public documented interface to 
query specific File Handle count. As I know, most of the tools(such as 
Sysinternals Process Explorer) use a driver to get process handle table 
information. The article below contains the similar approach:
"FileObjectInfo - Digging into the Windows NT Internals"
http://www.codeguru.com/cpp/w-p/files/fileinformation/article.php/c4453/

There are undocumented user-mode native APIs can get this type of 
information, but Microsoft official does not support undocumented native 
APIs. 

For example, you can use ZwQuerySystemInformation API to get 
SystemHandleInformation type of information. The ObjectTypeNumber field 
contains the object type number which you can use use ZwQueryObject API to 
translate into type name. You can filter other types and only count the 
File handle type. If you really wanted to use this approach, I recommend 
you to get the book <Windows NT/2000 Native API Reference> which contains 
the detailed description of native APIs. It also contains a sample code 
snippet "Example 1.2: Listing Open Handles of a Process"

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and 
suggestions about how we can improve the support we provide to you. Please 
feel free to let my manager know what you think of the level of service 
provided. You can send feedback directly to my manager at: 
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to 
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues 
where an initial response from the community or a Microsoft Support 
Engineer within 1 business day is acceptable. Please note that each follow 
up response may take approximately 2 business days as the support 
professional working with you may need further investigation to reach the 
most efficient resolution. The offering is not appropriate for situations 
that require urgent, real-time or phone-based interactions or complex 
project analysis and dump analysis issues. Issues of this nature are best 
handled working with a dedicated Microsoft Support Engineer by contacting 
Microsoft Customer Support Services (CSS) at 
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
date: Tue, 08 Apr 2008 05:03:16 GMT   author:   (Jeffrey Tan[MSFT])

RE: File Handle Count of each Process   
Hi Akash,

Have you reviewed my reply to you? Does it make sense to you? If you still 
need any help, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and 
suggestions about how we can improve the support we provide to you. Please 
feel free to let my manager know what you think of the level of service 
provided. You can send feedback directly to my manager at: 
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
date: Thu, 10 Apr 2008 09:49:54 GMT   author:   (Jeffrey Tan[MSFT])

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us