perizi
asked on
Process handles enumeration and nature (VC++, NT no MFC)
How can a thread easily know what handles its process has and what kind of handles they are (thread handle, sempahore handle, file handle..)?
Is the use of PDH (Performance Data Helper) calls the most simple way?
I'm working in Windows NT, programming a component with VC++, using ATL, and no MFC.
Is the use of PDH (Performance Data Helper) calls the most simple way?
I'm working in Windows NT, programming a component with VC++, using ATL, and no MFC.
ASKER
Adjusted points from 20 to 40
ASKER
A class which helps preventing leaks from handles that are never closed sounds really useful.
How would you draw it?
How would you draw it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks NIETOD for the useful code.
However, it sounds strange to me why there are no API functions to get one's used handles.
It would be so useful at debbug time!
Thanks again.
However, it sounds strange to me why there are no API functions to get one's used handles.
It would be so useful at debbug time!
Thanks again.
Not really. it would be just as useful as function that returned your dynamically allocted pointers. What would you do with those pointers? You don't know what they point to. The only useful thing you could use it for is to count the handles to see if there are leaks. use the above approach and avoid the memory leaks in the first place.
You need do so yourself. You can write classes to help you in this. These classes may also good at preventing leaks from handles that are never closed.