From 1652efdc43aa3acbd570c1f042a35da458538bb4 Mon Sep 17 00:00:00 2001 From: Ryan Snyder Date: Mon, 24 Feb 2025 15:14:19 -0500 Subject: core: initial union support with C++ API --- ui/commands.h | 10 ++++++++++ ui/flowgraphwidget.h | 3 +++ ui/linearview.h | 3 +++ ui/uitypes.h | 1 + ui/util.h | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/commands.h b/ui/commands.h index 662e1d6c..c8634bf7 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -47,6 +47,16 @@ bool BINARYNINJAUIAPI eligibleToForceVariableVersion(View* parent, HighlightToke bool BINARYNINJAUIAPI clearVariableVersion(View* parent, HighlightTokenState& highlight); bool BINARYNINJAUIAPI eligibleToClearVariableVersion(View* parent, HighlightTokenState& highlight); +struct BINARYNINJAUIAPI FieldResolutionState +{ + std::vector> goodFieldResolutions = {}; + std::vector> badFieldResolutions = {}; + + size_t registeredGoodFieldResolutions = 0; + size_t registeredBadFieldResolutions = 0; + + void bindDynamicActions(View* view, HighlightTokenState& highlight); +}; bool BINARYNINJAUIAPI getEnumSelection(QWidget* parent, BinaryViewRef data, FunctionRef func, uint64_t constValue, TypeRef& selectedEnum, bool checkValue, bool canTruncate); diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index 3d1434de..52635584 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -8,6 +8,7 @@ #include "menus.h" #include "uicontext.h" #include "commentdialog.h" +#include "commands.h" #include "instructionedit.h" /*! @@ -147,6 +148,8 @@ class BINARYNINJAUIAPI FlowGraphWidget : FlowGraphRef m_recenterWithGraph; int m_recenterXofs, m_recenterYofs; + FieldResolutionState m_fieldResolution; + static int m_layoutCompleteEventType; static int m_updateCompleteEventType; diff --git a/ui/linearview.h b/ui/linearview.h index 727f8634..f7253e3f 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -15,6 +15,7 @@ #include "uicontext.h" #include "instructionedit.h" #include "ilchooser.h" +#include "commands.h" #include #define LINEAR_VIEW_UPDATE_CHECK_INTERVAL 200 @@ -244,6 +245,8 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub std::set m_layers; + FieldResolutionState m_fieldResolution; + void setTopToAddress(uint64_t addr); void setTopToOrderingIndex(uint64_t idx); void refreshLines(size_t lineOffset = 0, bool refreshUIContext = true); diff --git a/ui/uitypes.h b/ui/uitypes.h index 410dde70..f950268d 100644 --- a/ui/uitypes.h +++ b/ui/uitypes.h @@ -77,6 +77,7 @@ typedef BinaryNinja::Ref DownloadProviderRef; typedef BinaryNinja::Ref EnumerationRef; typedef BinaryNinja::Ref ExternalLibraryRef; typedef BinaryNinja::Ref ExternalLocationRef; +typedef BinaryNinja::Ref FieldResolutionInfoRef; typedef BinaryNinja::Ref FileMetadataRef; typedef BinaryNinja::Ref FlowGraphRef; typedef BinaryNinja::Ref FlowGraphLayoutRequestRef; diff --git a/ui/util.h b/ui/util.h index a7681d2f..1037528e 100644 --- a/ui/util.h +++ b/ui/util.h @@ -31,7 +31,7 @@ std::optional BINARYNINJAUIAPI getPossibleValueSe std::optional BINARYNINJAUIAPI getAddressOfILTokenExpr(View* view, HighlightTokenState token); template -std::optional visitILInstructionForToken(View* view, HighlightTokenState token, +std::optional visitILInstructionForToken(View* view, const HighlightTokenState& token, const std::function(BinaryNinja::LowLevelILInstruction&)>& llil, const std::function(BinaryNinja::MediumLevelILInstruction&)>& mlil, const std::function(BinaryNinja::HighLevelILInstruction&)>& hlil) -- cgit v1.3.1