From 1c076c0802639dcd3d64a251fb12abb9583b3ee9 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Sat, 14 Feb 2015 02:18:31 -0500 Subject: Add menu items using transform registrations, hook up copy as and paste from --- binaryninjaapi.h | 5 +++-- transform.cpp | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 0c226b50..712e5cc8 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -525,7 +525,7 @@ namespace BinaryNinja protected: BNTransform* m_xform; BNTransformType m_typeForRegister; - std::string m_nameForRegister, m_longNameForRegister; + std::string m_nameForRegister, m_longNameForRegister, m_groupForRegister; Transform(BNTransform* xform); @@ -538,7 +538,7 @@ namespace BinaryNinja static std::vector EncryptionKeyAndIVParameters(size_t fixedKeyLength = 0, size_t fixedIVLength = 0); public: - Transform(BNTransformType type, const std::string& name, const std::string& longName); + Transform(BNTransformType type, const std::string& name, const std::string& longName, const std::string& group); static void Register(Transform* xform); static Ref GetByName(const std::string& name); @@ -547,6 +547,7 @@ namespace BinaryNinja BNTransformType GetType() const; std::string GetName() const; std::string GetLongName() const; + std::string GetGroup() const; virtual std::vector GetParameters() const; diff --git a/transform.cpp b/transform.cpp index 4f8fe71d..731ac19c 100644 --- a/transform.cpp +++ b/transform.cpp @@ -9,8 +9,9 @@ Transform::Transform(BNTransform* xform): m_xform(xform) } -Transform::Transform(BNTransformType type, const string& name, const string& longName): - m_xform(nullptr), m_typeForRegister(type), m_nameForRegister(name), m_longNameForRegister(longName) +Transform::Transform(BNTransformType type, const string& name, const string& longName, const string& group): + m_xform(nullptr), m_typeForRegister(type), m_nameForRegister(name), m_longNameForRegister(longName), + m_groupForRegister(group) { } @@ -113,7 +114,7 @@ void Transform::Register(Transform* xform) callbacks.decode = DecodeCallback; callbacks.encode = EncodeCallback; xform->m_xform = BNRegisterTransformType(xform->m_typeForRegister, xform->m_nameForRegister.c_str(), - xform->m_longNameForRegister.c_str(), &callbacks); + xform->m_longNameForRegister.c_str(), xform->m_groupForRegister.c_str(), &callbacks); } @@ -164,6 +165,15 @@ string Transform::GetLongName() const } +string Transform::GetGroup() const +{ + char* name = BNGetTransformGroup(m_xform); + string result = name; + BNFreeString(name); + return result; +} + + vector Transform::GetParameters() const { return vector(); -- cgit v1.3.1