diff options
| author | Xusheng <xusheng@vector35.com> | 2021-05-05 17:23:49 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2021-05-26 17:46:13 +0800 |
| commit | 7c9ada78241e08bf36bd04d989f742a6de721575 (patch) | |
| tree | 4134fd2f12a504ab17cc0b9acc1fb8d27552490f /ui | |
| parent | fd1974b407be042fd84f0267a328a5adabce28e1 (diff) | |
Add the ability to automatically create struct members
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/addressdialog.h | 44 | ||||
| -rw-r--r-- | ui/commands.h | 4 | ||||
| -rw-r--r-- | ui/flowgraphwidget.h | 1 | ||||
| -rw-r--r-- | ui/linearview.h | 1 | ||||
| -rw-r--r-- | ui/tokenizedtextview.h | 1 | ||||
| -rw-r--r-- | ui/typeview.h | 1 |
6 files changed, 51 insertions, 1 deletions
diff --git a/ui/addressdialog.h b/ui/addressdialog.h index 557030ba..261f0732 100644 --- a/ui/addressdialog.h +++ b/ui/addressdialog.h @@ -89,4 +89,48 @@ public: const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression", bool defaultToCurrent = false); ~FileOffsetDialogWithPreview() {} uint64_t getOffset() const { return m_fileOffset; } +}; + +class BINARYNINJAUIAPI AddUserXrefDialog: public QDialog +{ + Q_OBJECT + + QComboBox* m_combo; + QStringListModel* m_model; + QLabel* m_previewText, m_sizePrompt; + QLineEdit* m_sizeInput; + BinaryViewRef m_view; + uint64_t m_addr; + uint64_t m_here; + size_t m_size; + bool m_resultValid; + QTimer* m_updateTimer; + QStringList m_historyEntries; + int m_historySize; + GetSymbolsListThread* m_updateThread; + QColor m_defaultColor; + QFont m_defaultFont; + QString m_prompt; + bool m_initialTextSelection; + std::string m_errorString; + bool m_resultAmbiguous; + + void commitHistory(); + void customEvent(QEvent* event); + +private Q_SLOTS: + void updateTimerEvent(); + void accepted(); + void updatePreview(); + void updatePreviewText(); + void updatePreviewWithText(QString data); + +public: + AddUserXrefDialog(QWidget* parent, BinaryViewRef view, uint64_t here = 0, + size_t size = 0, const QString& title = "Add User Type Field Cross Reference", + const QString& sizeTitle = "Size of Reference (optional)", + const QString& prompt = "Enter Expression", bool defaultToCurrent = false); + ~AddUserXrefDialog() { delete m_updateThread; } + uint64_t getOffset() const { return m_addr; } + size_t getSize() const { return m_size; } };
\ No newline at end of file diff --git a/ui/commands.h b/ui/commands.h index a47f9ab5..fabea073 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -20,7 +20,9 @@ bool BINARYNINJAUIAPI askForNewType(QWidget* parent, BinaryViewRef data, Functio bool BINARYNINJAUIAPI inputNewType(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, uint64_t currentAddr, size_t selectionSize, HighlightTokenState& highlight); bool BINARYNINJAUIAPI createInferredMember(QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight, - FunctionRef func, BNFunctionGraphType type); + FunctionRef func, BNFunctionGraphType ilType); +bool BINARYNINJAUIAPI createStructMembers(QWidget* parent, BinaryViewRef data, + HighlightTokenState& highlight, FunctionRef func); bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, HighlightTokenState& highlight, uint64_t defSiteAddress, size_t ilInstructionIndex = BN_INVALID_EXPR); diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index 61b1353b..0ba5c823 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -324,6 +324,7 @@ private Q_SLOTS: void createFunc(); void changeType(); void inferStructureType(); + void autoCreateMembers(); void comment(); void addUserXref(); void functionComment(); diff --git a/ui/linearview.h b/ui/linearview.h index 99fae229..74bc6b7a 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -271,6 +271,7 @@ private Q_SLOTS: void createArray(); void createStruct(); void createNewTypes(); + void autoCreateMembers(); size_t getStringLength(uint64_t startAddr); diff --git a/ui/tokenizedtextview.h b/ui/tokenizedtextview.h index e1ead04f..699c6caa 100644 --- a/ui/tokenizedtextview.h +++ b/ui/tokenizedtextview.h @@ -97,6 +97,7 @@ class BINARYNINJAUIAPI TokenizedTextView: public QAbstractScrollArea, public Vie void makeString(); void changeType(); void inferStructureType(); + void autoCreateMembers(); size_t getStringLength(uint64_t startAddr); void setInstructionHighlight(BNHighlightColor color); diff --git a/ui/typeview.h b/ui/typeview.h index 60b11703..47b45d2a 100644 --- a/ui/typeview.h +++ b/ui/typeview.h @@ -251,6 +251,7 @@ private Q_SLOTS: void createUnion(); void setStructureSize(); void addUserXref(); + void autoCreateMembers(); void updateLineNumberAreaWidth(size_t lineCount); void focusFilter(); void toggleCollapseType(); |
