View Full Version : Can I set a breakpoint on a key press?
Flack
August 17th, 2002, 02:09
Hello,
Is it possible to make softice break on a key press. For example, if I wanted softice to pop up when I hit the insert key, is that possible?
Thanx for the help,
-Flack
naides
August 17th, 2002, 04:22
Yes.
I would use bmsg [handle of your app] wm_keyup if (Wparam==[ VK_TAB])
Wparam is in esp-c I think
The virtual key code of [tab] VK_TAB is 09h,
but your app may have changed it.
if you want sice to break when the tab key is released.
Hope this helps
Flack
August 17th, 2002, 22:36
Thanx for the reply but Im still having some trouble.
I type this into softice:
bmsg 8B8 wm_keyup if (esp-C==2D) (where 8B8 is the handle)
to break on insert key, but it doesnt break. When I use hwnd to find the handle of the app, is it the first one I see or not? For this app the insert key is supposed to be a shortcut for pressing a button. Do I need to use the handle of the button?
Anyway, I would really like it to break when I release the insert key so any help is appreciated.
Can you maybe use notepad as an example? Like, have softice break whenever you release the tab key in notepad? For notepad I only found two handles, one called Notepad and one called Edit. However, I couldnt get sice to break.
Thanx a lot,
-Flack
naides
August 17th, 2002, 23:02
Quote:
Originally posted by Flack
Thanx for the reply but Im still having some trouble.
I type this into softice:
bmsg 8B8 wm_keyup if (esp-C==2D) (where 8B8 is the handle)
Try first without the IF clause, as I said, I am not sure where in the stack is the wparam take a look at the stack and you can tell where it is
to break on insert key, but it doesnt break. When I use hwnd to find the handle of the app, is it the first one I see or not? For this app the insert key is supposed to be a shortcut for pressing a button. Do I need to use the handle of the button?
Use the handle of the active window of your app.
Anyway, I would really like it to break when I release the insert key so any help is appreciated.
Can you maybe use notepad as an example? Like, have softice break whenever you release the tab key in notepad? For notepad I only found two handles, one called Notepad and one called Edit. However, I couldnt get sice to break.
Thanx a lot,
-Flack |
Snatch
August 18th, 2002, 00:45
Why not just find the message loop of the routine address with Spy++ and use good old Ida Pro to figure out where WM_KEYUP is trapped and how it handles it. Deadcode is always easier than livecode.
Snatch
DakienDX
August 18th, 2002, 10:28
Hello Flack !
It looks like your breakpoint should be bmsg 8B8 wm_keyup if (@(esp-C)==2D).
This makes sure that SoftICE compares the value at the address ponited by[ESP-C] instead of the value ESP-C itself.
Also, parameters are pushed onto the stack before the call, so any paramter will be at [ESP+??]. So [ESP-??] will not work for parameters.
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.