From c382a4610cc0ea7f8b8134b847d29bca7dc25398 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Sun, 24 Apr 2016 00:33:26 -0400 Subject: Create API for adding known indirect branch targets --- binaryninjaapi.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 8da02369..4ba49cdd 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1272,6 +1272,24 @@ namespace BinaryNinja int64_t referencedOffset; }; + struct IndirectBranchInfo + { + Ref sourceArch; + uint64_t sourceAddr; + Ref destArch; + uint64_t destAddr; + bool autoDefined; + }; + + struct ArchAndAddr + { + Ref arch; + uint64_t address; + + ArchAndAddr(): arch(nullptr), address(0) {} + ArchAndAddr(Architecture* a, uint64_t addr): arch(a), address(addr) {} + }; + class FunctionGraph; class Function: public CoreRefCountObject @@ -1318,6 +1336,12 @@ namespace BinaryNinja void DeleteAutoStackVariable(int64_t offset); void DeleteUserStackVariable(int64_t offset); bool GetStackVariableAtFrameOffset(int64_t offset, StackVariable& var); + + void SetAutoIndirectBranches(Architecture* sourceArch, uint64_t source, const std::vector& branches); + void SetUserIndirectBranches(Architecture* sourceArch, uint64_t source, const std::vector& branches); + + std::vector GetIndirectBranches(); + std::vector GetIndirectBranchesAt(Architecture* arch, uint64_t addr); }; struct FunctionGraphTextLine @@ -1404,6 +1428,9 @@ namespace BinaryNinja uint64_t GetCurrentAddress() const; void SetCurrentAddress(uint64_t addr); + void ClearIndirectBranches(); + void SetIndirectBranches(const std::vector& branches); + ExprId AddExpr(BNLowLevelILOperation operation, size_t size, uint32_t flags, ExprId a = 0, ExprId b = 0, ExprId c = 0, ExprId d = 0); ExprId AddInstruction(ExprId expr); @@ -1476,6 +1503,10 @@ namespace BinaryNinja ExprId If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f); void MarkLabel(BNLowLevelILLabel& label); + std::vector GetOperandList(ExprId i, size_t listOperand); + ExprId AddLabelList(const std::vector& labels); + ExprId AddOperandList(const std::vector operands); + ExprId Operand(uint32_t n, ExprId expr); BNLowLevelILInstruction operator[](size_t i) const; -- cgit v1.3.1