Detailed Description

Classes

class  BinaryNinja::Symbol
 
class  BinaryNinja::Type
 
class  BinaryNinja::TypeBuilder
 
class  BinaryNinja::NamedTypeReference
 
class  BinaryNinja::NamedTypeReferenceBuilder
 
struct  BinaryNinja::StructureMember
 
struct  BinaryNinja::InheritedStructureMember
 
struct  BinaryNinja::BaseStructure
 
class  BinaryNinja::Structure
 Structure is a class that wraps built structures and retrieves info about them. More...
 
class  BinaryNinja::StructureBuilder
 StructureBuilder is a convenience class used for building Structure Types. More...
 
struct  BinaryNinja::EnumerationMember
 
class  BinaryNinja::Enumeration
 
class  BinaryNinja::EnumerationBuilder
 EnumerationBuilder is a convenience class used for building Enumeration Types. More...
 
class  BinaryNinja::TypeContainer
 A TypeContainer is a generic interface to access various Binary Ninja models that contain types. More...
 

Class Documentation

◆ BinaryNinja::Symbol

class BinaryNinja::Symbol

Public Member Functions

 Symbol (BNSymbolType type, const std::string &shortName, const std::string &fullName, const std::string &rawName, uint64_t addr, BNSymbolBinding binding=NoBinding, const NameSpace &nameSpace=NameSpace("BNINTERNALNAMESPACE"), uint64_t ordinal=0)
 
 Symbol (BNSymbolType type, const std::string &name, uint64_t addr, BNSymbolBinding binding=NoBinding, const NameSpace &nameSpace=NameSpace("BNINTERNALNAMESPACE"), uint64_t ordinal=0)
 
 Symbol (BNSymbol *sym)
 
BNSymbolType GetType () const
 Symbols are defined as one of the following types: More...
 
BNSymbolBinding GetBinding () const
 
std::string GetShortName () const
 
std::string GetFullName () const
 
std::string GetRawName () const
 
uint64_t GetAddress () const
 
uint64_t GetOrdinal () const
 
bool IsAutoDefined () const
 
NameSpace GetNameSpace () const
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNSymbol, BNNewSymbolReference, BNFreeSymbol >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNSymbolGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static Ref< SymbolImportedFunctionFromImportAddressSymbol (Symbol *sym, uint64_t addr)
 
- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNSymbol, BNNewSymbolReference, BNFreeSymbol >
static BNSymbolGetObject (CoreRefCountObject *obj)
 
static BNSymbolGetObject (const CoreRefCountObject *obj)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNSymbol, BNNewSymbolReference, BNFreeSymbol >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNSymbolm_object
 

Constructor & Destructor Documentation

◆ Symbol() [1/3]

BinaryNinja::Symbol::Symbol ( BNSymbolType  type,
const std::string &  shortName,
const std::string &  fullName,
const std::string &  rawName,
uint64_t  addr,
BNSymbolBinding  binding = NoBinding,
const NameSpace nameSpace = NameSpace("BNINTERNALNAMESPACE"),
uint64_t  ordinal = 0 
)

◆ Symbol() [2/3]

Symbol::Symbol ( BNSymbolType  type,
const std::string &  name,
uint64_t  addr,
BNSymbolBinding  binding = NoBinding,
const NameSpace nameSpace = NameSpace( "BNINTERNALNAMESPACE" ),
uint64_t  ordinal = 0 
)

◆ Symbol() [3/3]

Symbol::Symbol ( BNSymbol sym)

Member Function Documentation

◆ GetType()

BNSymbolType Symbol::GetType ( ) const

Symbols are defined as one of the following types:

=========================== ================================================================= BNSymbolType Description =========================== ================================================================= FunctionSymbol Symbol for function that exists in the current binary ImportAddressSymbol Symbol defined in the Import Address Table ImportedFunctionSymbol Symbol for a function that is not defined in the current binary DataSymbol Symbol for data in the current binary ImportedDataSymbol Symbol for data that is not defined in the current binary ExternalSymbol Symbols for data and code that reside outside the BinaryView LibraryFunctionSymbol Symbols for functions identified as belonging to a shared library SymbolicFunctionSymbol Symbols for functions without a concrete implementation or which have been abstractly represented LocalLabelSymbol Symbol for a local label in the current binary =========================== =================================================================

Returns
Symbol type

◆ GetBinding()

BNSymbolBinding Symbol::GetBinding ( ) const
Returns
Symbol binding

◆ GetShortName()

string Symbol::GetShortName ( ) const
Returns
Symbol short name

◆ GetFullName()

string Symbol::GetFullName ( ) const
Returns
Symbol full name

◆ GetRawName()

string Symbol::GetRawName ( ) const
Returns
Symbol raw name

◆ GetAddress()

uint64_t Symbol::GetAddress ( ) const
Returns
Symbol Address

◆ GetOrdinal()

uint64_t Symbol::GetOrdinal ( ) const
Returns
Symbol ordinal

◆ IsAutoDefined()

bool Symbol::IsAutoDefined ( ) const
Returns
Whether the symbol was auto-defined

◆ GetNameSpace()

NameSpace Symbol::GetNameSpace ( ) const
Returns
Symbol NameSpace

◆ ImportedFunctionFromImportAddressSymbol()

Ref< Symbol > Symbol::ImportedFunctionFromImportAddressSymbol ( Symbol sym,
uint64_t  addr 
)
static

◆ BinaryNinja::Type

class BinaryNinja::Type

Public Member Functions

 Type (BNType *type)
 
bool operator== (const Type &other)
 
bool operator!= (const Type &other)
 
BNTypeClass GetClass () const
 Retrieve the Type Class for this Structure. More...
 
uint64_t GetWidth () const
 Get the width in bytes of the Type. More...
 
size_t GetAlignment () const
 
QualifiedName GetTypeName () const
 Get the QualifiedName for the Type. More...
 
Confidence< bool > IsSigned () const
 Whether the type is signed. More...
 
Confidence< bool > IsConst () const
 Whether the type is constant. More...
 
Confidence< bool > IsVolatile () const
 
bool IsSystemCall () const
 
Confidence< Ref< Type > > GetChildType () const
 Get the child type for this Type if one exists. More...
 
Confidence< Ref< CallingConvention > > GetCallingConvention () const
 For Function Types, get the calling convention. More...
 
std::vector< FunctionParameterGetParameters () const
 For Function Types, get a list of parameters. More...
 
Confidence< bool > HasVariableArguments () const
 For Function Types, whether the Function has variadic arguments. More...
 
Confidence< bool > CanReturn () const
 For Function Types, whether a function can return (is not marked noreturn) More...
 
Confidence< bool > IsPure () const
 For Function Types, whether a function is pure (has no observable side-effects) More...
 
Ref< StructureGetStructure () const
 For Structure Types, the underlying Structure. More...
 
Ref< EnumerationGetEnumeration () const
 For Enumeration Types, the underlying Enumeration. More...
 
Ref< NamedTypeReferenceGetNamedTypeReference () const
 For NamedTypeReference Types, the underlying NamedTypeReference. More...
 
Confidence< BNMemberScopeGetScope () const
 
Confidence< int64_t > GetStackAdjustment () const
 
QualifiedName GetStructureName () const
 
Ref< NamedTypeReferenceGetRegisteredName () const
 
uint32_t GetSystemCallNumber () const
 
BNIntegerDisplayType GetIntegerTypeDisplayType () const
 
uint64_t GetElementCount () const
 
uint64_t GetOffset () const
 
std::string GetString (Platform *platform=nullptr, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::string GetTypeAndName (const QualifiedName &name, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::string GetStringBeforeName (Platform *platform=nullptr, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::string GetStringAfterName (Platform *platform=nullptr, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::vector< InstructionTextTokenGetTokens (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::vector< InstructionTextTokenGetTokensBeforeName (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
std::vector< InstructionTextTokenGetTokensAfterName (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const
 
Ref< TypeDuplicate () const
 
Confidence< Ref< Type > > WithConfidence (uint8_t conf)
 Get this type wrapped in a Confidence template. More...
 
bool IsReferenceOfType (BNNamedTypeReferenceClass refType)
 If this Type is a NamedTypeReference, check whether it is reference to a specific Type. More...
 
bool IsStructReference ()
 If this Type is a NamedTypeReference, check whether it refers to a Struct Type. More...
 
bool IsEnumReference ()
 If this Type is a NamedTypeReference, check whether it refers to an Enum Type. More...
 
bool IsUnionReference ()
 If this Type is a NamedTypeReference, check whether it refers to a Union Type. More...
 
bool IsClassReference ()
 If this Type is a NamedTypeReference, check whether it refers to a Class Type. More...
 
bool IsTypedefReference ()
 If this Type is a NamedTypeReference, check whether it refers to a Typedef type. More...
 
bool IsStructOrClassReference ()
 If this Type is a NamedTypeReference, check whether it refers to a Struct or Class Type. More...
 
bool IsVoid () const
 Check whether this type is a Void type. More...
 
bool IsBool () const
 Check whether this type is a Boolean type. More...
 
bool IsInteger () const
 Check whether this type is an Integer type. More...
 
bool IsFloat () const
 Check whether this type is a Float type. More...
 
bool IsStructure () const
 Check whether this type is a Structure type. More...
 
bool IsEnumeration () const
 Check whether this type is an Enumeration type. More...
 
bool IsPointer () const
 Check whether this type is a Pointer type. More...
 
bool IsArray () const
 Check whether this type is an Array type. More...
 
bool IsFunction () const
 Check whether this type is a Function type. More...
 
bool IsVarArgs () const
 Check whether this type is a Variadic Arguments type. More...
 
bool IsValue () const
 Check whether this type is a Value type. More...
 
bool IsNamedTypeRefer () const
 Check whether this type is a Named Type Reference type. More...
 
bool IsWideChar () const
 Check whether this type is a Wide Char type. More...
 
Ref< TypeWithReplacedStructure (Structure *from, Structure *to)
 
Ref< TypeWithReplacedEnumeration (Enumeration *from, Enumeration *to)
 
Ref< TypeWithReplacedNamedTypeReference (NamedTypeReference *from, NamedTypeReference *to)
 
bool AddTypeMemberTokens (BinaryView *data, std::vector< InstructionTextToken > &tokens, int64_t offset, std::vector< std::string > &nameList, size_t size=0, bool indirect=false)
 
std::vector< TypeDefinitionLineGetLines (const TypeContainer &types, const std::string &name, int lineWidth=80, bool collapsed=false, BNTokenEscapingType escaping=NoTokenEscapingType)
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNType, BNNewTypeReference, BNFreeType >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNTypeGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static Ref< TypeVoidType ()
 Create a "void" type. More...
 
static Ref< TypeBoolType ()
 Create a "bool" type. More...
 
static Ref< TypeIntegerType (size_t width, const Confidence< bool > &sign, const std::string &altName="")
 Create a signed or unsigned integer with a set width. More...
 
static Ref< TypeFloatType (size_t width, const std::string &altName="")
 Create a float or double Type with a specified width. More...
 
static Ref< TypeWideCharType (size_t width, const std::string &altName="")
 
static Ref< TypeStructureType (Structure *strct)
 Create a Type object from a Structure object. More...
 
static Ref< TypeNamedType (NamedTypeReference *ref, size_t width=0, size_t align=1, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0))
 
static Ref< TypeNamedType (const QualifiedName &name, Type *type)
 
static Ref< TypeNamedType (const std::string &id, const QualifiedName &name, Type *type)
 
static Ref< TypeNamedType (BinaryView *view, const QualifiedName &name)
 
static Ref< TypeEnumerationType (Architecture *arch, Enumeration *enm, size_t width=0, const Confidence< bool > &isSigned=Confidence< bool >(false, 0))
 
static Ref< TypeEnumerationType (Enumeration *enm, size_t width, const Confidence< bool > &isSigned=Confidence< bool >(false, 0))
 
static Ref< TypePointerType (Architecture *arch, const Confidence< Ref< Type > > &type, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0), BNReferenceType refType=PointerReferenceType)
 Create a Pointer type, which points to another Type. More...
 
static Ref< TypePointerType (size_t width, const Confidence< Ref< Type > > &type, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0), BNReferenceType refType=PointerReferenceType)
 Create a Pointer type, which points to another Type. More...
 
static Ref< TypeArrayType (const Confidence< Ref< Type > > &type, uint64_t elem)
 Create an Array Type. More...
 
static Ref< TypeFunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > &params, const Confidence< bool > &varArg=Confidence< bool >(false, 0), const Confidence< int64_t > &stackAdjust=Confidence< int64_t >(0, 0))
 Create a Function Type. More...
 
static Ref< TypeFunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > &params, const Confidence< bool > &hasVariableArguments, const Confidence< bool > &canReturn, const Confidence< int64_t > &stackAdjust, const std::map< uint32_t, Confidence< int32_t > > &regStackAdjust=std::map< uint32_t, Confidence< int32_t > >(), const Confidence< std::vector< uint32_t > > &returnRegs=Confidence< std::vector< uint32_t > >(std::vector< uint32_t >(), 0), BNNameType ft=NoNameType, const Confidence< bool > &pure=Confidence< bool >(false, 0))
 Create a Function Type. More...
 
static std::string GenerateAutoTypeId (const std::string &source, const QualifiedName &name)
 
static std::string GenerateAutoDemangledTypeId (const QualifiedName &name)
 
static std::string GetAutoDemangledTypeIdSource ()
 
static std::string GenerateAutoDebugTypeId (const QualifiedName &name)
 
static std::string GetAutoDebugTypeIdSource ()
 
static std::string GetSizeSuffix (size_t size)
 
- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNType, BNNewTypeReference, BNFreeType >
static BNTypeGetObject (CoreRefCountObject *obj)
 
static BNTypeGetObject (const CoreRefCountObject *obj)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNType, BNNewTypeReference, BNFreeType >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNTypem_object
 

Constructor & Destructor Documentation

◆ Type()

Type::Type ( BNType type)

Member Function Documentation

◆ operator==()

bool Type::operator== ( const Type other)

◆ operator!=()

bool Type::operator!= ( const Type other)

◆ GetClass()

BNTypeClass Type::GetClass ( ) const

Retrieve the Type Class for this Structure.

One of:

VoidTypeClass BoolTypeClass IntegerTypeClass FloatTypeClass StructureTypeClass EnumerationTypeClass PointerTypeClass ArrayTypeClass FunctionTypeClass VarArgsTypeClass ValueTypeClass NamedTypeReferenceClass WideCharTypeClass

Returns
The type class

◆ GetWidth()

uint64_t Type::GetWidth ( ) const

Get the width in bytes of the Type.

Returns
The type width

◆ GetAlignment()

size_t Type::GetAlignment ( ) const

◆ GetTypeName()

QualifiedName Type::GetTypeName ( ) const

Get the QualifiedName for the Type.

Returns
The QualifiedName for the type

◆ IsSigned()

Confidence< bool > Type::IsSigned ( ) const

Whether the type is signed.

◆ IsConst()

Confidence< bool > Type::IsConst ( ) const

Whether the type is constant.

◆ IsVolatile()

Confidence< bool > Type::IsVolatile ( ) const

◆ IsSystemCall()

bool Type::IsSystemCall ( ) const

◆ GetChildType()

Confidence< Ref< Type > > Type::GetChildType ( ) const

Get the child type for this Type if one exists.

Returns
The child type

◆ GetCallingConvention()

Confidence< Ref< CallingConvention > > Type::GetCallingConvention ( ) const

For Function Types, get the calling convention.

Returns
The CallingConvention

◆ GetParameters()

vector< FunctionParameter > Type::GetParameters ( ) const

For Function Types, get a list of parameters.

Returns
A vector of FunctionParameters

◆ HasVariableArguments()

Confidence< bool > Type::HasVariableArguments ( ) const

For Function Types, whether the Function has variadic arguments.

Returns
Whether the function has variable arguments

◆ CanReturn()

Confidence< bool > Type::CanReturn ( ) const

For Function Types, whether a function can return (is not marked noreturn)

Returns
Whether the function can return

◆ IsPure()

Confidence< bool > Type::IsPure ( ) const

For Function Types, whether a function is pure (has no observable side-effects)

Returns
Whether the function is pure

◆ GetStructure()

Ref< Structure > Type::GetStructure ( ) const

For Structure Types, the underlying Structure.

Returns
The underlying structure

◆ GetEnumeration()

Ref< Enumeration > Type::GetEnumeration ( ) const

For Enumeration Types, the underlying Enumeration.

Returns
The underlying enumeration

◆ GetNamedTypeReference()

Ref< NamedTypeReference > Type::GetNamedTypeReference ( ) const

For NamedTypeReference Types, the underlying NamedTypeReference.

Returns
The underlying NamedTypeReference

◆ GetScope()

Confidence< BNMemberScope > BinaryNinja::Type::GetScope ( ) const

◆ GetStackAdjustment()

Confidence< int64_t > Type::GetStackAdjustment ( ) const

◆ GetStructureName()

QualifiedName Type::GetStructureName ( ) const

◆ GetRegisteredName()

Ref< NamedTypeReference > Type::GetRegisteredName ( ) const

◆ GetSystemCallNumber()

uint32_t Type::GetSystemCallNumber ( ) const

◆ GetIntegerTypeDisplayType()

BNIntegerDisplayType Type::GetIntegerTypeDisplayType ( ) const

◆ GetElementCount()

uint64_t Type::GetElementCount ( ) const

◆ GetOffset()

uint64_t Type::GetOffset ( ) const

◆ GetString()

string Type::GetString ( Platform platform = nullptr,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetTypeAndName()

string Type::GetTypeAndName ( const QualifiedName name,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetStringBeforeName()

string Type::GetStringBeforeName ( Platform platform = nullptr,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetStringAfterName()

string Type::GetStringAfterName ( Platform platform = nullptr,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetTokens()

vector< InstructionTextToken > Type::GetTokens ( Platform platform = nullptr,
uint8_t  baseConfidence = 255,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetTokensBeforeName()

vector< InstructionTextToken > Type::GetTokensBeforeName ( Platform platform = nullptr,
uint8_t  baseConfidence = 255,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ GetTokensAfterName()

vector< InstructionTextToken > Type::GetTokensAfterName ( Platform platform = nullptr,
uint8_t  baseConfidence = 255,
BNTokenEscapingType  escaping = NoTokenEscapingType 
) const

◆ Duplicate()

Ref< Type > Type::Duplicate ( ) const

◆ VoidType()

Ref< Type > Type::VoidType ( )
static

Create a "void" type.

Returns
The created Type object

◆ BoolType()

Ref< Type > Type::BoolType ( )
static

Create a "bool" type.

Returns
The created Type object

◆ IntegerType()

Ref< Type > Type::IntegerType ( size_t  width,
const Confidence< bool > &  sign,
const std::string &  altName = "" 
)
static

Create a signed or unsigned integer with a set width.

Parameters
widthWidth of the Type in bytes
signWhether the integer is a signed or unsigned type
altNameAlternative name for the type
Returns
The created Type object

◆ FloatType()

Ref< Type > Type::FloatType ( size_t  width,
const std::string &  altName = "" 
)
static

Create a float or double Type with a specified width.

Parameters
widthWidth of the Type in bytes
altNameAlternative name for the type
Returns
The created Type object

◆ WideCharType()

Ref< Type > Type::WideCharType ( size_t  width,
const std::string &  altName = "" 
)
static

◆ StructureType()

Ref< Type > Type::StructureType ( Structure strct)
static

Create a Type object from a Structure object.

Structure objects can be generated using the StructureBuilder class.

Parameters
strctStructure object
Returns
The created Type object

◆ NamedType() [1/4]

Ref< Type > Type::NamedType ( NamedTypeReference ref,
size_t  width = 0,
size_t  align = 1,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0) 
)
static

◆ NamedType() [2/4]

Ref< Type > Type::NamedType ( const QualifiedName name,
Type type 
)
static

◆ NamedType() [3/4]

static Ref< Type > BinaryNinja::Type::NamedType ( const std::string &  id,
const QualifiedName name,
Type type 
)
static

◆ NamedType() [4/4]

Ref< Type > Type::NamedType ( BinaryView view,
const QualifiedName name 
)
static

◆ EnumerationType() [1/2]

Ref< Type > Type::EnumerationType ( Architecture arch,
Enumeration enm,
size_t  width = 0,
const Confidence< bool > &  isSigned = Confidence<bool>(false, 0) 
)
static

◆ EnumerationType() [2/2]

Ref< Type > Type::EnumerationType ( Enumeration enm,
size_t  width,
const Confidence< bool > &  isSigned = Confidence<bool>(false, 0) 
)
static

◆ PointerType() [1/2]

Ref< Type > Type::PointerType ( Architecture arch,
const Confidence< Ref< Type > > &  type,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0),
BNReferenceType  refType = PointerReferenceType 
)
static

Create a Pointer type, which points to another Type.

// Creating a "char *" type
auto arch = bv->GetDefaultArchitecture();
auto charPointerType = Type::PointerType(arch, Type::IntegerType(1, false));
static Ref< Type > PointerType(Architecture *arch, const Confidence< Ref< Type > > &type, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0), BNReferenceType refType=PointerReferenceType)
Create a Pointer type, which points to another Type.
Definition: type.cpp:863
static Ref< Type > IntegerType(size_t width, const Confidence< bool > &sign, const std::string &altName="")
Create a signed or unsigned integer with a set width.
Definition: type.cpp:778
Parameters
archArchitecture, used to calculate the proper pointer width
typeType that this Type points to
cnstWhether this type is const
vltlWhether this type is volatile
refTypeReference Type, one of "PointerReferenceType", "ReferenceReferenceType", "RValueReferenceType", "NoReference"
Returns
The created type

◆ PointerType() [2/2]

Ref< Type > Type::PointerType ( size_t  width,
const Confidence< Ref< Type > > &  type,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0),
BNReferenceType  refType = PointerReferenceType 
)
static

Create a Pointer type, which points to another Type.

// Creating a "char *" type in a binary compiled for 64 bit address spaces
auto charPointerType = Type::PointerType(8, Type::IntegerType(1, false));
Parameters
widthWidth of the pointer in bytes
typeType that this type points to
cnstWhether this type is const
vltlWhether this type is volatile
refTypeReference Type, one of "PointerReferenceType", "ReferenceReferenceType", "RValueReferenceType", "NoReference"
Returns
The created type

◆ ArrayType()

Ref< Type > Type::ArrayType ( const Confidence< Ref< Type > > &  type,
uint64_t  elem 
)
static

Create an Array Type.

Parameters
typeType for Elements contained in this Array
elemNumber of elements
Returns
The created Type

◆ FunctionType() [1/2]

Ref< Type > Type::FunctionType ( const Confidence< Ref< Type > > &  returnValue,
const Confidence< Ref< CallingConvention > > &  callingConvention,
const std::vector< FunctionParameter > &  params,
const Confidence< bool > &  varArg = Confidence<bool>(false, 0),
const Confidence< int64_t > &  stackAdjust = Confidence<int64_t>(0, 0) 
)
static

Create a Function Type.

std::vector<FunctionParameter> params
auto cc = bv->GetDefaultPlatform()->GetDefaultCallingConvention();
params.push_back({"arg0",
Type::IntegerType(8, false),
true,
Variable()});
auto functionType = Type::FunctionType(retType, cc, params);
Definition: binaryninjaapi.h:237
static Ref< Type > FunctionType(const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > &params, const Confidence< bool > &varArg=Confidence< bool >(false, 0), const Confidence< int64_t > &stackAdjust=Confidence< int64_t >(0, 0))
Create a Function Type.
Definition: type.cpp:910
static Ref< Type > VoidType()
Create a "void" type.
Definition: type.cpp:766
Definition: binaryninjaapi.h:8187
Parameters
returnValueReturn value Type
callingConventionCalling convention for the function
paramslist of FunctionParameter s
varArgWhether this function has variadic arguments, default false
stackAdjustStack adjustment for this function, default 0
Returns
The created function types

◆ FunctionType() [2/2]

Ref< Type > Type::FunctionType ( const Confidence< Ref< Type > > &  returnValue,
const Confidence< Ref< CallingConvention > > &  callingConvention,
const std::vector< FunctionParameter > &  params,
const Confidence< bool > &  hasVariableArguments,
const Confidence< bool > &  canReturn,
const Confidence< int64_t > &  stackAdjust,
const std::map< uint32_t, Confidence< int32_t > > &  regStackAdjust = std::map<uint32_t, Confidence<int32_t>>(),
const Confidence< std::vector< uint32_t > > &  returnRegs = Confidence<std::vector<uint32_t>>(std::vector<uint32_t>(), 0),
BNNameType  ft = NoNameType,
const Confidence< bool > &  pure = Confidence<bool>(false, 0) 
)
static

Create a Function Type.

std::vector<FunctionParameter> params
auto cc = bv->GetDefaultPlatform()->GetDefaultCallingConvention();
params.push_back({"arg0",
Type::IntegerType(8, false),
true,
Variable()});
auto functionType = Type::FunctionType(retType, cc, params);
Parameters
returnValueReturn value Type
callingConventionCalling convention for the function
paramslist of FunctionParameters
varArgWhether this function has variadic arguments, default false
stackAdjustStack adjustment for this function, default 0
regStackAdjustRegister stack adjustmemt
returnRegsReturn registers
Returns
The created function types

◆ GenerateAutoTypeId()

string Type::GenerateAutoTypeId ( const std::string &  source,
const QualifiedName name 
)
static

◆ GenerateAutoDemangledTypeId()

string Type::GenerateAutoDemangledTypeId ( const QualifiedName name)
static

◆ GetAutoDemangledTypeIdSource()

string Type::GetAutoDemangledTypeIdSource ( )
static

◆ GenerateAutoDebugTypeId()

string Type::GenerateAutoDebugTypeId ( const QualifiedName name)
static

◆ GetAutoDebugTypeIdSource()

string Type::GetAutoDebugTypeIdSource ( )
static

◆ WithConfidence()

Confidence< Ref< Type > > Type::WithConfidence ( uint8_t  conf)

Get this type wrapped in a Confidence template.

Parameters
confConfidence value between 0 and 255
Returns
Confidence-wrapped Type

◆ IsReferenceOfType()

bool Type::IsReferenceOfType ( BNNamedTypeReferenceClass  refType)

If this Type is a NamedTypeReference, check whether it is reference to a specific Type.

Parameters
refTypeBNNamedTypeReference to check it against
Returns
Whether it is a reference of this type

◆ IsStructReference()

bool BinaryNinja::Type::IsStructReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to a Struct Type.

Returns
Whether it refers to a struct type.

◆ IsEnumReference()

bool BinaryNinja::Type::IsEnumReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to an Enum Type.

Returns
Whether it refers to an Enum type.

◆ IsUnionReference()

bool BinaryNinja::Type::IsUnionReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to a Union Type.

Returns
Whether it refers to a union type.

◆ IsClassReference()

bool BinaryNinja::Type::IsClassReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to a Class Type.

Returns
Whether it refers to a class type.

◆ IsTypedefReference()

bool BinaryNinja::Type::IsTypedefReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to a Typedef type.

Returns
Whether it refers to a typedef type.

◆ IsStructOrClassReference()

bool BinaryNinja::Type::IsStructOrClassReference ( )
inline

If this Type is a NamedTypeReference, check whether it refers to a Struct or Class Type.

Returns
Whether it refers to a struct or class type.

◆ IsVoid()

bool BinaryNinja::Type::IsVoid ( ) const
inline

Check whether this type is a Void type.

Returns
Whether this->GetClass() == VoidTypeClass

◆ IsBool()

bool BinaryNinja::Type::IsBool ( ) const
inline

Check whether this type is a Boolean type.

Returns
Whether this->GetClass() == BoolTypeClass

◆ IsInteger()

bool BinaryNinja::Type::IsInteger ( ) const
inline

Check whether this type is an Integer type.

Returns
Whether this->GetClass() == IntegerTypeClass

◆ IsFloat()

bool BinaryNinja::Type::IsFloat ( ) const
inline

Check whether this type is a Float type.

Returns
Whether this->GetClass() == FloatTypeClass

◆ IsStructure()

bool BinaryNinja::Type::IsStructure ( ) const
inline

Check whether this type is a Structure type.

Returns
Whether this->GetClass() == StructureTypeClass

◆ IsEnumeration()

bool BinaryNinja::Type::IsEnumeration ( ) const
inline

Check whether this type is an Enumeration type.

Returns
Whether this->GetClass() == EnumerationTypeClass

◆ IsPointer()

bool BinaryNinja::Type::IsPointer ( ) const
inline

Check whether this type is a Pointer type.

Returns
Whether this->GetClass() == PointerTypeClass

◆ IsArray()

bool BinaryNinja::Type::IsArray ( ) const
inline

Check whether this type is an Array type.

Returns
Whether this->GetClass() == ArrayTypeClass

◆ IsFunction()

bool BinaryNinja::Type::IsFunction ( ) const
inline

Check whether this type is a Function type.

Returns
Whether this->GetClass() == FunctionTypeClass

◆ IsVarArgs()

bool BinaryNinja::Type::IsVarArgs ( ) const
inline

Check whether this type is a Variadic Arguments type.

Returns
Whether this->GetClass() == VarArgsTypeClass

◆ IsValue()

bool BinaryNinja::Type::IsValue ( ) const
inline

Check whether this type is a Value type.

Returns
Whether this->GetClass() == ValueTypeClass

◆ IsNamedTypeRefer()

bool BinaryNinja::Type::IsNamedTypeRefer ( ) const
inline

Check whether this type is a Named Type Reference type.

Returns
Whether this->GetClass() == NamedTypeReferenceClass

◆ IsWideChar()

bool BinaryNinja::Type::IsWideChar ( ) const
inline

Check whether this type is a Wide Char type.

Returns
Whether this->GetClass() == WideCharTypeClass

◆ WithReplacedStructure()

Ref< Type > Type::WithReplacedStructure ( Structure from,
Structure to 
)

◆ WithReplacedEnumeration()

Ref< Type > Type::WithReplacedEnumeration ( Enumeration from,
Enumeration to 
)

◆ WithReplacedNamedTypeReference()

Ref< Type > Type::WithReplacedNamedTypeReference ( NamedTypeReference from,
NamedTypeReference to 
)

◆ AddTypeMemberTokens()

bool Type::AddTypeMemberTokens ( BinaryView data,
std::vector< InstructionTextToken > &  tokens,
int64_t  offset,
std::vector< std::string > &  nameList,
size_t  size = 0,
bool  indirect = false 
)

◆ GetLines()

std::vector< TypeDefinitionLine > Type::GetLines ( const TypeContainer types,
const std::string &  name,
int  lineWidth = 80,
bool  collapsed = false,
BNTokenEscapingType  escaping = NoTokenEscapingType 
)

◆ GetSizeSuffix()

string Type::GetSizeSuffix ( size_t  size)
static

◆ BinaryNinja::TypeBuilder

class BinaryNinja::TypeBuilder

Public Member Functions

 TypeBuilder ()
 
 TypeBuilder (BNTypeBuilder *type)
 
 TypeBuilder (const TypeBuilder &type)
 
 TypeBuilder (TypeBuilder &&type)
 
 TypeBuilder (Type *type)
 
TypeBuilderoperator= (const TypeBuilder &type)
 
TypeBuilderoperator= (TypeBuilder &&type)
 
TypeBuilderoperator= (Type *type)
 
Ref< TypeFinalize ()
 
BNTypeClass GetClass () const
 
uint64_t GetWidth () const
 
size_t GetAlignment () const
 
QualifiedName GetTypeName () const
 
Confidence< bool > IsSigned () const
 
Confidence< bool > IsConst () const
 
Confidence< bool > IsVolatile () const
 
bool IsSystemCall () const
 
void SetIntegerTypeDisplayType (BNIntegerDisplayType displayType)
 
Confidence< Ref< Type > > GetChildType () const
 
Confidence< Ref< CallingConvention > > GetCallingConvention () const
 
std::vector< FunctionParameterGetParameters () const
 
Confidence< bool > HasVariableArguments () const
 
Confidence< bool > CanReturn () const
 
Confidence< bool > IsPure () const
 
Ref< StructureGetStructure () const
 
Ref< EnumerationGetEnumeration () const
 
Ref< NamedTypeReferenceGetNamedTypeReference () const
 
Confidence< BNMemberScopeGetScope () const
 
TypeBuilderSetNamedTypeReference (NamedTypeReference *ntr)
 
TypeBuilderSetScope (const Confidence< BNMemberScope > &scope)
 
TypeBuilderSetConst (const Confidence< bool > &cnst)
 
TypeBuilderSetVolatile (const Confidence< bool > &vltl)
 
TypeBuilderSetChildType (const Confidence< Ref< Type > > &child)
 
TypeBuilderSetSigned (const Confidence< bool > &vltl)
 
TypeBuilderSetTypeName (const QualifiedName &name)
 
TypeBuilderSetAlternateName (const std::string &name)
 
TypeBuilderSetSystemCall (bool sc, uint32_t n=0)
 
Confidence< int64_t > GetStackAdjustment () const
 
QualifiedName GetStructureName () const
 
uint64_t GetElementCount () const
 
uint64_t GetOffset () const
 
uint32_t GetSystemCallNumber () const
 
TypeBuilderSetOffset (uint64_t offset)
 
TypeBuilderSetFunctionCanReturn (const Confidence< bool > &canReturn)
 
TypeBuilderSetPure (const Confidence< bool > &pure)
 
TypeBuilderSetParameters (const std::vector< FunctionParameter > &params)
 
std::string GetString (Platform *platform=nullptr) const
 
std::string GetTypeAndName (const QualifiedName &name) const
 
std::string GetStringBeforeName (Platform *platform=nullptr) const
 
std::string GetStringAfterName (Platform *platform=nullptr) const
 
std::vector< InstructionTextTokenGetTokens (Platform *platform=nullptr, uint8_t baseConfidence=255) const
 
std::vector< InstructionTextTokenGetTokensBeforeName (Platform *platform=nullptr, uint8_t baseConfidence=255) const
 
std::vector< InstructionTextTokenGetTokensAfterName (Platform *platform=nullptr, uint8_t baseConfidence=255) const
 
bool IsReferenceOfType (BNNamedTypeReferenceClass refType)
 
bool IsStructReference ()
 
bool IsEnumReference ()
 
bool IsUnionReference ()
 
bool IsClassReference ()
 
bool IsTypedefReference ()
 
bool IsStructOrClassReference ()
 
bool IsVoid () const
 
bool IsBool () const
 
bool IsInteger () const
 
bool IsFloat () const
 
bool IsStructure () const
 
bool IsEnumeration () const
 
bool IsPointer () const
 
bool IsArray () const
 
bool IsFunction () const
 
bool IsVarArgs () const
 
bool IsValue () const
 
bool IsNamedTypeRefer () const
 
bool IsWideChar () const
 

Static Public Member Functions

static TypeBuilder VoidType ()
 
static TypeBuilder BoolType ()
 
static TypeBuilder IntegerType (size_t width, const Confidence< bool > &sign, const std::string &altName="")
 
static TypeBuilder FloatType (size_t width, const std::string &typeName="")
 
static TypeBuilder WideCharType (size_t width, const std::string &typeName="")
 
static TypeBuilder StructureType (Structure *strct)
 
static TypeBuilder StructureType (StructureBuilder *strct)
 
static TypeBuilder NamedType (NamedTypeReference *ref, size_t width=0, size_t align=1, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0))
 
static TypeBuilder NamedType (NamedTypeReferenceBuilder *ref, size_t width=0, size_t align=1, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0))
 
static TypeBuilder NamedType (const QualifiedName &name, Type *type)
 
static TypeBuilder NamedType (const std::string &id, const QualifiedName &name, Type *type)
 
static TypeBuilder NamedType (BinaryView *view, const QualifiedName &name)
 
static TypeBuilder EnumerationType (Architecture *arch, Enumeration *enm, size_t width=0, const Confidence< bool > &issigned=Confidence< bool >(false, 0))
 
static TypeBuilder EnumerationType (Architecture *arch, EnumerationBuilder *enm, size_t width=0, const Confidence< bool > &issigned=Confidence< bool >(false, 0))
 
static TypeBuilder PointerType (Architecture *arch, const Confidence< Ref< Type > > &type, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0), BNReferenceType refType=PointerReferenceType)
 
static TypeBuilder PointerType (size_t width, const Confidence< Ref< Type > > &type, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0), BNReferenceType refType=PointerReferenceType)
 
static TypeBuilder ArrayType (const Confidence< Ref< Type > > &type, uint64_t elem)
 
static TypeBuilder FunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > &params, const Confidence< bool > &varArg=Confidence< bool >(false, 0), const Confidence< int64_t > &stackAdjust=Confidence< int64_t >(0, 0))
 
static TypeBuilder FunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > &params, const Confidence< bool > &hasVariableArguments, const Confidence< bool > &canReturn, const Confidence< int64_t > &stackAdjust, const std::map< uint32_t, Confidence< int32_t > > &regStackAdjust=std::map< uint32_t, Confidence< int32_t > >(), const Confidence< std::vector< uint32_t > > &returnRegs=Confidence< std::vector< uint32_t > >(std::vector< uint32_t >(), 0), BNNameType ft=NoNameType, const Confidence< bool > &pure=Confidence< bool >(false, 0))
 

Constructor & Destructor Documentation

◆ TypeBuilder() [1/5]

TypeBuilder::TypeBuilder ( )

◆ TypeBuilder() [2/5]

TypeBuilder::TypeBuilder ( BNTypeBuilder type)

◆ TypeBuilder() [3/5]

TypeBuilder::TypeBuilder ( const TypeBuilder type)

◆ TypeBuilder() [4/5]

TypeBuilder::TypeBuilder ( TypeBuilder &&  type)

◆ TypeBuilder() [5/5]

TypeBuilder::TypeBuilder ( Type type)

Member Function Documentation

◆ operator=() [1/3]

TypeBuilder & TypeBuilder::operator= ( const TypeBuilder type)

◆ operator=() [2/3]

TypeBuilder & TypeBuilder::operator= ( TypeBuilder &&  type)

◆ operator=() [3/3]

TypeBuilder & TypeBuilder::operator= ( Type type)

◆ Finalize()

Ref< Type > TypeBuilder::Finalize ( )

◆ GetClass()

BNTypeClass TypeBuilder::GetClass ( ) const

◆ GetWidth()

uint64_t TypeBuilder::GetWidth ( ) const

◆ GetAlignment()

size_t TypeBuilder::GetAlignment ( ) const

◆ GetTypeName()

QualifiedName TypeBuilder::GetTypeName ( ) const

◆ IsSigned()

Confidence< bool > TypeBuilder::IsSigned ( ) const

◆ IsConst()

Confidence< bool > TypeBuilder::IsConst ( ) const

◆ IsVolatile()

Confidence< bool > BinaryNinja::TypeBuilder::IsVolatile ( ) const

◆ IsSystemCall()

bool TypeBuilder::IsSystemCall ( ) const

◆ SetIntegerTypeDisplayType()

void TypeBuilder::SetIntegerTypeDisplayType ( BNIntegerDisplayType  displayType)

◆ GetChildType()

Confidence< Ref< Type > > TypeBuilder::GetChildType ( ) const

◆ GetCallingConvention()

Confidence< Ref< CallingConvention > > TypeBuilder::GetCallingConvention ( ) const

◆ GetParameters()

vector< FunctionParameter > TypeBuilder::GetParameters ( ) const

◆ HasVariableArguments()

Confidence< bool > TypeBuilder::HasVariableArguments ( ) const

◆ CanReturn()

Confidence< bool > TypeBuilder::CanReturn ( ) const

◆ IsPure()

Confidence< bool > TypeBuilder::IsPure ( ) const

◆ GetStructure()

Ref< Structure > TypeBuilder::GetStructure ( ) const

◆ GetEnumeration()

Ref< Enumeration > TypeBuilder::GetEnumeration ( ) const

◆ GetNamedTypeReference()

Ref< NamedTypeReference > TypeBuilder::GetNamedTypeReference ( ) const

◆ GetScope()

Confidence< BNMemberScope > BinaryNinja::TypeBuilder::GetScope ( ) const

◆ SetNamedTypeReference()

TypeBuilder & TypeBuilder::SetNamedTypeReference ( NamedTypeReference ntr)

◆ SetScope()

TypeBuilder & BinaryNinja::TypeBuilder::SetScope ( const Confidence< BNMemberScope > &  scope)

◆ SetConst()

TypeBuilder & TypeBuilder::SetConst ( const Confidence< bool > &  cnst)

◆ SetVolatile()

TypeBuilder & TypeBuilder::SetVolatile ( const Confidence< bool > &  vltl)

◆ SetChildType()

TypeBuilder & TypeBuilder::SetChildType ( const Confidence< Ref< Type > > &  child)

◆ SetSigned()

TypeBuilder & TypeBuilder::SetSigned ( const Confidence< bool > &  vltl)

◆ SetTypeName()

TypeBuilder & TypeBuilder::SetTypeName ( const QualifiedName name)

◆ SetAlternateName()

TypeBuilder & TypeBuilder::SetAlternateName ( const std::string &  name)

◆ SetSystemCall()

TypeBuilder & TypeBuilder::SetSystemCall ( bool  sc,
uint32_t  n = 0 
)

◆ GetStackAdjustment()

Confidence< int64_t > TypeBuilder::GetStackAdjustment ( ) const

◆ GetStructureName()

QualifiedName TypeBuilder::GetStructureName ( ) const

◆ GetElementCount()

uint64_t TypeBuilder::GetElementCount ( ) const

◆ GetOffset()

uint64_t TypeBuilder::GetOffset ( ) const

◆ GetSystemCallNumber()

uint32_t TypeBuilder::GetSystemCallNumber ( ) const

◆ SetOffset()

TypeBuilder & TypeBuilder::SetOffset ( uint64_t  offset)

◆ SetFunctionCanReturn()

TypeBuilder & TypeBuilder::SetFunctionCanReturn ( const Confidence< bool > &  canReturn)

◆ SetPure()

TypeBuilder & TypeBuilder::SetPure ( const Confidence< bool > &  pure)

◆ SetParameters()

TypeBuilder & TypeBuilder::SetParameters ( const std::vector< FunctionParameter > &  params)

◆ GetString()

string TypeBuilder::GetString ( Platform platform = nullptr) const

◆ GetTypeAndName()

string TypeBuilder::GetTypeAndName ( const QualifiedName name) const

◆ GetStringBeforeName()

string TypeBuilder::GetStringBeforeName ( Platform platform = nullptr) const

◆ GetStringAfterName()

string TypeBuilder::GetStringAfterName ( Platform platform = nullptr) const

◆ GetTokens()

vector< InstructionTextToken > TypeBuilder::GetTokens ( Platform platform = nullptr,
uint8_t  baseConfidence = 255 
) const

◆ GetTokensBeforeName()

vector< InstructionTextToken > TypeBuilder::GetTokensBeforeName ( Platform platform = nullptr,
uint8_t  baseConfidence = 255 
) const

◆ GetTokensAfterName()

vector< InstructionTextToken > TypeBuilder::GetTokensAfterName ( Platform platform = nullptr,
uint8_t  baseConfidence = 255 
) const

◆ VoidType()

TypeBuilder TypeBuilder::VoidType ( )
static

◆ BoolType()

TypeBuilder TypeBuilder::BoolType ( )
static

◆ IntegerType()

TypeBuilder TypeBuilder::IntegerType ( size_t  width,
const Confidence< bool > &  sign,
const std::string &  altName = "" 
)
static

◆ FloatType()

TypeBuilder TypeBuilder::FloatType ( size_t  width,
const std::string &  typeName = "" 
)
static

◆ WideCharType()

TypeBuilder TypeBuilder::WideCharType ( size_t  width,
const std::string &  typeName = "" 
)
static

◆ StructureType() [1/2]

TypeBuilder TypeBuilder::StructureType ( Structure strct)
static

◆ StructureType() [2/2]

TypeBuilder TypeBuilder::StructureType ( StructureBuilder strct)
static

◆ NamedType() [1/5]

TypeBuilder TypeBuilder::NamedType ( NamedTypeReference ref,
size_t  width = 0,
size_t  align = 1,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0) 
)
static

◆ NamedType() [2/5]

TypeBuilder TypeBuilder::NamedType ( NamedTypeReferenceBuilder ref,
size_t  width = 0,
size_t  align = 1,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0) 
)
static

◆ NamedType() [3/5]

TypeBuilder TypeBuilder::NamedType ( const QualifiedName name,
Type type 
)
static

◆ NamedType() [4/5]

static TypeBuilder BinaryNinja::TypeBuilder::NamedType ( const std::string &  id,
const QualifiedName name,
Type type 
)
static

◆ NamedType() [5/5]

TypeBuilder TypeBuilder::NamedType ( BinaryView view,
const QualifiedName name 
)
static

◆ EnumerationType() [1/2]

TypeBuilder TypeBuilder::EnumerationType ( Architecture arch,
Enumeration enm,
size_t  width = 0,
const Confidence< bool > &  issigned = Confidence<bool>(false, 0) 
)
static

◆ EnumerationType() [2/2]

TypeBuilder TypeBuilder::EnumerationType ( Architecture arch,
EnumerationBuilder enm,
size_t  width = 0,
const Confidence< bool > &  issigned = Confidence<bool>(false, 0) 
)
static

◆ PointerType() [1/2]

TypeBuilder TypeBuilder::PointerType ( Architecture arch,
const Confidence< Ref< Type > > &  type,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0),
BNReferenceType  refType = PointerReferenceType 
)
static

◆ PointerType() [2/2]

TypeBuilder TypeBuilder::PointerType ( size_t  width,
const Confidence< Ref< Type > > &  type,
const Confidence< bool > &  cnst = Confidence<bool>(false, 0),
const Confidence< bool > &  vltl = Confidence<bool>(false, 0),
BNReferenceType  refType = PointerReferenceType 
)
static

◆ ArrayType()

TypeBuilder TypeBuilder::ArrayType ( const Confidence< Ref< Type > > &  type,
uint64_t  elem 
)
static

◆ FunctionType() [1/2]

TypeBuilder TypeBuilder::FunctionType ( const Confidence< Ref< Type > > &  returnValue,
const Confidence< Ref< CallingConvention > > &  callingConvention,
const std::vector< FunctionParameter > &  params,
const Confidence< bool > &  varArg = Confidence<bool>(false, 0),
const Confidence< int64_t > &  stackAdjust = Confidence<int64_t>(0, 0) 
)
static

◆ FunctionType() [2/2]

TypeBuilder TypeBuilder::FunctionType ( const Confidence< Ref< Type > > &  returnValue,
const Confidence< Ref< CallingConvention > > &  callingConvention,
const std::vector< FunctionParameter > &  params,
const Confidence< bool > &  hasVariableArguments,
const Confidence< bool > &  canReturn,
const Confidence< int64_t > &  stackAdjust,
const std::map< uint32_t, Confidence< int32_t > > &  regStackAdjust = std::map<uint32_t, Confidence<int32_t>>(),
const Confidence< std::vector< uint32_t > > &  returnRegs = Confidence<std::vector<uint32_t>>(std::vector<uint32_t>(), 0),
BNNameType  ft = NoNameType,
const Confidence< bool > &  pure = Confidence<bool>(false, 0) 
)
static

◆ IsReferenceOfType()

bool BinaryNinja::TypeBuilder::IsReferenceOfType ( BNNamedTypeReferenceClass  refType)

◆ IsStructReference()

bool BinaryNinja::TypeBuilder::IsStructReference ( )
inline

◆ IsEnumReference()

bool BinaryNinja::TypeBuilder::IsEnumReference ( )
inline

◆ IsUnionReference()

bool BinaryNinja::TypeBuilder::IsUnionReference ( )
inline

◆ IsClassReference()

bool BinaryNinja::TypeBuilder::IsClassReference ( )
inline

◆ IsTypedefReference()

bool BinaryNinja::TypeBuilder::IsTypedefReference ( )
inline

◆ IsStructOrClassReference()

bool BinaryNinja::TypeBuilder::IsStructOrClassReference ( )
inline

◆ IsVoid()

bool BinaryNinja::TypeBuilder::IsVoid ( ) const
inline

◆ IsBool()

bool BinaryNinja::TypeBuilder::IsBool ( ) const
inline

◆ IsInteger()

bool BinaryNinja::TypeBuilder::IsInteger ( ) const
inline

◆ IsFloat()

bool BinaryNinja::TypeBuilder::IsFloat ( ) const
inline

◆ IsStructure()

bool BinaryNinja::TypeBuilder::IsStructure ( ) const
inline

◆ IsEnumeration()

bool BinaryNinja::TypeBuilder::IsEnumeration ( ) const
inline

◆ IsPointer()

bool BinaryNinja::TypeBuilder::IsPointer ( ) const
inline

◆ IsArray()

bool BinaryNinja::TypeBuilder::IsArray ( ) const
inline

◆ IsFunction()

bool BinaryNinja::TypeBuilder::IsFunction ( ) const
inline

◆ IsVarArgs()

bool BinaryNinja::TypeBuilder::IsVarArgs ( ) const
inline

◆ IsValue()

bool BinaryNinja::TypeBuilder::IsValue ( ) const
inline

◆ IsNamedTypeRefer()

bool BinaryNinja::TypeBuilder::IsNamedTypeRefer ( ) const
inline

◆ IsWideChar()

bool BinaryNinja::TypeBuilder::IsWideChar ( ) const
inline

◆ BinaryNinja::NamedTypeReference

class BinaryNinja::NamedTypeReference

Public Member Functions

 NamedTypeReference (BNNamedTypeReference *nt)
 
 NamedTypeReference (BNNamedTypeReferenceClass cls=UnknownNamedTypeClass, const std::string &id="", const QualifiedName &name=QualifiedName())
 
BNNamedTypeReferenceClass GetTypeReferenceClass () const
 
std::string GetTypeId () const
 
QualifiedName GetName () const
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNNamedTypeReference, BNNewNamedTypeReference, BNFreeNamedTypeReference >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNNamedTypeReferenceGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static Ref< NamedTypeReferenceGenerateAutoTypeReference (BNNamedTypeReferenceClass cls, const std::string &source, const QualifiedName &name)
 
static Ref< NamedTypeReferenceGenerateAutoDemangledTypeReference (BNNamedTypeReferenceClass cls, const QualifiedName &name)
 
static Ref< NamedTypeReferenceGenerateAutoDebugTypeReference (BNNamedTypeReferenceClass cls, const QualifiedName &name)
 
- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNNamedTypeReference, BNNewNamedTypeReference, BNFreeNamedTypeReference >
static BNNamedTypeReferenceGetObject (CoreRefCountObject *obj)
 
static BNNamedTypeReferenceGetObject (const CoreRefCountObject *obj)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNNamedTypeReference, BNNewNamedTypeReference, BNFreeNamedTypeReference >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNNamedTypeReferencem_object
 

Constructor & Destructor Documentation

◆ NamedTypeReference() [1/2]

NamedTypeReference::NamedTypeReference ( BNNamedTypeReference nt)

◆ NamedTypeReference() [2/2]

BinaryNinja::NamedTypeReference::NamedTypeReference ( BNNamedTypeReferenceClass  cls = UnknownNamedTypeClass,
const std::string &  id = "",
const QualifiedName name = QualifiedName() 
)

Member Function Documentation

◆ GetTypeReferenceClass()

BNNamedTypeReferenceClass NamedTypeReference::GetTypeReferenceClass ( ) const

◆ GetTypeId()

string NamedTypeReference::GetTypeId ( ) const

◆ GetName()

QualifiedName NamedTypeReference::GetName ( ) const

◆ GenerateAutoTypeReference()

Ref< NamedTypeReference > NamedTypeReference::GenerateAutoTypeReference ( BNNamedTypeReferenceClass  cls,
const std::string &  source,
const QualifiedName name 
)
static

◆ GenerateAutoDemangledTypeReference()

Ref< NamedTypeReference > NamedTypeReference::GenerateAutoDemangledTypeReference ( BNNamedTypeReferenceClass  cls,
const QualifiedName name 
)
static

◆ GenerateAutoDebugTypeReference()

Ref< NamedTypeReference > NamedTypeReference::GenerateAutoDebugTypeReference ( BNNamedTypeReferenceClass  cls,
const QualifiedName name 
)
static

◆ BinaryNinja::NamedTypeReferenceBuilder

class BinaryNinja::NamedTypeReferenceBuilder

Public Member Functions

 NamedTypeReferenceBuilder (BNNamedTypeReferenceBuilder *nt)
 
 NamedTypeReferenceBuilder (BNNamedTypeReferenceClass cls=UnknownNamedTypeClass, const std::string &id="", const QualifiedName &name=QualifiedName())
 
 ~NamedTypeReferenceBuilder ()
 
BNNamedTypeReferenceBuilderGetObject ()
 
BNNamedTypeReferenceClass GetTypeReferenceClass () const
 
std::string GetTypeId () const
 
QualifiedName GetName () const
 
void SetTypeReferenceClass (BNNamedTypeReferenceClass type)
 
void SetTypeId (const std::string &id)
 
void SetName (const QualifiedName &name)
 
Ref< NamedTypeReferenceFinalize ()
 

Constructor & Destructor Documentation

◆ NamedTypeReferenceBuilder() [1/2]

NamedTypeReferenceBuilder::NamedTypeReferenceBuilder ( BNNamedTypeReferenceBuilder nt)

◆ NamedTypeReferenceBuilder() [2/2]

NamedTypeReferenceBuilder::NamedTypeReferenceBuilder ( BNNamedTypeReferenceClass  cls = UnknownNamedTypeClass,
const std::string &  id = "",
const QualifiedName name = QualifiedName() 
)

◆ ~NamedTypeReferenceBuilder()

NamedTypeReferenceBuilder::~NamedTypeReferenceBuilder ( )

Member Function Documentation

◆ GetObject()

BNNamedTypeReferenceBuilder * BinaryNinja::NamedTypeReferenceBuilder::GetObject ( )
inline

◆ GetTypeReferenceClass()

BNNamedTypeReferenceClass NamedTypeReferenceBuilder::GetTypeReferenceClass ( ) const

◆ GetTypeId()

std::string NamedTypeReferenceBuilder::GetTypeId ( ) const

◆ GetName()

QualifiedName NamedTypeReferenceBuilder::GetName ( ) const

◆ SetTypeReferenceClass()

void NamedTypeReferenceBuilder::SetTypeReferenceClass ( BNNamedTypeReferenceClass  type)

◆ SetTypeId()

void NamedTypeReferenceBuilder::SetTypeId ( const std::string &  id)

◆ SetName()

void NamedTypeReferenceBuilder::SetName ( const QualifiedName name)

◆ Finalize()

Ref< NamedTypeReference > NamedTypeReferenceBuilder::Finalize ( )

◆ BinaryNinja::StructureMember

struct BinaryNinja::StructureMember
Class Members
Confidence< Ref< Type > > type
string name
uint64_t offset
BNMemberAccess access
BNMemberScope scope

◆ BinaryNinja::InheritedStructureMember

struct BinaryNinja::InheritedStructureMember
Class Members
Ref< NamedTypeReference > base
uint64_t baseOffset
StructureMember member
size_t memberIndex

◆ BinaryNinja::BaseStructure

struct BinaryNinja::BaseStructure

Public Member Functions

 BaseStructure (NamedTypeReference *type, uint64_t offset, uint64_t width)
 
 BaseStructure (Type *type, uint64_t offset)
 

Public Attributes

Ref< NamedTypeReferencetype
 
uint64_t offset
 
uint64_t width
 

Constructor & Destructor Documentation

◆ BaseStructure() [1/2]

BaseStructure::BaseStructure ( NamedTypeReference type,
uint64_t  offset,
uint64_t  width 
)

◆ BaseStructure() [2/2]

BaseStructure::BaseStructure ( Type type,
uint64_t  offset 
)

Member Data Documentation

◆ type

Ref<NamedTypeReference> BinaryNinja::BaseStructure::type

◆ offset

uint64_t BinaryNinja::BaseStructure::offset

◆ width

uint64_t BinaryNinja::BaseStructure::width

◆ BinaryNinja::Structure

class BinaryNinja::Structure

Structure is a class that wraps built structures and retrieves info about them.

See also
StructureBuilder is used for building structures

Public Member Functions

 Structure (BNStructure *s)
 
std::vector< BaseStructureGetBaseStructures () const
 Get a list of base structures. More...
 
std::vector< StructureMemberGetMembers () const
 Get a list of Structure members, excluding those inherited from base structures. More...
 
std::vector< InheritedStructureMemberGetMembersIncludingInherited (const TypeContainer &types) const
 Get a list of Structure members, including those inherited from base structures. More...
 
bool GetMemberIncludingInheritedAtOffset (BinaryView *view, int64_t offset, InheritedStructureMember &result) const
 Get a structure member (including inherited members) at a certain offset. More...
 
bool GetMemberByName (const std::string &name, StructureMember &result) const
 Get a structure member by name. More...
 
bool GetMemberAtOffset (int64_t offset, StructureMember &result) const
 Get a structure member at a certain offset. More...
 
bool GetMemberAtOffset (int64_t offset, StructureMember &result, size_t &idx) const
 Get a structure member and its index at a certain offset. More...
 
uint64_t GetWidth () const
 Get the structure width in bytes. More...
 
int64_t GetPointerOffset () const
 Get the structure pointer offset in bytes. More...
 
size_t GetAlignment () const
 Get the structure alignment. More...
 
bool IsPacked () const
 Whether the structure is packed. More...
 
bool IsUnion () const
 Whether the structure is a union. More...
 
bool PropagateDataVariableReferences () const
 Whether structure field references propagate the references to data variable field values. More...
 
BNStructureVariant GetStructureType () const
 Get the structure type. More...
 
Ref< StructureWithReplacedStructure (Structure *from, Structure *to)
 
Ref< StructureWithReplacedEnumeration (Enumeration *from, Enumeration *to)
 
Ref< StructureWithReplacedNamedTypeReference (NamedTypeReference *from, NamedTypeReference *to)
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNStructure, BNNewStructureReference, BNFreeStructure >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNStructureGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNStructure, BNNewStructureReference, BNFreeStructure >
static BNStructureGetObject (CoreRefCountObject *obj)
 
static BNStructureGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNStructure, BNNewStructureReference, BNFreeStructure >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNStructurem_object
 

Constructor & Destructor Documentation

◆ Structure()

Structure::Structure ( BNStructure s)

Member Function Documentation

◆ GetBaseStructures()

vector< BaseStructure > Structure::GetBaseStructures ( ) const

Get a list of base structures.

Offsets that are not defined by this structure will be filled in by the fields of the base structure(s).

Returns
The list of base structures

◆ GetMembers()

vector< StructureMember > Structure::GetMembers ( ) const

Get a list of Structure members, excluding those inherited from base structures.

Returns
The list of structure members

◆ GetMembersIncludingInherited()

vector< InheritedStructureMember > Structure::GetMembersIncludingInherited ( const TypeContainer types) const

Get a list of Structure members, including those inherited from base structures.

Returns
The list of structure members

◆ GetMemberIncludingInheritedAtOffset()

bool Structure::GetMemberIncludingInheritedAtOffset ( BinaryView view,
int64_t  offset,
InheritedStructureMember result 
) const

Get a structure member (including inherited members) at a certain offset.

Parameters
viewThe relevant binary view
offsetOffset to check
resultReference to a InheritedStructureMember to copy the result to
Returns
Whether a member was found

◆ GetMemberByName()

bool Structure::GetMemberByName ( const std::string &  name,
StructureMember result 
) const

Get a structure member by name.

Parameters
nameName of the member to retrieve
resultReference to a StructureMember to copy the result to
Returns
Whether a member was found

◆ GetMemberAtOffset() [1/2]

bool Structure::GetMemberAtOffset ( int64_t  offset,
StructureMember result 
) const

Get a structure member at a certain offset.

Parameters
offsetOffset to check
resultReference to a StructureMember to copy the result to
Returns
Whether a member was found

◆ GetMemberAtOffset() [2/2]

bool Structure::GetMemberAtOffset ( int64_t  offset,
StructureMember result,
size_t &  idx 
) const

Get a structure member and its index at a certain offset.

Parameters
offsetOffset to check
resultReference to a StructureMember to copy the result to
idxReference to a size_t to copy the index to
Returns
Whether a member was found

◆ GetWidth()

uint64_t Structure::GetWidth ( ) const

Get the structure width in bytes.

Returns
The structure width in bytes

◆ GetPointerOffset()

int64_t Structure::GetPointerOffset ( ) const

Get the structure pointer offset in bytes.

Pointers to this structure will implicitly have this offset subtracted from the pointer to arrive at the start of the structure. Effectively, the pointer offset becomes the new start of the structure, and fields before it are accessed using negative offsets from the pointer.

Returns
The structure pointer offset in bytes

◆ GetAlignment()

size_t Structure::GetAlignment ( ) const

Get the structure alignment.

Returns
The structure alignment

◆ IsPacked()

bool Structure::IsPacked ( ) const

Whether the structure is packed.

Returns
Whether the structure is packed

◆ IsUnion()

bool Structure::IsUnion ( ) const

Whether the structure is a union.

Returns
Whether the structure is a union

◆ PropagateDataVariableReferences()

bool Structure::PropagateDataVariableReferences ( ) const

Whether structure field references propagate the references to data variable field values.

Returns
Whether the structure propagates data variable references

◆ GetStructureType()

BNStructureVariant Structure::GetStructureType ( ) const

Get the structure type.

Returns
The structure type

◆ WithReplacedStructure()

Ref< Structure > Structure::WithReplacedStructure ( Structure from,
Structure to 
)

◆ WithReplacedEnumeration()

Ref< Structure > Structure::WithReplacedEnumeration ( Enumeration from,
Enumeration to 
)

◆ WithReplacedNamedTypeReference()

Ref< Structure > Structure::WithReplacedNamedTypeReference ( NamedTypeReference from,
NamedTypeReference to 
)

◆ BinaryNinja::StructureBuilder

class BinaryNinja::StructureBuilder

StructureBuilder is a convenience class used for building Structure Types.

Example:

StructureBuilder versionMinBuilder;
versionMinBuilder.AddMember(Type::NamedType(bv, cmdTypeEnumQualName), "cmd");
versionMinBuilder.AddMember(Type::IntegerType(4, false), "cmdsize");
versionMinBuilder.AddMember(Type::IntegerType(4, false), "version");
versionMinBuilder.AddMember(Type::IntegerType(4, false), "sdk");
Ref<Structure> versionMinStruct = versionMinBuilder.Finalize();
QualifiedName versionMinName = string("version_min");
string versionMinTypeId = Type::GenerateAutoTypeId("macho", versionMinName);
Ref<Type> versionMinType = Type::StructureType(versionMinStruct);
QualifiedName versionMinQualName = bv->GetAnalysis()->DefineType(versionMinTypeId, versionMinName, versionMinType);
Definition: binaryninjaapi.h:3647
static Ref< Type > StructureType(Structure *strct)
Create a Type object from a Structure object.
Definition: type.cpp:799
static Ref< Type > NamedType(NamedTypeReference *ref, size_t width=0, size_t align=1, const Confidence< bool > &cnst=Confidence< bool >(false, 0), const Confidence< bool > &vltl=Confidence< bool >(false, 0))
Definition: type.cpp:805
StructureBuilder & AddMember(const Confidence< Ref< Type > > &type, const std::string &name, BNMemberAccess access=NoAccess, BNMemberScope scope=NoScope)
AddMember adds a member (field) to a structure.
Definition: type.cpp:2576
Ref< Structure > Finalize() const
Complete the structure building process and return a Structure object.
Definition: type.cpp:2388
static std::string GenerateAutoTypeId(const std::string &source, const QualifiedName &name)
Definition: type.cpp:1042
StructureBuilder is a convenience class used for building Structure Types.
Definition: binaryninjaapi.h:9115

Public Member Functions

 StructureBuilder ()
 
 StructureBuilder (BNStructureBuilder *s)
 
 StructureBuilder (BNStructureVariant type, bool packed=false)
 
 StructureBuilder (const StructureBuilder &s)
 
 StructureBuilder (StructureBuilder &&s)
 
 StructureBuilder (Structure *s)
 
 ~StructureBuilder ()
 
StructureBuilderoperator= (const StructureBuilder &s)
 
StructureBuilderoperator= (StructureBuilder &&s)
 
StructureBuilderoperator= (Structure *s)
 
BNStructureBuilderGetObject ()
 
Ref< StructureFinalize () const
 Complete the structure building process and return a Structure object. More...
 
std::vector< BaseStructureGetBaseStructures () const
 
StructureBuilderSetBaseStructures (const std::vector< BaseStructure > &bases)
 
std::vector< StructureMemberGetMembers () const
 GetMembers returns a list of structure members. More...
 
bool GetMemberByName (const std::string &name, StructureMember &result) const
 GetMemberByName retrieves a structure member by name. More...
 
bool GetMemberAtOffset (int64_t offset, StructureMember &result) const
 
bool GetMemberAtOffset (int64_t offset, StructureMember &result, size_t &idx) const
 
uint64_t GetWidth () const
 
StructureBuilderSetWidth (size_t width)
 
int64_t GetPointerOffset () const
 
StructureBuilderSetPointerOffset (int64_t offset)
 
size_t GetAlignment () const
 
StructureBuilderSetAlignment (size_t align)
 
bool IsPacked () const
 
StructureBuilderSetPacked (bool packed)
 
bool IsUnion () const
 
bool PropagateDataVariableReferences () const
 
StructureBuilderSetPropagateDataVariableReferences (bool value)
 
StructureBuilderSetStructureType (BNStructureVariant type)
 Set the structure type. More...
 
BNStructureVariant GetStructureType () const
 Get the Structure Type. More...
 
StructureBuilderAddMember (const Confidence< Ref< Type > > &type, const std::string &name, BNMemberAccess access=NoAccess, BNMemberScope scope=NoScope)
 AddMember adds a member (field) to a structure. More...
 
StructureBuilderAddMemberAtOffset (const Confidence< Ref< Type > > &type, const std::string &name, uint64_t offset, bool overwriteExisting=true, BNMemberAccess access=NoAccess, BNMemberScope scope=NoScope)
 AddMemberAtOffset adds a member at a specific offset within the struct. More...
 
StructureBuilderRemoveMember (size_t idx)
 RemoveMember removes a member at a specified index. More...
 
StructureBuilderReplaceMember (size_t idx, const Confidence< Ref< Type > > &type, const std::string &name, bool overwriteExisting=true)
 ReplaceMember replaces a member at an index. More...
 

Constructor & Destructor Documentation

◆ StructureBuilder() [1/6]

StructureBuilder::StructureBuilder ( )

◆ StructureBuilder() [2/6]

StructureBuilder::StructureBuilder ( BNStructureBuilder s)

◆ StructureBuilder() [3/6]

StructureBuilder::StructureBuilder ( BNStructureVariant  type,
bool  packed = false 
)

◆ StructureBuilder() [4/6]

StructureBuilder::StructureBuilder ( const StructureBuilder s)

◆ StructureBuilder() [5/6]

StructureBuilder::StructureBuilder ( StructureBuilder &&  s)

◆ StructureBuilder() [6/6]

StructureBuilder::StructureBuilder ( Structure s)

◆ ~StructureBuilder()

StructureBuilder::~StructureBuilder ( )

Member Function Documentation

◆ operator=() [1/3]

StructureBuilder & StructureBuilder::operator= ( const StructureBuilder s)

◆ operator=() [2/3]

StructureBuilder & StructureBuilder::operator= ( StructureBuilder &&  s)

◆ operator=() [3/3]

StructureBuilder & StructureBuilder::operator= ( Structure s)

◆ GetObject()

BNStructureBuilder * BinaryNinja::StructureBuilder::GetObject ( )
inline

◆ Finalize()

Ref< Structure > StructureBuilder::Finalize ( ) const

Complete the structure building process and return a Structure object.

Returns
a built Structure object

◆ GetBaseStructures()

vector< BaseStructure > StructureBuilder::GetBaseStructures ( ) const

◆ SetBaseStructures()

StructureBuilder & StructureBuilder::SetBaseStructures ( const std::vector< BaseStructure > &  bases)

◆ GetMembers()

vector< StructureMember > StructureBuilder::GetMembers ( ) const

GetMembers returns a list of structure members.

Returns
vector of StructureMember objects

◆ GetMemberByName()

bool StructureBuilder::GetMemberByName ( const std::string &  name,
StructureMember result 
) const

GetMemberByName retrieves a structure member by name.

Parameters
nameName of the member (field)
resultReference to a StructureMember object the field will be passed to
Returns
Whether a StructureMember was successfully retrieved

◆ GetMemberAtOffset() [1/2]

bool StructureBuilder::GetMemberAtOffset ( int64_t  offset,
StructureMember result 
) const

◆ GetMemberAtOffset() [2/2]

bool StructureBuilder::GetMemberAtOffset ( int64_t  offset,
StructureMember result,
size_t &  idx 
) const

◆ GetWidth()

uint64_t StructureBuilder::GetWidth ( ) const

◆ SetWidth()

StructureBuilder & StructureBuilder::SetWidth ( size_t  width)

◆ GetPointerOffset()

int64_t StructureBuilder::GetPointerOffset ( ) const

◆ SetPointerOffset()

StructureBuilder & StructureBuilder::SetPointerOffset ( int64_t  offset)

◆ GetAlignment()

size_t StructureBuilder::GetAlignment ( ) const

◆ SetAlignment()

StructureBuilder & StructureBuilder::SetAlignment ( size_t  align)

◆ IsPacked()

bool StructureBuilder::IsPacked ( ) const

◆ SetPacked()

StructureBuilder & StructureBuilder::SetPacked ( bool  packed)

◆ IsUnion()

bool StructureBuilder::IsUnion ( ) const

◆ PropagateDataVariableReferences()

bool StructureBuilder::PropagateDataVariableReferences ( ) const

◆ SetPropagateDataVariableReferences()

StructureBuilder & StructureBuilder::SetPropagateDataVariableReferences ( bool  value)

◆ SetStructureType()

StructureBuilder & StructureBuilder::SetStructureType ( BNStructureVariant  type)

Set the structure type.

Parameters
typeOne of: ClassStructureType, StructStructureType, UnionStructureType
Returns
reference to this StructureBuilder

◆ GetStructureType()

BNStructureVariant StructureBuilder::GetStructureType ( ) const

Get the Structure Type.

Returns
A BNStructureVariant
Return values
ClassStructureTypeIf this structure represents a class
StructStructureTypeIf this structure represents a structure
UnionStructureTypeIf this structure represents a union

◆ AddMember()

StructureBuilder & StructureBuilder::AddMember ( const Confidence< Ref< Type > > &  type,
const std::string &  name,
BNMemberAccess  access = NoAccess,
BNMemberScope  scope = NoScope 
)

AddMember adds a member (field) to a structure.

Parameters
typeType of the Field
nameName of the field
accessOptional, One of NoAccess, PrivateAccess, ProtectedAccess, PublicAccess
scopeOptional, One of NoScope, StaticScope, VirtualScope, ThunkScope, FriendScope
Returns
reference to the Structure Builder

◆ AddMemberAtOffset()

StructureBuilder & StructureBuilder::AddMemberAtOffset ( const Confidence< Ref< Type > > &  type,
const std::string &  name,
uint64_t  offset,
bool  overwriteExisting = true,
BNMemberAccess  access = NoAccess,
BNMemberScope  scope = NoScope 
)

AddMemberAtOffset adds a member at a specific offset within the struct.

Parameters
typeType of the Field
nameName of the field
offsetOffset to add the member within the struct
overwriteExistingWhether to overwrite an existing member at that offset, Optional, default true
accessOne of NoAccess, PrivateAccess, ProtectedAccess, PublicAccess
scopeOne of NoScope, StaticScope, VirtualScope, ThunkScope, FriendScope
Returns
Reference to the StructureBuilder

◆ RemoveMember()

StructureBuilder & StructureBuilder::RemoveMember ( size_t  idx)

RemoveMember removes a member at a specified index.

Parameters
idxIndex to remove
Returns
Reference to the StructureBuilder

◆ ReplaceMember()

StructureBuilder & StructureBuilder::ReplaceMember ( size_t  idx,
const Confidence< Ref< Type > > &  type,
const std::string &  name,
bool  overwriteExisting = true 
)

ReplaceMember replaces a member at an index.

Parameters
idxIndex of the StructureMember to be replaced
typeType of the new Member
nameName of the new Member
overwriteExistingWhether to overwrite the existing member, default true
Returns
Reference to the StructureBuilder

◆ BinaryNinja::EnumerationMember

struct BinaryNinja::EnumerationMember
Class Members
string name
uint64_t value
bool isDefault

◆ BinaryNinja::Enumeration

class BinaryNinja::Enumeration

Public Member Functions

 Enumeration (BNEnumeration *e)
 
std::vector< InstructionTextTokenGetTokensForValue (uint64_t value, size_t width, Ref< Type > type)
 
std::vector< EnumerationMemberGetMembers () const
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNEnumeration, BNNewEnumerationReference, BNFreeEnumeration >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNEnumerationGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNEnumeration, BNNewEnumerationReference, BNFreeEnumeration >
static BNEnumerationGetObject (CoreRefCountObject *obj)
 
static BNEnumerationGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNEnumeration, BNNewEnumerationReference, BNFreeEnumeration >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNEnumerationm_object
 

Constructor & Destructor Documentation

◆ Enumeration()

Enumeration::Enumeration ( BNEnumeration e)

Member Function Documentation

◆ GetTokensForValue()

vector< InstructionTextToken > Enumeration::GetTokensForValue ( uint64_t  value,
size_t  width,
Ref< Type type 
)

◆ GetMembers()

vector< EnumerationMember > Enumeration::GetMembers ( ) const

◆ BinaryNinja::EnumerationBuilder

class BinaryNinja::EnumerationBuilder

EnumerationBuilder is a convenience class used for building Enumeration Types.

Example:

EnumerationBuilder segFlagsTypeBuilder;
segFlagsTypeBuilder.AddMemberWithValue("SG_HIGHVM", 0x1);
segFlagsTypeBuilder.AddMemberWithValue("SG_FVMLIB", 0x2);
segFlagsTypeBuilder.AddMemberWithValue("SG_NORELOC", 0x4);
segFlagsTypeBuilder.AddMemberWithValue("SG_PROTECTED_VERSION_1", 0x8);
Ref<Enumeration> segFlagsTypeEnum = segFlagsTypeBuilder.Finalize();
EnumerationBuilder & AddMemberWithValue(const std::string &name, uint64_t value)
Add a member to the enum with a set value.
Definition: type.cpp:2750
Ref< Enumeration > Finalize() const
Finalize the building process and return the built Enumeration.
Definition: type.cpp:2716
EnumerationBuilder is a convenience class used for building Enumeration Types.
Definition: binaryninjaapi.h:9263

Public Member Functions

 EnumerationBuilder ()
 
 EnumerationBuilder (BNEnumerationBuilder *e)
 
 EnumerationBuilder (const EnumerationBuilder &e)
 
 EnumerationBuilder (EnumerationBuilder &&e)
 
 EnumerationBuilder (Enumeration *e)
 
 ~EnumerationBuilder ()
 
BNEnumerationBuilderGetObject ()
 
EnumerationBuilderoperator= (const EnumerationBuilder &e)
 
EnumerationBuilderoperator= (EnumerationBuilder &&e)
 
EnumerationBuilderoperator= (Enumeration *e)
 
Ref< EnumerationFinalize () const
 Finalize the building process and return the built Enumeration. More...
 
std::vector< EnumerationMemberGetMembers () const
 Get a list of members in this enum. More...
 
EnumerationBuilderAddMember (const std::string &name)
 Add a member to the enum. More...
 
EnumerationBuilderAddMemberWithValue (const std::string &name, uint64_t value)
 Add a member to the enum with a set value. More...
 
EnumerationBuilderRemoveMember (size_t idx)
 Remove a member from the enum. More...
 
EnumerationBuilderReplaceMember (size_t idx, const std::string &name, uint64_t value)
 Replace a member at an index. More...
 

Constructor & Destructor Documentation

◆ EnumerationBuilder() [1/5]

EnumerationBuilder::EnumerationBuilder ( )

◆ EnumerationBuilder() [2/5]

EnumerationBuilder::EnumerationBuilder ( BNEnumerationBuilder e)

◆ EnumerationBuilder() [3/5]

EnumerationBuilder::EnumerationBuilder ( const EnumerationBuilder e)

◆ EnumerationBuilder() [4/5]

EnumerationBuilder::EnumerationBuilder ( EnumerationBuilder &&  e)

◆ EnumerationBuilder() [5/5]

EnumerationBuilder::EnumerationBuilder ( Enumeration e)

◆ ~EnumerationBuilder()

EnumerationBuilder::~EnumerationBuilder ( )

Member Function Documentation

◆ GetObject()

BNEnumerationBuilder * BinaryNinja::EnumerationBuilder::GetObject ( )
inline

◆ operator=() [1/3]

EnumerationBuilder & EnumerationBuilder::operator= ( const EnumerationBuilder e)

◆ operator=() [2/3]

EnumerationBuilder & EnumerationBuilder::operator= ( EnumerationBuilder &&  e)

◆ operator=() [3/3]

EnumerationBuilder & EnumerationBuilder::operator= ( Enumeration e)

◆ Finalize()

Ref< Enumeration > EnumerationBuilder::Finalize ( ) const

Finalize the building process and return the built Enumeration.

Returns
the Enumeration

◆ GetMembers()

vector< EnumerationMember > EnumerationBuilder::GetMembers ( ) const

Get a list of members in this enum.

Returns
list of EnumerationMember

◆ AddMember()

EnumerationBuilder & EnumerationBuilder::AddMember ( const std::string &  name)

Add a member to the enum.

Note
If there is already a member in the Enum, the value of newly added ones will be the value of the previously added one + 1
Parameters
nameName of the enum member
Returns
A reference to this EnumerationBuilder

◆ AddMemberWithValue()

EnumerationBuilder & EnumerationBuilder::AddMemberWithValue ( const std::string &  name,
uint64_t  value 
)

Add a member to the enum with a set value.

Parameters
nameName of the enum member
valueValue of th enum member
Returns
A reference to this EnumerationBuilder

◆ RemoveMember()

EnumerationBuilder & EnumerationBuilder::RemoveMember ( size_t  idx)

Remove a member from the enum.

Parameters
idxIndex to remove
Returns
A reference to this EnumerationBuilder

◆ ReplaceMember()

EnumerationBuilder & EnumerationBuilder::ReplaceMember ( size_t  idx,
const std::string &  name,
uint64_t  value 
)

Replace a member at an index.

Parameters
idxIndex to replace
nameName of the new member
valueValue of the new member
Returns
A reference to this EnumerationBuilder

◆ BinaryNinja::TypeContainer

class BinaryNinja::TypeContainer

A TypeContainer is a generic interface to access various Binary Ninja models that contain types.

Types are stored with both a unique id and a unique name.

Public Member Functions

 TypeContainer (BNTypeContainer *container)
 
 TypeContainer (Ref< BinaryView > data)
 Get the Type Container for a given BinaryView. More...
 
 TypeContainer (Ref< TypeLibrary > library)
 Get the Type Container for a Type Library. More...
 
 TypeContainer (Ref< TypeArchive > archive)
 Get the Type Container for a Type Archive. More...
 
 TypeContainer (Ref< Platform > platform)
 Get the Type Container for a Platform. More...
 
 ~TypeContainer ()
 
 TypeContainer (const TypeContainer &other)
 
 TypeContainer (TypeContainer &&other)
 
TypeContaineroperator= (const TypeContainer &other)
 
TypeContaineroperator= (TypeContainer &&other)
 
bool operator== (const TypeContainer &other) const
 
bool operator!= (const TypeContainer &other) const
 
BNTypeContainerGetObject () const
 
std::string GetId () const
 Get an id string for the Type Container. More...
 
std::string GetName () const
 Get a user-friendly name for the Type Container. More...
 
BNTypeContainerType GetType () const
 Get the type of underlying model the Type Container is accessing. More...
 
bool IsMutable () const
 Test if the Type Container supports mutable operations (add, rename, delete) More...
 
Ref< PlatformGetPlatform () const
 Get the Platform object associated with this Type Container. More...
 
std::optional< std::string > AddType (QualifiedName name, Ref< Type > type)
 Add or update a single type in the Type Container. More...
 
std::optional< std::unordered_map< QualifiedName, std::string > > AddTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, std::function< bool(size_t, size_t)> progress={})
 Add or update types to a Type Container. More...
 
bool RenameType (const std::string &typeId, const QualifiedName &newName)
 Rename a type in the Type Container. More...
 
bool DeleteType (const std::string &typeId)
 Delete a type in the Type Container. More...
 
std::optional< std::string > GetTypeId (const QualifiedName &typeName) const
 Get the unique id of the type in the Type Container with the given name. More...
 
std::optional< QualifiedNameGetTypeName (const std::string &typeId) const
 Get the unique name of the type in the Type Container with the given id. More...
 
std::optional< Ref< Type > > GetTypeById (const std::string &typeId) const
 Get the definition of the type in the Type Container with the given id. More...
 
std::optional< std::unordered_map< std::string, std::pair< QualifiedName, Ref< Type > > > > GetTypes () const
 Get a mapping of all types in a Type Container. More...
 
std::optional< Ref< Type > > GetTypeByName (const QualifiedName &typeName) const
 Get the definition of the type in the Type Container with the given name. More...
 
std::optional< std::unordered_set< std::string > > GetTypeIds () const
 Get all type ids in a Type Container. More...
 
std::optional< std::unordered_set< QualifiedName > > GetTypeNames () const
 Get all type names in a Type Container. More...
 
std::optional< std::unordered_map< std::string, QualifiedName > > GetTypeNamesAndIds () const
 Get a mapping of all type ids and type names in a Type Container. More...
 
bool ParseTypeString (const std::string &source, QualifiedNameAndType &result, std::vector< TypeParserError > &errors)
 Parse a single type and name from a string containing their definition, with knowledge of the types in the Type Container. More...
 
bool ParseTypesFromSource (const std::string &text, const std::string &fileName, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors)
 Parse an entire block of source into types, variables, and functions, with knowledge of the types in the Type Container. More...
 

Constructor & Destructor Documentation

◆ TypeContainer() [1/7]

TypeContainer::TypeContainer ( BNTypeContainer container)
explicit

◆ TypeContainer() [2/7]

TypeContainer::TypeContainer ( Ref< BinaryView data)

Get the Type Container for a given BinaryView.

Parameters
dataBinaryView source

◆ TypeContainer() [3/7]

TypeContainer::TypeContainer ( Ref< TypeLibrary library)

Get the Type Container for a Type Library.

Note
The Platform for the Type Container will be the first Platform associated with the Type Library
Parameters
libraryTypeLibrary source

◆ TypeContainer() [4/7]

TypeContainer::TypeContainer ( Ref< TypeArchive archive)

Get the Type Container for a Type Archive.

Parameters
archiveTypeArchive source

◆ TypeContainer() [5/7]

TypeContainer::TypeContainer ( Ref< Platform platform)

Get the Type Container for a Platform.

Parameters
platformPlatform source

◆ ~TypeContainer()

TypeContainer::~TypeContainer ( )

◆ TypeContainer() [6/7]

TypeContainer::TypeContainer ( const TypeContainer other)

◆ TypeContainer() [7/7]

TypeContainer::TypeContainer ( TypeContainer &&  other)

Member Function Documentation

◆ operator=() [1/2]

TypeContainer & TypeContainer::operator= ( const TypeContainer other)

◆ operator=() [2/2]

TypeContainer & TypeContainer::operator= ( TypeContainer &&  other)

◆ operator==()

bool BinaryNinja::TypeContainer::operator== ( const TypeContainer other) const
inline

◆ operator!=()

bool BinaryNinja::TypeContainer::operator!= ( const TypeContainer other) const
inline

◆ GetObject()

BNTypeContainer * BinaryNinja::TypeContainer::GetObject ( ) const
inline

◆ GetId()

std::string TypeContainer::GetId ( ) const

Get an id string for the Type Container.

This will be unique within a given analysis session, but may not be globally unique.

Returns
Identifier string

◆ GetName()

std::string TypeContainer::GetName ( ) const

Get a user-friendly name for the Type Container.

Returns
Display name

◆ GetType()

BNTypeContainerType TypeContainer::GetType ( ) const

Get the type of underlying model the Type Container is accessing.

Returns
Container type enum

◆ IsMutable()

bool TypeContainer::IsMutable ( ) const

Test if the Type Container supports mutable operations (add, rename, delete)

Returns
True if mutable

◆ GetPlatform()

Ref< Platform > TypeContainer::GetPlatform ( ) const

Get the Platform object associated with this Type Container.

All Type Containers have exactly one associated Platform (as opposed to, e.g. Type Libraries).

Returns
Associated Platform object

◆ AddType()

std::optional< std::string > TypeContainer::AddType ( QualifiedName  name,
Ref< Type type 
)

Add or update a single type in the Type Container.

If the Type Container already contains a type with the same name as a type being added, the existing type will be replaced with the definition given to this function, and references will be updated in the source model.

Parameters
nameName of type to add
typeDefinition of type to add
Returns
String of added type's id, if successful, std::nullopt otherwise

◆ AddTypes()

std::optional< std::unordered_map< QualifiedName, std::string > > TypeContainer::AddTypes ( const std::vector< std::pair< QualifiedName, Ref< Type > > > &  types,
std::function< bool(size_t, size_t)>  progress = {} 
)

Add or update types to a Type Container.

If the Type Container already contains a type with the same name as a type being added, the existing type will be replaced with the definition given to this function, and references will be updated in the source model.

An optional progress callback is included because adding many types can be a slow operation.

Parameters
typesList of (name, definition) pairs of new types to add
progressOptional function to call for progress updates
Returns
Map of name -> id of type in Type Container for all added types if successful, std::nullopt otherwise.

◆ RenameType()

bool TypeContainer::RenameType ( const std::string &  typeId,
const QualifiedName newName 
)

Rename a type in the Type Container.

All references to this type will be updated (by id) to use the new name.

Parameters
typeIdId of type to update
newNameNew name for the type
Returns
True if successful

◆ DeleteType()

bool TypeContainer::DeleteType ( const std::string &  typeId)

Delete a type in the Type Container.

Behavior of references to this type is not specified and you may end up with broken references if any still exist.

Parameters
typeIdId of type to delete
Returns
True if successful

◆ GetTypeId()

std::optional< std::string > TypeContainer::GetTypeId ( const QualifiedName typeName) const

Get the unique id of the type in the Type Container with the given name.

If no type with that name exists, returns std::nullopt.

Parameters
typeNameName of type
Returns
Type id, if exists, else, std::nullopt

◆ GetTypeName()

std::optional< QualifiedName > TypeContainer::GetTypeName ( const std::string &  typeId) const

Get the unique name of the type in the Type Container with the given id.

If no type with that id exists, returns std::nullopt.

Parameters
typeIdId of type
Returns
Type name, if exists, else, std::nullopt

◆ GetTypeById()

std::optional< Ref< Type > > TypeContainer::GetTypeById ( const std::string &  typeId) const

Get the definition of the type in the Type Container with the given id.

If no type with that id exists, returns std::nullopt.

Parameters
typeIdId of type
Returns
Type object, if exists, else, std::nullopt

◆ GetTypes()

std::optional< std::unordered_map< std::string, std::pair< QualifiedName, Ref< Type > > > > TypeContainer::GetTypes ( ) const

Get a mapping of all types in a Type Container.

Returns
All types in a map of type id -> (type name, type definition)

◆ GetTypeByName()

std::optional< Ref< Type > > TypeContainer::GetTypeByName ( const QualifiedName typeName) const

Get the definition of the type in the Type Container with the given name.

If no type with that name exists, returns None.

Parameters
typeNameName of type
Returns
Type object, if exists, else, None

◆ GetTypeIds()

std::optional< std::unordered_set< std::string > > TypeContainer::GetTypeIds ( ) const

Get all type ids in a Type Container.

Returns
List of all type ids

◆ GetTypeNames()

std::optional< std::unordered_set< QualifiedName > > TypeContainer::GetTypeNames ( ) const

Get all type names in a Type Container.

Returns
List of all type names

◆ GetTypeNamesAndIds()

std::optional< std::unordered_map< std::string, QualifiedName > > TypeContainer::GetTypeNamesAndIds ( ) const

Get a mapping of all type ids and type names in a Type Container.

Returns
Map of type id -> type name

◆ ParseTypeString()

bool TypeContainer::ParseTypeString ( const std::string &  source,
BinaryNinja::QualifiedNameAndType result,
std::vector< TypeParserError > &  errors 
)

Parse a single type and name from a string containing their definition, with knowledge of the types in the Type Container.

Parameters
sourceSource code to parse
resultReference into which the resulting type and name will be written
errorsReference to a list into which any parse errors will be written
Returns
True if parsing was successful

◆ ParseTypesFromSource()

bool TypeContainer::ParseTypesFromSource ( const std::string &  text,
const std::string &  fileName,
const std::vector< std::string > &  options,
const std::vector< std::string > &  includeDirs,
const std::string &  autoTypeSource,
BinaryNinja::TypeParserResult result,
std::vector< TypeParserError > &  errors 
)

Parse an entire block of source into types, variables, and functions, with knowledge of the types in the Type Container.

Parameters
textSource code to parse
fileNameName of the file containing the source (optional: exists on disk)
optionsOptional string arguments to pass as options, e.g. command line arguments
includeDirsOptional list of directories to include in the header search path
autoTypeSourceOptional source of types if used for automatically generated types
resultReference to structure into which the results will be written
errorsReference to a list into which any parse errors will be written
Returns
True if successful