diff options
| author | Brian Knudson <bk@vector35.com> | 2021-03-18 11:23:59 -0400 |
|---|---|---|
| committer | Brian Knudson <bk@vector35.com> | 2021-03-18 14:38:06 -0400 |
| commit | 4bc108e48a80aed3c59ca9c03867b7a312392e97 (patch) | |
| tree | 017da2e02940ce9e89314dfdb0b88ced248c290d | |
| parent | ca369aced1654ffe89d473a03ff2ac1b54bf1200 (diff) | |
Add Go to File Offset action
| -rw-r--r-- | ui/addressdialog.h | 33 | ||||
| -rw-r--r-- | ui/flowgraphwidget.h | 1 | ||||
| -rw-r--r-- | ui/hexeditor.h | 1 | ||||
| -rw-r--r-- | ui/linearview.h | 1 | ||||
| -rw-r--r-- | ui/viewframe.h | 2 |
5 files changed, 38 insertions, 0 deletions
diff --git a/ui/addressdialog.h b/ui/addressdialog.h index e3d02338..eee9d836 100644 --- a/ui/addressdialog.h +++ b/ui/addressdialog.h @@ -75,3 +75,36 @@ public: ~AddressDialogWithPreview() { delete m_updateThread; } uint64_t getOffset() const { return m_addr; } }; + +class BINARYNINJAUIAPI FileOffsetDialogWithPreview: public QDialog +{ + Q_OBJECT + + QComboBox* m_combo; + QLabel* m_previewText; + BinaryViewRef m_view; + uint64_t m_fileOffset; + uint64_t m_here; + bool m_resultValid; + QTimer* m_updateTimer; + QStringList m_historyEntries; + int m_historySize; + QColor m_defaultColor; + QFont m_defaultFont; + QString m_prompt; + bool m_initialTextSelection; + + void commitHistory(); + +private Q_SLOTS: + void updateTimerEvent(); + void accepted(); + void updatePreview(); + void updatePreview(QString data); + +public: + FileOffsetDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here, + const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression", bool defaultToCurrent = false); + ~FileOffsetDialogWithPreview() {} + uint64_t getOffset() const { return m_fileOffset; } +};
\ No newline at end of file diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index 1b313c31..1a8774e2 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -305,6 +305,7 @@ private Q_SLOTS: void zoomPauseTimerEvent(); void goToAddress(); + void goToAddressAtFileOffset(); void followPointer(); void defineName(); void undefineName(); diff --git a/ui/hexeditor.h b/ui/hexeditor.h index 3a2fb8e2..e571ca88 100644 --- a/ui/hexeditor.h +++ b/ui/hexeditor.h @@ -114,6 +114,7 @@ private: bool isSelectionActive(); void goToAddress(bool selection); + void goToAddressAtFileOffset(); void searchRegEx(); void findNext(); diff --git a/ui/linearview.h b/ui/linearview.h index 5c1d51bd..7e616b35 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -221,6 +221,7 @@ private Q_SLOTS: void cycleILView(bool forward); void copyAddressSlot(); void goToAddress(); + void goToAddressAtFileOffset(); void defineNameAtAddr(uint64_t addr); void defineName(); void undefineName(); diff --git a/ui/viewframe.h b/ui/viewframe.h index 0f86aa2b..09d3376c 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -352,6 +352,8 @@ public: uint64_t currentAddress, const QString& addrStr, std::string& errorString); static bool getAddressFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset, uint64_t currentAddress, const QString& title = "Go to Address", const QString& msg = "Address:", bool defaultToCurrent = false); + static bool getFileOffsetFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset, + uint64_t currentAddress, const QString& title = "Go to File Offset", const QString& msg = "File Offset:", bool defaultToCurrent = false); void setCurrentFunction(FunctionRef func); void updateCrossReferences(); |
