-
GDI handles per process
Folks, is it even possible to enumerate the GDI handles that
belong to a process? I have a pseudo-solution for 9x systems
where I loop from 0-65535, check to see if the number is a valid
GDI handle, and optionally dump the handle's contents to the
screen; however, this approach would be far too slow for an
NT system (seeing as that the GDI handle numeric value is 32-bit)
and it does not associate a process with the handle.
Thanks,
-CC
-
* bump *
Any thoughts on this folks?
-
You're talking about device contexts -- DC's - right?
There are two types - one that is allocated permanently to a process, and one that is allocated from the DC pool.
In NT, you can allocate lots of them, in Win9X there is a limited number.
In NT, they all live in kernel address space, in Win9x, partly in user space.
What I'd do is go to www.sysinternals.com.
Download PSTools. There is free source for a lot of the modules.
You cannot do some of this in VB - so be warned -- it's C.
Out of curiosity - why do you want to do this - trying to figure out how many more resources you can gobble up without damaging the system?
-
Hi Jim, nope I am not talking about DCs. I am actually talking
about Bitmap handles, Brush handles, etc... (all in all I think
there are 13 different types of GDI). I'll check out the sources at
Sysinternals (just in case they have what I am looking for).
The reason I am doing this is because I want to be able to
detect GDI resource leaks from another application. From what
I have seen on the Market, there exists no tool that can do this
but at the same time alot of people are looking for such a tool.
These facts imply making a tool like this would be exceptionally
difficult... but so long as it's not impossible, I'm game :)
-CC