How to break code on a click event?

2.9k views Asked by At

I have this application that I need to disassemble. I don't have a clue on how to stop the running code on the desired location, so I decided my best guess would be breaking upon a button click. But how do I capture button clicks? I know it has probably something to do with the Windows functions such as CallNextHookEx. I'm using IDA PRO to disassembly.

1

There are 1 answers

2
Daedalus On BEST ANSWER

IDA PRO is used mostly as disassembler, for static analysis purposes. I'd suggest you to use Ollydbg (or some other debugger, if you want to) because it will suit better to debugging purposes.

I don't know if you can set a breakpoint on an API like that.

But you can do this:

  1. Load the application in olly, or attach to it.
  2. Generate the event by clicking on anything.
  3. Stop the application from ollydbg(F12)
  4. Use C(k)all stack(ALT+K)
  5. You will see a few calls to functions, one of them is doing what you need. But you may need to go to upper calls to see the whole loop. So you will just try which one it is. There will be a loop in one of them.That loop will have conditional jumps and generate events, load forms, fill the app etc. And when you place a breakpoint on the right jump there, it will stop at each mouse click.

When I'm debugging apps, most of the times I find myself on a breakpoint like this, and I see from the beginning how the application is filling an empty form(it takes so long.)