Log in

View Full Version : Message Tracking


crUsAdEr
June 6th, 2004, 17:50
Hi guys.. what is the best way to track down a Message in a program? The program retrieve a certain WM_ message using PeekMessageA and i need to track down how the message got into the queue...

BP on SendMessageA and PostMessageA doesnt seem to catch anything and BMSG only breaks in CSRS context :/, not the program's context...

Thus is there an easy way of observing the Message Queue etc to track down where and how a certain message get into the queue?

Thanks

Aimless
June 6th, 2004, 23:11
You might try:

1. Spy++
2. Borland Winsight

All freely available on the net...

Have Phun

crUsAdEr
June 7th, 2004, 09:39
Thanks Aimless.. i check out those tools and find Winspector real good

However they dont help me much... the dont tell me the offset of the code/call where the Message is inserted in the queue so i still dont know how the message gets there...
let me be more specific about the problem...

This is the piece of code
Code:

CODE:00452EA2 6A 01 push PM_REMOVE ; wRemoveMsg
CODE:00452EA4 6A 00 push 0 ; wMsgFilterMax
CODE:00452EA6 6A 00 push 0 ; wMsgFilterMin
CODE:00452EA8 6A 00 push 0 ; hWnd
CODE:00452EAA 57 push edi ; lpMsg
CODE:00452EAB E8 2C 55 FB FF call PeekMessageA
CODE:00452EB0 85 C0 test eax, eax
CODE:00452EB2 74 75 jz short loc_452F29
CODE:00452EB4 B3 01 mov bl, 1
CODE:00452EB6 83 7F 04 12 cmp [edi+MSG.message], WM_QUIT
CODE:00452EBA 74 66 jz short bad


ok so i need to track down how this WM_QUIT gets into the Message Queue but Winspector / Spy++ doesnt even show any WM_QUIT found... yes the message is there when i debug the program with Olly...

nikolatesla20
June 7th, 2004, 10:26
I find it hard to believe that bpx on SendMessage or PostMessage wouldn't work, but maybe also try PostThreadMessage and PostQuitMessage too..


-nt20

crUsAdEr
June 7th, 2004, 12:15
Hey Nikolatesla... thanks man.. u nail the bugger... PostQuitMessage is the culprit :/... As a Delphi programmer i should have thought of this earlier ...