summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2019-08-27 07:37:10 -0400
committerPeter LaFosse <peter@vector35.com>2019-08-27 07:37:15 -0400
commit5019d87a1936a07f86512d6de5cbd4b0db3ea25b (patch)
treeb89783a027351987c11ecaaae9b39c3162adea96
parent6d0c013a6b21aad1afdc413aea0392fe805adabd (diff)
Add support for showing structure offsets and inferring types via hotkey, add changing names/types of structure members from linear/graph view
-rw-r--r--binaryninjacore.h1
-rw-r--r--binaryview.cpp2
-rw-r--r--ui/commands.h8
-rw-r--r--ui/flowgraphwidget.h1
-rw-r--r--ui/linearview.h1
-rw-r--r--ui/tokenizedtextview.h1
6 files changed, 10 insertions, 4 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 0472560d..852e2a7e 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -242,6 +242,7 @@ extern "C"
NameSpaceToken = 22,
NameSpaceSeparatorToken = 23,
TagToken = 24,
+ StructOffsetToken = 25,
// The following are output by the analysis system automatically, these should
// not be used directly by the architecture plugins
CodeSymbolToken = 64,
diff --git a/binaryview.cpp b/binaryview.cpp
index 853d42d3..0f693d2d 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -2568,7 +2568,7 @@ Ref<Type> BinaryView::GetTypeByName(const QualifiedName& name)
if (!type)
return nullptr;
- return new Type(type);
+ return new Type(BNNewTypeReference(type));
}
diff --git a/ui/commands.h b/ui/commands.h
index dd088850..f95664f1 100644
--- a/ui/commands.h
+++ b/ui/commands.h
@@ -18,12 +18,14 @@ bool BINARYNINJAUIAPI askForNewType(QWidget* parent, BinaryViewRef data, Functio
TypeRef& type, BinaryNinja::QualifiedName& name);
bool BINARYNINJAUIAPI inputNewType(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction,
uint64_t currentAddr, HighlightTokenState& highlight);
+bool BINARYNINJAUIAPI createInferredMember(BinaryViewRef data, HighlightTokenState& highlight);
bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch,
uint64_t addr, size_t len, const BinaryNinja::DataBuffer& buffer);
bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch,
uint64_t addr, const BinaryNinja::DataBuffer& buffer);
-StructureRef BINARYNINJAUIAPI getInnerMostStructureContaining(
- StructureRef structure, size_t& memberIndex, const std::vector<std::string>& nameList,
- size_t nameIndex);
+StructureRef BINARYNINJAUIAPI getInnerMostStructureContaining(BinaryViewRef data, StructureRef structure,
+ size_t& memberIndex, const std::vector<std::string>& nameList, size_t nameIndex, TypeRef& type, std::string& typeName);
+StructureRef BINARYNINJAUIAPI getInnerMostStructureContainingOffset(BinaryViewRef data, StructureRef structure,
+ const std::vector<std::string>& nameList, size_t nameIndex, size_t& offset, TypeRef& type, std::string& typeName);
diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h
index 3ec61019..9c4dfcd0 100644
--- a/ui/flowgraphwidget.h
+++ b/ui/flowgraphwidget.h
@@ -283,6 +283,7 @@ private Q_SLOTS:
void undefineFunc();
void createFunc();
void changeType();
+ void inferStructureType();
void comment();
void addUserXref();
void functionComment();
diff --git a/ui/linearview.h b/ui/linearview.h
index 486b2326..fe31de8a 100644
--- a/ui/linearview.h
+++ b/ui/linearview.h
@@ -162,6 +162,7 @@ private Q_SLOTS:
void makePtr();
void makeString();
void changeType();
+ void inferStructureType();
size_t getStringLength(uint64_t startAddr);
void displayAsDefault();
diff --git a/ui/tokenizedtextview.h b/ui/tokenizedtextview.h
index e54b5842..95c47666 100644
--- a/ui/tokenizedtextview.h
+++ b/ui/tokenizedtextview.h
@@ -88,6 +88,7 @@ class BINARYNINJAUIAPI TokenizedTextView: public QAbstractScrollArea, public Vie
void makePtr();
void makeString();
void changeType();
+ void inferStructureType();
size_t getStringLength(uint64_t startAddr);
void displayAsDefault();