![]() |
Total number of GDI handle |
Post Reply
|
Page 12> |
| Author | ||||
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
Topic: Total number of GDI handlePosted: 18 February 2008 at 9:02am |
|||
Setting a bp on user32!NtUserGetGuiResources while debugging taskmgr.exe shows that it is called twice for each process (one for USER, one for GDI, presumably).
|
||||
|
Daily affirmation:
net helpmsg 4006 |
||||
![]() |
||||
a_d_13
Senior Member
Joined: 08 September 2007 Online Status: Offline Posts: 266 |
Post Options
Quote Reply
Posted: 18 February 2008 at 7:29am |
|||
|
Hey - thanks for testing this out.
Interesting that Task Manager doesn't display them properly. I think it may use a different method from PE. I'll look into that a little more and post back here.
Thanks,
--AD
|
||||
![]() |
||||
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
Posted: 18 February 2008 at 6:35am |
|||
|
Made the change in the kernel debugger (eb bf9110cb 0xeb), and PE is able to get the USER / GDI count for processes running in another session:
![]() Interestingly, Task Manager is not - it displays 0 and 0 for USER and GDI objects of most processes not running in the same session as it, except for winlogon.exe (and seeminlgy a few other processes), where it displays the correct numbers. Perhaps taskmgr.exe performs an internal check for most cases ( Edited by molotov - 18 February 2008 at 6:46am |
||||
|
Daily affirmation:
net helpmsg 4006 |
||||
![]() |
||||
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
Posted: 18 February 2008 at 6:00am |
|||
|
Changing the je @ 0x1110cb to jmp and bypassing (ignoring) WFP results in a BSOD on boot:
0xc000021a is STATUS_SYSTEM_PROCESS_TERMINATED - conveniently:
0xc000026c is STATUS_DRIVER_UNABLE_TO_LOAD -
fc /b done after the replace but before reboot shows the only differences in Win32k.sys to be the changed byte:
Memory-patch required for this one?
|
||||
|
Daily affirmation:
net helpmsg 4006 |
||||
![]() |
||||
a_d_13
Senior Member
Joined: 08 September 2007 Online Status: Offline Posts: 266 |
Post Options
Quote Reply
Posted: 18 February 2008 at 4:50am |
|||
|
It's simple enough - in XP SP2, search the win32k.sys (C:\Windows\System32\win32k.sys) binary for: 74 13 6a 57 e8
Then, replace the "74", the opcode for "jump if equal", with "eb", which is the opcode for "always jump". Please note, not tested, if you break something, it's not my fault, etc. There should also be ONLY ONE result for that search string - if there's more, don't do anything.
Finally, on my machine, it's at offset 1118411 (0x1110cb in hexadecimal) from the beginning of the file.
To return to normal, change it back. DO NOT DO THIS ON AN IMPORTANT MACHINE.
Thanks,
--AD
P.S. You'll probably have to deal with Windows File Protection - Google how to disable that.
|
||||
![]() |
||||
x-faktor
Senior Member
Joined: 07 June 2005 Location: France Online Status: Offline Posts: 157 |
Post Options
Quote Reply
Posted: 18 February 2008 at 3:55am |
|||
|
Molotov make a kernel patch of win32k.sys :)
|
||||
![]() |
||||
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
Posted: 17 February 2008 at 8:33pm |
|||
|
OK, so I tossed a kernel debugger on an XP VM and set a BP on NtUserGetGuiResources. I logged into two sessions in XP, and launched PE from session 0, while running calc.exe in session 1. Upon viewing the properties of calc.exe in PE, the debugger broke in. I stepped through NtUserGetGuiResources and made the following observations...
However, manipulating the comparison at bf9110c5 by setting eax to 0 before executing it did not appear to have any ill effects, and Process Explorer in session 0 was able to display the appropriate values for USER and GDI objects (49 and 21) for calc.exe running in session 1, per an instance of PE running in session 1.
Not sure exactly why the session check is made in NtUserGetGuiResources, and ERROR_INVALID_PARAMETER returned if the sessions don't match... Edited by molotov - 17 February 2008 at 8:34pm |
||||
|
Daily affirmation:
net helpmsg 4006 |
||||
![]() |
||||
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Post Options
Quote Reply
Posted: 17 February 2008 at 12:07am |
|||
|
ReactOS USER/GDI implementation is very different than it actually is on Windows NT platform.
Edited by EP_X0FF - 17 February 2008 at 12:07am |
||||
|
Ring0 - the source of inspiration
|
||||
![]() |
||||
a_d_13
Senior Member
Joined: 08 September 2007 Online Status: Offline Posts: 266 |
Post Options
Quote Reply
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
|
||||
![]() |
||||
molotov
Moderator Group
Joined: 04 October 2006 Online Status: Offline Posts: 17492 |
Post Options
Quote Reply
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 |
||||
![]() |
||||
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |