iam not sure if i understand you correct
but if you want to debug an user mode application it is better to use
windbg directly instead of using kernel debugging as handling
usermode applications from a kernel mode debugger involves quiet a bit
of jugglery
you have to run a local debugger in the client and redirect the output
to kernel debuggier running on host
for example ntsd -d “your app.exe” will redirect output to a kd
running in host
and you should be in right process context when you want to do
something in kernel debugger for that process
but if you are just interested in user mode debugging just
use windbg “your app.exe” “your apps args” to create
or attach to a running instance of “your app” using
windbg -pn “your app” //
windbg -p pid
etc
and when you have broken in
you can set a breakpoint on DispatchMessage / TranslateMessage apis in
user32.dll
and inspect the messages using dd db etc
if you want a formatted output you can download ken johnsons
(skywing’s) sdbgext
extension
and use the !usermsg extension command you can also use grep etc to
filter the out put further
see paste below for a simple msgpump loop
0:001> .load sdbgext
0:001> !sdbgext.usermsg
Usage: !usermsg
0:001> bp user32!DispatchMessageA "!usermsg poi(esp+4);g"
0:001> bl
0 e 7e4196b8 0001 (0001) 0:****user32!DispatchMessageA
"!usermsg poi(esp+4);g"
0:001> g
hwnd:
Window 000602f8
Name Our First Window
Class SimpleWinClass
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_WINDOWEDGE WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 00400000
ParentWnd 00000000
Id 00000000
UserData 00000000
Unicode FALSE
ThreadId 00000944
ProcessId 00000940
Message: 0x0112
wParam: f120
lParam: 0
Time: 29217a
pt: (164, 507)
hwnd:
Window 000602f8
Name Our First Window
Class SimpleWinClass
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_WINDOWEDGE WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 00400000
ParentWnd 00000000
Id 00000000
UserData 00000000
Unicode FALSE
ThreadId 00000944
ProcessId 00000940
Message: 0x0112
wParam: f120
lParam: 0
Time: 29217a
pt: (164, 507)
hwnd:
Window 000602f8
Name Our First Window
Class SimpleWinClass
WndProc 00000000
Style WS_OVERLAPPED
ExStyle WS_EX_WINDOWEDGE WS_EX_LEFT WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR
HInstance 00400000
ParentWnd 00000000
Id 00000000
UserData 00000000
Unicode FALSE
ThreadId 00000944
ProcessId 00000940
Message: 0x0101
wParam: d
lParam: c01c0001
Time: 2922c3
pt: (164, 507)
using domdbg extension and using grep on the output to filter only messages
0:001> bp user32!DispatchMessageA "!grep -e \"Message:\" -c \"!usermsg
poi(esp+4)\";g"
breakpoint 0 redefined
0:001> bl
0 e 7e4196b8 0001 (0001) 0:**** user32!DispatchMessageA "!grep
-e \"Message:\" -c \"!usermsg poi(esp+4)\";g"
0:001> g
Message: WM_PAINT
Message: 0x0113
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
Message: 0x0200
On 5/15/12, xxxxx@gmx.de wrote:
> I'd like to monitor the content of an application's main thread's message
> queue, but I have no idea how to get the address of it (WinDbg, kernel
> debugging). Would anyone have a hint for me? The thing is, when our main
> thread stays in WaitForSingleObject for a longer period of time, we get
> sometimes "Not enough quota..." when calling PostMessage afterwards. It's
> clear to me it's about the message queue being overflowed, but I cannot find
> out (with Spy++) who posts so many messages to the main thread in the
> meantime.
>
> And no, I can't change the awful design at the moment :) I know the main
> thread mustn't be used for waiting long for an event, but as I said - I
> can't change it in the next months.
>
> I'd like to find out what messages overflow the queue, and my second idea
> (the first was Spy++) is to watch the main thread's message queue.
>
> Perhaps there are other good ideas?
>
> Regards, Maciej
>
>
> ---
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>