Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Internals
  New Posts New Posts RSS Feed: Total number of GDI handle
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Total number of GDI handle

 Post Reply Post Reply Page  12>
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
x-faktor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 June 2005
Location: France
Online Status: Offline
Posts: 152
  Quote x-faktor Quote  Post ReplyReply Direct Link To This Post Topic: Total number of GDI handle
    Posted: 08 February 2008 at 9:12am
Hi, i'm searching for a tool or something that can tell me the current total number of USER & GDI handles for ALL processes. I know i can tell it for a particular process using PE but i need to know the total amount. Can you help?
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17287
  Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 08 February 2008 at 9:51am
Hi Jul,
 
I don't know of anything, but I suppose any tool that would exist may have to contend with the concern discussed here:
 
Probably, a VBS or PowerShell script should be somewhat quick to develop, but would seem to be subject to the aforementioned consideration.


Edited by molotov - 08 February 2008 at 9:55am
Daily affirmation:
net helpmsg 4006
Back to Top
x-faktor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 June 2005
Location: France
Online Status: Offline
Posts: 152
  Quote x-faktor Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2008 at 2:49am
hi molotov, actually i was trying to troubleshoot why we cant execute more than 200 or max 700 process of calc.exe concurently with a single batch:

:start
start calc.exe
goto start
just copy this into a startmaxprocess.bat and see how many process you can have. It seems that the amount of ram you have isnt the limitant factor. I was thinking about the amount of GDI or USER handle as i read the max number is coded in a 16 bits var, so there is a global limit of GDI or USER handle of 64k.
That's why i was tracking the global number of GDI handles opened.
I hope i'm clear.
Thanks for your link anyway i will program some basic thing.
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17287
  Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2008 at 7:29am
Interesting...
 
I've been doing some other testing lately that runs notepad.exe, grabs its priority, and kills it.  I let the tests run when I'm not using the system.  After I've been away for a few hours, I see several (hundreds, if not thousands) failures of CreateProcess which had a "last error" of 1450 - ERROR_NO_SYSTEM_RESOURCES : "Insufficient system resources exist to complete the requested service."
Daily affirmation:
net helpmsg 4006
Back to Top
x-faktor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 June 2005
Location: France
Online Status: Offline
Posts: 152
  Quote x-faktor Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 5:13am
your blog is very interesting i bookmarked it
Back to Top
a_d_13 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 September 2007
Online Status: Offline
Posts: 260
  Quote a_d_13 Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 8:26am

A tool that I know of that can display this kind of thing can be found here:

 
It also has source code available.  Hope this helps.
 
 
 
Thanks,
--AD
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17287
  Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 8:37am
Hi AD,
 
Looks like bear is also subject to the concern discussed here:
 
Similar to PE, it doesn't / is unable to display USER and GDI values (and other details related to USER and GDI objects) for processes running in other sessions.


Edited by molotov - 16 February 2008 at 8:54am
Daily affirmation:
net helpmsg 4006
Back to Top
a_d_13 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 September 2007
Online Status: Offline
Posts: 260
  Quote a_d_13 Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 9:40am
Hm, interesting.  Looking further into GetGuiResources, it seems to call NtUserGetGuiResources, transitions to kernel-mode, and then obtains the information from the EPROCESS structure.  See:
Scroll down to NtUserGetGuiResources to see the code.
So, if someone could check to see if a process in another session has a valid Win32Process pointer, or debug the function in the kernel, that would solve our problem.  I may do this if I have time.
 
 
Thanks,
--AD
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17287
  Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 10:04am
I had gone down a similar path at one point.  But I'm not getting what you mean by "debug the function in the kernel" (I get the concept, of course, but not how it might be used, practically, in this case).
 
Are you conceiving a driver-based solution for this?
Daily affirmation:
net helpmsg 4006
Back to Top
a_d_13 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 September 2007
Online Status: Offline
Posts: 260
  Quote a_d_13 Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2008 at 8:31pm
Actually, I meant hooking WinDbg up for remote kernel debugging (ie. using a VM, serial cable, etc.), setting a breakpoint on NtUserGetGuiResources, calling it on a process where it is known to fail with ERROR_INVALID_PARAMETER, and then tracing to see why it fails.  That may help to narrow down the problem.  However, I'm rather low on free time at the moment, so if someone else could do this, and post back, that'd be great.
If I get some free time in the upcoming week, I'll take a look at it, too.
 
Thanks,
--AD
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Privacy Statement