diff options
| author | Glenn Smith <glenn@vector35.com> | 2020-12-02 15:42:58 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2020-12-02 15:42:58 -0500 |
| commit | 432a8cdf64052db5fef7df792e2a5a51734d27af (patch) | |
| tree | 6c4d4bd91056fae5741bdb892b28124f85dc0dba | |
| parent | 31165bf2cba75f3ab58fefce10e707bbaadcc125 (diff) | |
Callback for address changes #2166
| -rw-r--r-- | examples/uinotification/uinotification.cpp | 6 | ||||
| -rw-r--r-- | examples/uinotification/uinotification.h | 1 | ||||
| -rw-r--r-- | python/examples/ui_notifications.py | 6 | ||||
| -rw-r--r-- | ui/uicontext.h | 3 |
4 files changed, 16 insertions, 0 deletions
diff --git a/examples/uinotification/uinotification.cpp b/examples/uinotification/uinotification.cpp index b7c22bde..ca53c560 100644 --- a/examples/uinotification/uinotification.cpp +++ b/examples/uinotification/uinotification.cpp @@ -85,6 +85,12 @@ void NotificationListener::OnViewChange(UIContext* context, ViewFrame* frame, co } +void NotificationListener::OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) +{ + LogInfo("OnAddressChange: %llx", location.getOffset()); +} + + extern "C" { BINARYNINJAPLUGIN bool UIPluginInit() diff --git a/examples/uinotification/uinotification.h b/examples/uinotification/uinotification.h index a26b3de3..3a3231be 100644 --- a/examples/uinotification/uinotification.h +++ b/examples/uinotification/uinotification.h @@ -17,6 +17,7 @@ public: virtual bool OnBeforeCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) override; virtual void OnAfterCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) override; virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type) override; + virtual void OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) override; static void init(); };
\ No newline at end of file diff --git a/python/examples/ui_notifications.py b/python/examples/ui_notifications.py index 8074a1c5..ee0a5279 100644 --- a/python/examples/ui_notifications.py +++ b/python/examples/ui_notifications.py @@ -71,6 +71,12 @@ class UINotification(UIContextNotification): else: print("py OnViewChange") + def OnAddressChange(self, context, frame, view, location): + if frame: + print(f"py OnAddressChange {frame.getShortFileName()} {location.getOffset()}") + else: + print(f"py OnAddressChange {location.getOffset()}") + # Register as a global so it doesn't get destructed notif = UINotification() diff --git a/ui/uicontext.h b/ui/uicontext.h index bc88a71b..5fbd2ca2 100644 --- a/ui/uicontext.h +++ b/ui/uicontext.h @@ -16,6 +16,7 @@ typedef void (*UIPluginDependencyFunction)(void); class ViewFrame; class UIActionHandler; class FileContext; +class ViewLocation; class BINARYNINJAUIAPI UIContextNotification { @@ -33,6 +34,7 @@ public: virtual void OnAfterCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; } virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type) { (void)context; (void)frame; (void)type; } + virtual void OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) { (void)context; (void)frame; (void)view; (void)location; }; }; class BINARYNINJAUIAPI UIContextHandler @@ -86,6 +88,7 @@ public: void NotifyOnAfterCloseFile(FileContext* file, ViewFrame* frame); void NotifyOnViewChange(ViewFrame* frame, const QString& type); + void NotifyOnAddressChange(ViewFrame* frame, View* view, const ViewLocation& location); static void setHandler(UIContextHandler* handler); |
