2

I'm developing a custom memory viewer in Python for IDA. Obviously I need to know current EA. For now, I just ask user to supply it through AskAddr() and it works fine. However, I'd like my plugin to integrate with IDA better. For example, if I click on a function in the functions window, or click anything in the navigator, it should open my window (if it's focused already), not the hex view or disassembly view. Well, at least I'd expect it to. I don't believe opening these is hardcoded in IDA's internals, since we can get as many hex/disassembly views as we want, and IDA always uses the last one as EA handler... so they are probably registering themselves somehow.

What I've tried was to use UI hooks, but they simply do not register the desired events. If I click on the navigator, it shows nothing, but if I press G, it correctly receives JumpAsk event. So it seems to work on a whim. The other thing I've tried was to use simplecustviewer_t that offers OnCursorPosChanged, but apparently it handles changing position of a text caret in a window, not EA "cursor" changes.

Is there any way I can hook up into these kind of events?

2

idc.ScreenEA() is your friend.

ScreenEA()
Get linear address of cursor

You can either open a thread which will ask this value once per some time, or add synchronization menu item into your custom view or use PyQt4 capabilities to check setting focus on the window instead of simplecustviewer_t.

  • This sounds close to what I want. However, if one changes ScreenEA, it opens up a hex view or IDA view regardless if my plugin window had focus or not. So essentially I'll need to be stealing focus from user under circumstances I consider "right" in my thread that checks for window focus. This feels kludgy. Isn't there a better solution? – rr- Mar 18 '15 at 7:52
  • I don;t know why should you steal the focus. You can make a dock-able python plugin window as it wrote at hexblog.com/?p=229 – w s Mar 18 '15 at 8:12
  • Yep, that's what I do. Uhm, let me draw this... i.imgur.com/W9BWHSX.png – rr- Mar 18 '15 at 8:48
  • OK, I understand you. I'd suggest to use QObject's timers on a object you get from FormToPySideWidget function to get the ScreenEA once a second. This will allow you to update the window regardless any focus issues. – w s Mar 18 '15 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.