Binary Ninja API C++: Types
Classes | |
| class | BinaryNinja::Symbol |
| struct | BinaryNinja::TypeAttribute |
| 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... | |
◆ 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 (BNSymbolType type, const std::string &shortName, const std::string &fullName, const std::string &rawName, uint64_t addr, BNNameSpace *nameSpace, BNSymbolBinding binding=NoBinding, uint64_t ordinal=0) | |
| Symbol (BNSymbolType type, const std::string &name, uint64_t addr, BNNameSpace *nameSpace, BNSymbolBinding binding=NoBinding, uint64_t ordinal=0) | |
| Symbol (BNSymbol *sym) | |
| BNSymbolType | GetType () const |
| Symbols are defined as one of the following types: | |
| BNSymbolBinding | GetBinding () const |
| std::string | GetShortName () const |
| StringRef | GetShortNameRef () const |
| std::string | GetFullName () const |
| StringRef | GetFullNameRef () const |
| std::string | GetRawName () const |
| StringRef | GetRawNameRef () 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 () |
| BNSymbol * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | ReleaseForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
Static Public Member Functions | |
| static Ref< Symbol > | ImportedFunctionFromImportAddressSymbol (Symbol *sym, uint64_t addr) |
◆ Symbol() [1/5]
| 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/5]
◆ Symbol() [3/5]
| BinaryNinja::Symbol::Symbol | ( | BNSymbolType | type, |
| const std::string & | shortName, | ||
| const std::string & | fullName, | ||
| const std::string & | rawName, | ||
| uint64_t | addr, | ||
| BNNameSpace * | nameSpace, | ||
| BNSymbolBinding | binding = NoBinding, | ||
| uint64_t | ordinal = 0 ) |
◆ Symbol() [4/5]
◆ Symbol() [5/5]
◆ GetType()
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()
◆ GetShortName()
| string Symbol::GetShortName | ( | ) | const |
◆ GetShortNameRef()
◆ GetFullName()
| string Symbol::GetFullName | ( | ) | const |
◆ GetFullNameRef()
◆ GetRawName()
| string Symbol::GetRawName | ( | ) | const |
◆ GetRawNameRef()
◆ GetAddress()
| uint64_t Symbol::GetAddress | ( | ) | const |
◆ GetOrdinal()
| uint64_t Symbol::GetOrdinal | ( | ) | const |
◆ IsAutoDefined()
| bool Symbol::IsAutoDefined | ( | ) | const |
- Returns
- Whether the symbol was auto-defined
◆ GetNameSpace()
◆ ImportedFunctionFromImportAddressSymbol()
◆ BinaryNinja::TypeAttribute
◆ 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. | |
| uint64_t | GetWidth () const |
| Get the width in bytes of the Type. | |
| size_t | GetAlignment () const |
| QualifiedName | GetTypeName () const |
| Get the QualifiedName for the Type. | |
| Confidence< bool > | IsSigned () const |
| Whether the type is signed. | |
| Confidence< bool > | IsConst () const |
| Whether the type is constant. | |
| Confidence< bool > | IsVolatile () const |
| bool | IsSystemCall () const |
| Confidence< Ref< Type > > | GetChildType () const |
| Get the child type for this Type if one exists. | |
| Confidence< Ref< CallingConvention > > | GetCallingConvention () const |
| For Function Types, get the calling convention. | |
| BNCallingConventionName | GetCallingConventionName () const |
| For Function Types, get the calling convention name. | |
| std::vector< FunctionParameter > | GetParameters () const |
| For Function Types, get a list of parameters. | |
| Confidence< bool > | HasVariableArguments () const |
| For Function Types, whether the Function has variadic arguments. | |
| bool | HasTemplateArguments () const |
| Has no effect currently, just used by the demangler. | |
| Confidence< bool > | CanReturn () const |
| For Function Types, whether a function can return (is not marked noreturn). | |
| Confidence< bool > | IsPure () const |
| For Function Types, whether a function is pure (has no observable side-effects). | |
| Ref< Structure > | GetStructure () const |
| For Structure Types, the underlying Structure. | |
| Ref< Enumeration > | GetEnumeration () const |
| For Enumeration Types, the underlying Enumeration. | |
| Ref< NamedTypeReference > | GetNamedTypeReference () const |
| For NamedTypeReference Types, the underlying NamedTypeReference. | |
| Confidence< BNMemberScope > | GetScope () const |
| Confidence< int64_t > | GetStackAdjustment () const |
| QualifiedName | GetStructureName () const |
| Ref< NamedTypeReference > | GetRegisteredName () const |
| std::string | GetAlternateName () const |
| uint32_t | GetSystemCallNumber () const |
| BNIntegerDisplayType | GetIntegerTypeDisplayType () const |
| BNNameType | GetNameType () const |
| bool | ShouldDisplayReturnType () const |
| uint64_t | GetElementCount () const |
| uint64_t | GetOffset () const |
| BNPointerBaseType | GetPointerBaseType () const |
| int64_t | GetPointerBaseOffset () const |
| std::set< BNPointerSuffix > | GetPointerSuffix () const |
| std::string | GetPointerSuffixString () const |
| std::vector< InstructionTextToken > | GetPointerSuffixTokens (uint8_t baseConfidence=255) const |
| std::vector< TypeAttribute > | GetAttributes () const |
| std::optional< std::string > | GetAttribute (const std::string &name) 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< InstructionTextToken > | GetTokens (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const |
| std::vector< InstructionTextToken > | GetTokensBeforeName (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const |
| std::vector< InstructionTextToken > | GetTokensAfterName (Platform *platform=nullptr, uint8_t baseConfidence=255, BNTokenEscapingType escaping=NoTokenEscapingType) const |
| Ref< Type > | Duplicate () const |
| Type * | SetIgnored (bool setIgnored) |
| Call this with setIgnored=True if this Type object is expected to be always resident. | |
| Confidence< Ref< Type > > | WithConfidence (uint8_t conf) |
| Get this type wrapped in a Confidence template. | |
| bool | IsReferenceOfType (BNNamedTypeReferenceClass refType) |
| If this Type is a NamedTypeReference, check whether it is reference to a specific Type. | |
| bool | IsStructReference () |
| If this Type is a NamedTypeReference, check whether it refers to a Struct Type. | |
| bool | IsEnumReference () |
| If this Type is a NamedTypeReference, check whether it refers to an Enum Type. | |
| bool | IsUnionReference () |
| If this Type is a NamedTypeReference, check whether it refers to a Union Type. | |
| bool | IsClassReference () |
| If this Type is a NamedTypeReference, check whether it refers to a Class Type. | |
| bool | IsTypedefReference () |
| If this Type is a NamedTypeReference, check whether it refers to a Typedef type. | |
| bool | IsStructOrClassReference () |
| If this Type is a NamedTypeReference, check whether it refers to a Struct or Class Type. | |
| bool | IsVoid () const |
| Check whether this type is a Void type. | |
| bool | IsBool () const |
| Check whether this type is a Boolean type. | |
| bool | IsInteger () const |
| Check whether this type is an Integer type. | |
| bool | IsFloat () const |
| Check whether this type is a Float type. | |
| bool | IsStructure () const |
| Check whether this type is a Structure type. | |
| bool | IsEnumeration () const |
| Check whether this type is an Enumeration type. | |
| bool | IsPointer () const |
| Check whether this type is a Pointer type. | |
| bool | IsArray () const |
| Check whether this type is an Array type. | |
| bool | IsFunction () const |
| Check whether this type is a Function type. | |
| bool | IsVarArgs () const |
| Check whether this type is a Variadic Arguments type. | |
| bool | IsValue () const |
| Check whether this type is a Value type. | |
| bool | IsNamedTypeRefer () const |
| Check whether this type is a Named Type Reference type. | |
| bool | IsWideChar () const |
| Check whether this type is a Wide Char type. | |
| Ref< Type > | WithReplacedStructure (Structure *from, Structure *to) |
| Ref< Type > | WithReplacedEnumeration (Enumeration *from, Enumeration *to) |
| Ref< Type > | WithReplacedNamedTypeReference (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, FieldResolutionInfo *info=nullptr) |
| bool | EnumerateTypesForAccess (BinaryView *data, uint64_t offset, size_t size, uint8_t baseConfidence, const std::function< void(const Confidence< Ref< Type > > &type, FieldResolutionInfo *path)> &terminal) |
| std::vector< TypeDefinitionLine > | GetLines (const TypeContainer &types, const std::string &name, int paddingCols=64, bool collapsed=false, BNTokenEscapingType escaping=NoTokenEscapingType) const |
| Ref< Type > | DerefNamedTypeReference (BinaryView *view) const |
| Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNType, BNNewTypeReference, BNFreeType > | |
| CoreRefCountObject () | |
| virtual | ~CoreRefCountObject () |
| BNType * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | ReleaseForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
Static Public Member Functions | |
| static Ref< Type > | VoidType () |
| Create a "void" type. | |
| static Ref< Type > | BoolType () |
| Create a "bool" type. | |
| 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. | |
| static Ref< Type > | FloatType (size_t width, const std::string &altName="") |
| Create a float or double Type with a specified width. | |
| static Ref< Type > | WideCharType (size_t width, const std::string &altName="") |
| static Ref< Type > | StructureType (Structure *strct) |
| Create a Type object from a Structure object. | |
| 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)) |
| static Ref< Type > | NamedType (const QualifiedName &name, Type *type) |
| static Ref< Type > | NamedType (const std::string &id, const QualifiedName &name, Type *type) |
| static Ref< Type > | NamedType (BinaryView *view, const QualifiedName &name) |
| static Ref< Type > | EnumerationType (Architecture *arch, Enumeration *enm, size_t width=0, const Confidence< bool > &isSigned=Confidence< bool >(false, 0)) |
| static Ref< Type > | EnumerationType (Enumeration *enm, size_t width, const Confidence< bool > &isSigned=Confidence< bool >(false, 0)) |
| 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. | |
| static Ref< 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) |
| Create a Pointer type, which points to another Type. | |
| static Ref< Type > | ArrayType (const Confidence< Ref< Type > > &type, uint64_t elem) |
| Create an Array Type. | |
| static Ref< Type > | FunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > ¶ms, const Confidence< bool > &varArg=Confidence< bool >(false, 0), const Confidence< int64_t > &stackAdjust=Confidence< int64_t >(0, 0)) |
| Create a Function Type. | |
| static Ref< Type > | FunctionType (const Confidence< Ref< Type > > &returnValue, const Confidence< Ref< CallingConvention > > &callingConvention, const std::vector< FunctionParameter > ¶ms, const Confidence< bool > &hasVariableArguments, const Confidence< bool > &canReturn, const Confidence< int64_t > &stackAdjust, const std::map< uint32_t, Confidence< int32_t > > ®StackAdjust=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. | |
| static Ref< Type > | VarArgsType () |
| static Ref< Type > | ValueType (const std::string &value) |
| static std::string | GetNameTypeString (BNNameType classFunctionType) |
| 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) |
◆ Type()
◆ operator==()
| bool Type::operator== | ( | const Type & | other | ) |
◆ operator!=()
| bool Type::operator!= | ( | const Type & | other | ) |
◆ GetClass()
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()
◆ IsSigned()
Whether the type is signed.
◆ IsConst()
Whether the type is constant.
◆ IsVolatile()
◆ IsSystemCall()
| bool Type::IsSystemCall | ( | ) | const |
◆ GetChildType()
Get the child type for this Type if one exists.
- Returns
- The child type
◆ GetCallingConvention()
◆ GetCallingConventionName()
For Function Types, get the calling convention name.
- Returns
- The calling convention name
◆ GetParameters()
For Function Types, get a list of parameters.
- Returns
- A vector of FunctionParameters
◆ HasVariableArguments()
| Confidence< bool > Type::HasVariableArguments | ( | ) | const |
◆ HasTemplateArguments()
| bool Type::HasTemplateArguments | ( | ) | const |
Has no effect currently, just used by the demangler.
- Returns
- If the type has the "has template arguments" flag set
◆ CanReturn()
For Function Types, whether a function can return (is not marked noreturn).
- Returns
- Whether the function can return
◆ IsPure()
For Function Types, whether a function is pure (has no observable side-effects).
- Returns
- Whether the function is pure
◆ GetStructure()
◆ 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()
◆ GetStackAdjustment()
| Confidence< int64_t > Type::GetStackAdjustment | ( | ) | const |
◆ GetStructureName()
◆ GetRegisteredName()
| Ref< NamedTypeReference > Type::GetRegisteredName | ( | ) | const |
◆ GetAlternateName()
| string Type::GetAlternateName | ( | ) | const |
◆ GetSystemCallNumber()
| uint32_t Type::GetSystemCallNumber | ( | ) | const |
◆ GetIntegerTypeDisplayType()
◆ GetNameType()
◆ ShouldDisplayReturnType()
| bool Type::ShouldDisplayReturnType | ( | ) | const |
◆ GetElementCount()
| uint64_t Type::GetElementCount | ( | ) | const |
◆ GetOffset()
| uint64_t Type::GetOffset | ( | ) | const |
◆ GetPointerBaseType()
◆ GetPointerBaseOffset()
| int64_t Type::GetPointerBaseOffset | ( | ) | const |
◆ GetPointerSuffix()
◆ GetPointerSuffixString()
| std::string Type::GetPointerSuffixString | ( | ) | const |
◆ GetPointerSuffixTokens()
| std::vector< InstructionTextToken > Type::GetPointerSuffixTokens | ( | uint8_t | baseConfidence = 255 | ) | const |
◆ GetAttributes()
| std::vector< TypeAttribute > Type::GetAttributes | ( | ) | const |
◆ GetAttribute()
| std::optional< std::string > Type::GetAttribute | ( | const std::string & | name | ) | const |
◆ GetString()
◆ GetTypeAndName()
◆ GetStringBeforeName()
◆ GetStringAfterName()
◆ GetTokens()
◆ GetTokensBeforeName()
◆ GetTokensAfterName()
◆ Duplicate()
◆ SetIgnored()
| Type * Type::SetIgnored | ( | bool | setIgnored | ) |
Call this with setIgnored=True if this Type object is expected to be always resident.
This prevents the type object from showing up in the results of GetMemoryUsageInfo
◆ VoidType()
◆ BoolType()
◆ IntegerType()
|
static |
◆ FloatType()
◆ WideCharType()
◆ StructureType()
Create a Type object from a Structure object.
Structure objects can be generated using the StructureBuilder class.
- Parameters
- Returns
- The created Type object
◆ NamedType() [1/4]
◆ NamedType() [2/4]
◆ NamedType() [3/4]
|
static |
◆ NamedType() [4/4]
◆ EnumerationType() [1/2]
◆ EnumerationType() [2/2]
|
static |
◆ PointerType() [1/2]
Create a Pointer type, which points to another Type.
auto arch = bv->GetDefaultArchitecture();
auto charPointerType = Type::PointerType(arch, Type::IntegerType(1, false));
- Parameters
-
arch Architecture, used to calculate the proper pointer width type Type that this Type points to cnst Whether this type is const vltl Whether this type is volatile refType Reference Type, one of "PointerReferenceType", "ReferenceReferenceType", "RValueReferenceType", "NoReference"
- Returns
- The created type
◆ PointerType() [2/2]
Create a Pointer type, which points to another Type.
auto charPointerType = Type::PointerType(8, Type::IntegerType(1, false));
- Parameters
-
width Width of the pointer in bytes type Type that this type points to cnst Whether this type is const vltl Whether this type is volatile refType Reference Type, one of "PointerReferenceType", "ReferenceReferenceType", "RValueReferenceType", "NoReference"
- Returns
- The created type
◆ ArrayType()
Create an Array Type.
- Parameters
-
type Type for Elements contained in this Array elem Number of elements
- Returns
- The created Type
◆ FunctionType() [1/2]
std::vector<FunctionParameter> params
auto cc = bv->GetDefaultPlatform()->GetDefaultCallingConvention();
params.push_back({"arg0",
Type::IntegerType(8, false),
true,
auto functionType = Type::FunctionType(retType, cc, params);
- Parameters
-
returnValue Return value Type callingConvention Calling convention for the function params list of FunctionParameter s varArg Whether this function has variadic arguments, default false stackAdjust Stack adjustment for this function, default 0
- Returns
- The created function types
◆ FunctionType() [2/2]
|
static |
std::vector<FunctionParameter> params
auto cc = bv->GetDefaultPlatform()->GetDefaultCallingConvention();
params.push_back({"arg0",
Type::IntegerType(8, false),
true,
auto functionType = Type::FunctionType(retType, cc, params);
- Parameters
-
returnValue Return value Type callingConvention Calling convention for the function params list of FunctionParameters varArg Whether this function has variadic arguments, default false stackAdjust Stack adjustment for this function, default 0 regStackAdjust Register stack adjustmemt returnRegs Return registers
- Returns
- The created function types
◆ VarArgsType()
◆ ValueType()
◆ GetNameTypeString()
|
static |
◆ GenerateAutoTypeId()
|
static |
◆ GenerateAutoDemangledTypeId()
|
static |
◆ GetAutoDemangledTypeIdSource()
|
static |
◆ GenerateAutoDebugTypeId()
|
static |
◆ GetAutoDebugTypeIdSource()
|
static |
◆ WithConfidence()
◆ IsReferenceOfType()
If this Type is a NamedTypeReference, check whether it is reference to a specific Type.
- Parameters
- Returns
- Whether it is a reference of this 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()
|
inline |
If this Type is a NamedTypeReference, check whether it refers to an Enum Type.
- Returns
- Whether it refers to an Enum 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()
|
inline |
If this Type is a NamedTypeReference, check whether it refers to a Class Type.
- Returns
- Whether it refers to a class 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()
|
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()
|
inline |
Check whether this type is a Void type.
- Returns
- Whether this->GetClass() == VoidTypeClass
◆ IsBool()
|
inline |
Check whether this type is a Boolean type.
- Returns
- Whether this->GetClass() == BoolTypeClass
◆ IsInteger()
|
inline |
Check whether this type is an Integer type.
- Returns
- Whether this->GetClass() == IntegerTypeClass
◆ IsFloat()
|
inline |
Check whether this type is a Float type.
- Returns
- Whether this->GetClass() == FloatTypeClass
◆ IsStructure()
|
inline |
Check whether this type is a Structure type.
- Returns
- Whether this->GetClass() == StructureTypeClass
◆ IsEnumeration()
|
inline |
Check whether this type is an Enumeration type.
- Returns
- Whether this->GetClass() == EnumerationTypeClass
◆ IsPointer()
|
inline |
Check whether this type is a Pointer type.
- Returns
- Whether this->GetClass() == PointerTypeClass
◆ IsArray()
|
inline |
Check whether this type is an Array type.
- Returns
- Whether this->GetClass() == ArrayTypeClass
◆ IsFunction()
|
inline |
Check whether this type is a Function type.
- Returns
- Whether this->GetClass() == FunctionTypeClass
◆ IsVarArgs()
|
inline |
Check whether this type is a Variadic Arguments type.
- Returns
- Whether this->GetClass() == VarArgsTypeClass
◆ IsValue()
|
inline |
Check whether this type is a Value type.
- Returns
- Whether this->GetClass() == ValueTypeClass
◆ IsNamedTypeRefer()
|
inline |
Check whether this type is a Named Type Reference type.
- Returns
- Whether this->GetClass() == NamedTypeReferenceClass
◆ IsWideChar()
|
inline |
Check whether this type is a Wide Char type.
- Returns
- Whether this->GetClass() == WideCharTypeClass
◆ WithReplacedStructure()
◆ WithReplacedEnumeration()
| Ref< Type > Type::WithReplacedEnumeration | ( | Enumeration * | from, |
| Enumeration * | to ) |
◆ WithReplacedNamedTypeReference()
| Ref< Type > Type::WithReplacedNamedTypeReference | ( | NamedTypeReference * | from, |
| NamedTypeReference * | to ) |
◆ AddTypeMemberTokens()
◆ EnumerateTypesForAccess()
◆ GetLines()
◆ GetSizeSuffix()
|
static |
◆ DerefNamedTypeReference()
◆ BinaryNinja::TypeBuilder
class BinaryNinja::TypeBuilder
Public Member Functions | |
| TypeBuilder () | |
| ~TypeBuilder () | |
| TypeBuilder (BNTypeBuilder *type) | |
| TypeBuilder (const TypeBuilder &type) | |
| TypeBuilder (TypeBuilder &&type) | |
| TypeBuilder (Type *type) | |
| TypeBuilder & | operator= (const TypeBuilder &type) |
| TypeBuilder & | operator= (TypeBuilder &&type) |
| TypeBuilder & | operator= (Type *type) |
| Ref< Type > | Finalize () |
| 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 |
| BNCallingConventionName | GetCallingConventionName () const |
| std::vector< FunctionParameter > | GetParameters () const |
| Confidence< bool > | HasVariableArguments () const |
| Confidence< bool > | CanReturn () const |
| Confidence< bool > | IsPure () const |
| Ref< Structure > | GetStructure () const |
| Ref< Enumeration > | GetEnumeration () const |
| Ref< NamedTypeReference > | GetNamedTypeReference () const |
| Confidence< BNMemberScope > | GetScope () const |
| BNNameType | GetNameType () const |
| bool | HasTemplateArguments () const |
| TypeBuilder & | SetWidth (size_t width) |
| TypeBuilder & | SetAlignment (size_t alignment) |
| TypeBuilder & | SetNamedTypeReference (NamedTypeReference *ntr) |
| TypeBuilder & | SetScope (const Confidence< BNMemberScope > &scope) |
| TypeBuilder & | SetConst (const Confidence< bool > &cnst) |
| TypeBuilder & | SetVolatile (const Confidence< bool > &vltl) |
| TypeBuilder & | SetChildType (const Confidence< Ref< Type > > &child) |
| TypeBuilder & | SetCallingConvention (const Confidence< Ref< CallingConvention > > &cc) |
| TypeBuilder & | SetCallingConventionName (BNCallingConventionName cc) |
| TypeBuilder & | SetSigned (const Confidence< bool > &vltl) |
| TypeBuilder & | SetTypeName (const QualifiedName &name) |
| TypeBuilder & | SetAlternateName (const std::string &name) |
| TypeBuilder & | SetSystemCall (bool sc, uint32_t n=0) |
| TypeBuilder & | SetNameType (BNNameType type) |
| TypeBuilder & | SetHasTemplateArguments (bool hasTemplateArguments) |
| Confidence< int64_t > | GetStackAdjustment () const |
| QualifiedName | GetStructureName () const |
| uint64_t | GetElementCount () const |
| uint64_t | GetOffset () const |
| uint32_t | GetSystemCallNumber () const |
| BNPointerBaseType | GetPointerBaseType () const |
| int64_t | GetPointerBaseOffset () const |
| TypeBuilder & | SetOffset (uint64_t offset) |
| TypeBuilder & | SetFunctionCanReturn (const Confidence< bool > &canReturn) |
| TypeBuilder & | SetPure (const Confidence< bool > &pure) |
| TypeBuilder & | SetParameters (const std::vector< FunctionParameter > ¶ms) |
| TypeBuilder & | SetPointerBase (BNPointerBaseType baseType, int64_t baseOffset) |
| std::set< BNPointerSuffix > | GetPointerSuffix () const |
| std::string | GetPointerSuffixString () const |
| std::vector< InstructionTextToken > | GetPointerSuffixTokens (uint8_t baseConfidence=255) const |
| TypeBuilder & | AddPointerSuffix (BNPointerSuffix ps) |
| TypeBuilder & | SetPointerSuffix (const std::set< BNPointerSuffix > &suffix) |
| void | SetAttribute (const std::string &name, const std::string &value) |
| void | SetAttributes (const std::map< std::string, std::string > &attrs) |
| void | RemoveAttribute (const std::string &name) |
| std::vector< TypeAttribute > | GetAttributes () const |
| std::optional< std::string > | GetAttribute (const std::string &name) const |
| 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< InstructionTextToken > | GetTokens (Platform *platform=nullptr, uint8_t baseConfidence=255) const |
| std::vector< InstructionTextToken > | GetTokensBeforeName (Platform *platform=nullptr, uint8_t baseConfidence=255) const |
| std::vector< InstructionTextToken > | GetTokensAfterName (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 > ¶ms, 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 > ¶ms, const Confidence< bool > &hasVariableArguments, const Confidence< bool > &canReturn, const Confidence< int64_t > &stackAdjust, const std::map< uint32_t, Confidence< int32_t > > ®StackAdjust=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 TypeBuilder | VarArgsType () |
| static TypeBuilder | ValueType (const std::string &value) |
◆ TypeBuilder() [1/5]
| TypeBuilder::TypeBuilder | ( | ) |
◆ ~TypeBuilder()
| TypeBuilder::~TypeBuilder | ( | ) |
◆ TypeBuilder() [2/5]
◆ TypeBuilder() [3/5]
| TypeBuilder::TypeBuilder | ( | const TypeBuilder & | type | ) |
◆ TypeBuilder() [4/5]
| TypeBuilder::TypeBuilder | ( | TypeBuilder && | type | ) |
◆ TypeBuilder() [5/5]
| TypeBuilder::TypeBuilder | ( | Type * | type | ) |
◆ 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()
◆ GetClass()
◆ GetWidth()
| uint64_t TypeBuilder::GetWidth | ( | ) | const |
◆ GetAlignment()
| size_t TypeBuilder::GetAlignment | ( | ) | const |
◆ GetTypeName()
◆ IsSigned()
| Confidence< bool > TypeBuilder::IsSigned | ( | ) | const |
◆ IsConst()
◆ IsVolatile()
| Confidence< bool > TypeBuilder::IsVolatile | ( | ) | const |
◆ IsSystemCall()
| bool TypeBuilder::IsSystemCall | ( | ) | const |
◆ SetIntegerTypeDisplayType()
◆ GetChildType()
◆ GetCallingConvention()
◆ GetCallingConventionName()
◆ GetParameters()
◆ HasVariableArguments()
| Confidence< bool > TypeBuilder::HasVariableArguments | ( | ) | const |
◆ CanReturn()
| Confidence< bool > TypeBuilder::CanReturn | ( | ) | const |
◆ IsPure()
◆ GetStructure()
◆ GetEnumeration()
| Ref< Enumeration > TypeBuilder::GetEnumeration | ( | ) | const |
◆ GetNamedTypeReference()
| Ref< NamedTypeReference > TypeBuilder::GetNamedTypeReference | ( | ) | const |
◆ GetScope()
◆ GetNameType()
◆ HasTemplateArguments()
| bool TypeBuilder::HasTemplateArguments | ( | ) | const |
◆ SetWidth()
| TypeBuilder & TypeBuilder::SetWidth | ( | size_t | width | ) |
◆ SetAlignment()
| TypeBuilder & TypeBuilder::SetAlignment | ( | size_t | alignment | ) |
◆ SetNamedTypeReference()
| TypeBuilder & TypeBuilder::SetNamedTypeReference | ( | NamedTypeReference * | ntr | ) |
◆ SetScope()
◆ SetConst()
| TypeBuilder & TypeBuilder::SetConst | ( | const Confidence< bool > & | cnst | ) |
◆ SetVolatile()
| TypeBuilder & TypeBuilder::SetVolatile | ( | const Confidence< bool > & | vltl | ) |
◆ SetChildType()
◆ SetCallingConvention()
◆ SetCallingConventionName()
◆ SetSigned()
| TypeBuilder & TypeBuilder::SetSigned | ( | const Confidence< bool > & | vltl | ) |
◆ SetTypeName()
◆ SetAlternateName()
| TypeBuilder & TypeBuilder::SetAlternateName | ( | const std::string & | name | ) |
◆ SetSystemCall()
| TypeBuilder & TypeBuilder::SetSystemCall | ( | bool | sc, |
| uint32_t | n = 0 ) |
◆ SetNameType()
◆ SetHasTemplateArguments()
| TypeBuilder & TypeBuilder::SetHasTemplateArguments | ( | bool | hasTemplateArguments | ) |
◆ GetStackAdjustment()
| Confidence< int64_t > TypeBuilder::GetStackAdjustment | ( | ) | const |
◆ GetStructureName()
◆ GetElementCount()
| uint64_t TypeBuilder::GetElementCount | ( | ) | const |
◆ GetOffset()
| uint64_t TypeBuilder::GetOffset | ( | ) | const |
◆ GetSystemCallNumber()
| uint32_t TypeBuilder::GetSystemCallNumber | ( | ) | const |
◆ GetPointerBaseType()
◆ GetPointerBaseOffset()
| int64_t TypeBuilder::GetPointerBaseOffset | ( | ) | 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()
◆ SetPointerBase()
◆ GetPointerSuffix()
◆ GetPointerSuffixString()
| std::string TypeBuilder::GetPointerSuffixString | ( | ) | const |
◆ GetPointerSuffixTokens()
| std::vector< InstructionTextToken > TypeBuilder::GetPointerSuffixTokens | ( | uint8_t | baseConfidence = 255 | ) | const |
◆ AddPointerSuffix()
◆ SetPointerSuffix()
◆ SetAttribute()
| void TypeBuilder::SetAttribute | ( | const std::string & | name, |
| const std::string & | value ) |
◆ SetAttributes()
| void TypeBuilder::SetAttributes | ( | const std::map< std::string, std::string > & | attrs | ) |
◆ RemoveAttribute()
| void TypeBuilder::RemoveAttribute | ( | const std::string & | name | ) |
◆ GetAttributes()
| std::vector< TypeAttribute > TypeBuilder::GetAttributes | ( | ) | const |
◆ GetAttribute()
| std::optional< std::string > TypeBuilder::GetAttribute | ( | const std::string & | name | ) | const |
◆ 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()
◆ GetTokensBeforeName()
◆ GetTokensAfterName()
◆ VoidType()
|
static |
◆ BoolType()
|
static |
◆ IntegerType()
|
static |
◆ FloatType()
|
static |
◆ WideCharType()
|
static |
◆ StructureType() [1/2]
|
static |
◆ StructureType() [2/2]
|
static |
◆ NamedType() [1/5]
◆ NamedType() [2/5]
◆ NamedType() [3/5]
◆ NamedType() [4/5]
|
static |
◆ NamedType() [5/5]
◆ EnumerationType() [1/2]
◆ EnumerationType() [2/2]
◆ PointerType() [1/2]
◆ PointerType() [2/2]
◆ ArrayType()
|
static |
◆ FunctionType() [1/2]
◆ FunctionType() [2/2]
|
static |
◆ VarArgsType()
|
static |
◆ ValueType()
|
static |
◆ IsReferenceOfType()
◆ IsStructReference()
|
inline |
◆ IsEnumReference()
|
inline |
◆ IsUnionReference()
|
inline |
◆ IsClassReference()
|
inline |
◆ IsTypedefReference()
|
inline |
◆ IsStructOrClassReference()
|
inline |
◆ IsVoid()
|
inline |
◆ IsBool()
|
inline |
◆ IsInteger()
|
inline |
◆ IsFloat()
|
inline |
◆ IsStructure()
|
inline |
◆ IsEnumeration()
|
inline |
◆ IsPointer()
|
inline |
◆ IsArray()
|
inline |
◆ IsFunction()
|
inline |
◆ IsVarArgs()
|
inline |
◆ IsValue()
|
inline |
◆ IsNamedTypeRefer()
|
inline |
◆ IsWideChar()
|
inline |
◆ BinaryNinja::NamedTypeReference
class BinaryNinja::NamedTypeReference
◆ BinaryNinja::NamedTypeReferenceBuilder
class BinaryNinja::NamedTypeReferenceBuilder
◆ BinaryNinja::StructureMember
struct BinaryNinja::StructureMember
◆ 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< NamedTypeReference > | type |
| uint64_t | offset |
| uint64_t | width |
◆ BaseStructure() [1/2]
| BaseStructure::BaseStructure | ( | NamedTypeReference * | type, |
| uint64_t | offset, | ||
| uint64_t | width ) |
◆ BaseStructure() [2/2]
| BaseStructure::BaseStructure | ( | Type * | type, |
| uint64_t | offset ) |
◆ 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< BaseStructure > | GetBaseStructures () const |
| Get a list of base structures. | |
| std::vector< StructureMember > | GetMembers () const |
| Get a list of Structure members, excluding those inherited from base structures. | |
| std::vector< InheritedStructureMember > | GetMembersIncludingInherited (const TypeContainer &types) const |
| Get a list of Structure members, including those inherited from base structures. | |
| bool | GetMemberIncludingInheritedAtOffset (BinaryView *view, int64_t offset, InheritedStructureMember &result) const |
| Get a structure member (including inherited members) at a certain offset. | |
| bool | GetMemberByName (const std::string &name, StructureMember &result) const |
| Get a structure member by name. | |
| bool | GetMemberAtOffset (int64_t offset, StructureMember &result) const |
| Get a structure member at a certain offset. | |
| bool | GetMemberAtOffset (int64_t offset, StructureMember &result, size_t &idx) const |
| Get a structure member and its index at a certain offset. | |
| uint64_t | GetWidth () const |
| Get the structure width in bytes. | |
| int64_t | GetPointerOffset () const |
| Get the structure pointer offset in bytes. | |
| size_t | GetAlignment () const |
| Get the structure alignment. | |
| bool | IsPacked () const |
| Whether the structure is packed. | |
| bool | IsUnion () const |
| Whether the structure is a union. | |
| bool | PropagateDataVariableReferences () const |
| Whether structure field references propagate the references to data variable field values. | |
| BNStructureVariant | GetStructureType () const |
| Get the structure type. | |
| Ref< Structure > | WithReplacedStructure (Structure *from, Structure *to) |
| Ref< Structure > | WithReplacedEnumeration (Enumeration *from, Enumeration *to) |
| Ref< Structure > | WithReplacedNamedTypeReference (NamedTypeReference *from, NamedTypeReference *to) |
| bool | ResolveMemberOrBaseMember (BinaryView *data, uint64_t offset, size_t size, const std::function< void(NamedTypeReference *baseName, Structure *s, size_t memberIndex, uint64_t structOffset, uint64_t adjustedOffset, const StructureMember &member)> &resolveFunc, std::optional< size_t > memberIndexHint=std::nullopt) |
| Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNStructure, BNNewStructureReference, BNFreeStructure > | |
| CoreRefCountObject () | |
| virtual | ~CoreRefCountObject () |
| BNStructure * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | ReleaseForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
◆ Structure()
◆ 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
-
view The relevant binary view offset Offset to check result Reference 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
-
name Name of the member to retrieve result Reference 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
-
offset Offset to check result Reference 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
-
offset Offset to check result Reference to a StructureMember to copy the result to idx Reference 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()
Get the structure type.
- Returns
- The structure type
◆ WithReplacedStructure()
◆ WithReplacedEnumeration()
| Ref< Structure > Structure::WithReplacedEnumeration | ( | Enumeration * | from, |
| Enumeration * | to ) |
◆ WithReplacedNamedTypeReference()
| Ref< Structure > Structure::WithReplacedNamedTypeReference | ( | NamedTypeReference * | from, |
| NamedTypeReference * | to ) |
◆ ResolveMemberOrBaseMember()
| bool Structure::ResolveMemberOrBaseMember | ( | BinaryView * | data, |
| uint64_t | offset, | ||
| size_t | size, | ||
| const std::function< void(NamedTypeReference *baseName, Structure *s, size_t memberIndex, uint64_t structOffset, uint64_t adjustedOffset, const StructureMember &member)> & | resolveFunc, | ||
| std::optional< size_t > | memberIndexHint = std::nullopt ) |
◆ 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");
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);
Public Member Functions | |
| StructureBuilder () | |
| StructureBuilder (BNStructureBuilder *s) | |
| StructureBuilder (BNStructureVariant type, bool packed=false) | |
| StructureBuilder (const StructureBuilder &s) | |
| StructureBuilder (StructureBuilder &&s) | |
| StructureBuilder (Structure *s) | |
| ~StructureBuilder () | |
| StructureBuilder & | operator= (const StructureBuilder &s) |
| StructureBuilder & | operator= (StructureBuilder &&s) |
| StructureBuilder & | operator= (Structure *s) |
| BNStructureBuilder * | GetObject () |
| Ref< Structure > | Finalize () const |
| Complete the structure building process and return a Structure object. | |
| std::vector< BaseStructure > | GetBaseStructures () const |
| StructureBuilder & | SetBaseStructures (const std::vector< BaseStructure > &bases) |
| std::vector< StructureMember > | GetMembers () const |
| GetMembers returns a list of structure members. | |
| bool | GetMemberByName (const std::string &name, StructureMember &result) const |
| GetMemberByName retrieves a structure member by name. | |
| bool | GetMemberAtOffset (int64_t offset, StructureMember &result) const |
| bool | GetMemberAtOffset (int64_t offset, StructureMember &result, size_t &idx) const |
| uint64_t | GetWidth () const |
| StructureBuilder & | SetWidth (size_t width) |
| int64_t | GetPointerOffset () const |
| StructureBuilder & | SetPointerOffset (int64_t offset) |
| size_t | GetAlignment () const |
| StructureBuilder & | SetAlignment (size_t align) |
| bool | IsPacked () const |
| StructureBuilder & | SetPacked (bool packed) |
| bool | IsUnion () const |
| bool | PropagateDataVariableReferences () const |
| StructureBuilder & | SetPropagateDataVariableReferences (bool value) |
| StructureBuilder & | SetStructureType (BNStructureVariant type) |
| Set the structure type. | |
| BNStructureVariant | GetStructureType () const |
| Get the Structure Type. | |
| 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. | |
| StructureBuilder & | AddMemberAtOffset (const Confidence< Ref< Type > > &type, const std::string &name, uint64_t offset, bool overwriteExisting=true, BNMemberAccess access=NoAccess, BNMemberScope scope=NoScope, uint8_t bitPosition=0, uint8_t bitWidth=0) |
| AddMemberAtOffset adds a member at a specific offset within the struct. | |
| StructureBuilder & | AddMemberAtBitOffset (const Confidence< Ref< Type > > &type, const std::string &name, uint64_t bitOffset, uint8_t bitWidth, bool overwriteExisting=true, BNMemberAccess access=NoAccess, BNMemberScope scope=NoScope) |
| AddMemberAtBitOffset adds a member at a specific bit offset within the struct. | |
| StructureBuilder & | RemoveMember (size_t idx) |
| RemoveMember removes a member at a specified index. | |
| StructureBuilder & | ReplaceMember (size_t idx, const Confidence< Ref< Type > > &type, const std::string &name, bool overwriteExisting=true) |
| ReplaceMember replaces a member at an index. | |
◆ StructureBuilder() [1/6]
| StructureBuilder::StructureBuilder | ( | ) |
◆ StructureBuilder() [2/6]
◆ StructureBuilder() [3/6]
◆ 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 | ( | ) |
◆ 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()
◆ Finalize()
◆ 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
-
name Name of the member (field) result Reference 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()
Set the structure type.
- Parameters
-
type One of: ClassStructureType, StructStructureType, UnionStructureType
- Returns
- reference to this StructureBuilder
◆ GetStructureType()
- Returns
- A BNStructureVariant
- Return values
-
ClassStructureType If this structure represents a class StructStructureType If this structure represents a structure UnionStructureType If this structure represents a union
◆ AddMember()
AddMember adds a member (field) to a structure.
- Parameters
-
type Type of the Field name Name of the field access Optional, One of NoAccess, PrivateAccess, ProtectedAccess, PublicAccess scope Optional, One of NoScope, StaticScope, VirtualScope, ThunkScope, FriendScope
- Returns
- reference to the Structure Builder
◆ AddMemberAtOffset()
AddMemberAtOffset adds a member at a specific offset within the struct.
- Parameters
-
type Type of the Field name Name of the field offset Offset to add the member within the struct overwriteExisting Whether to overwrite an existing member at that offset, Optional, default true access One of NoAccess, PrivateAccess, ProtectedAccess, PublicAccess scope One of NoScope, StaticScope, VirtualScope, ThunkScope, FriendScope bitPosition The number of bits from the start of the `offset` to place this member, used for bitfields bitWidth The number of bits wide to make the member, this is analogous to a bitfield width in C
- Returns
- Reference to the StructureBuilder
◆ AddMemberAtBitOffset()
AddMemberAtBitOffset adds a member at a specific bit offset within the struct.
- Parameters
-
type Type of the Field name Name of the field bitOffset Offset, in bits, to add the member within the struct bitWidth The number of bits wide to make the member, this is analogous to a bitfield width in C overwriteExisting Whether to overwrite an existing member at that offset, Optional, default true access One of NoAccess, PrivateAccess, ProtectedAccess, PublicAccess scope One 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
- 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
-
idx Index of the StructureMember to be replaced type Type of the new Member name Name of the new Member overwriteExisting Whether to overwrite the existing member, default true
- Returns
- Reference to the StructureBuilder
◆ BinaryNinja::EnumerationMember
◆ BinaryNinja::Enumeration
class BinaryNinja::Enumeration
◆ 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);
Public Member Functions | |
| EnumerationBuilder () | |
| EnumerationBuilder (BNEnumerationBuilder *e) | |
| EnumerationBuilder (const EnumerationBuilder &e) | |
| EnumerationBuilder (EnumerationBuilder &&e) | |
| EnumerationBuilder (Enumeration *e) | |
| ~EnumerationBuilder () | |
| BNEnumerationBuilder * | GetObject () |
| EnumerationBuilder & | operator= (const EnumerationBuilder &e) |
| EnumerationBuilder & | operator= (EnumerationBuilder &&e) |
| EnumerationBuilder & | operator= (Enumeration *e) |
| Ref< Enumeration > | Finalize () const |
| Finalize the building process and return the built Enumeration. | |
| std::vector< EnumerationMember > | GetMembers () const |
| Get a list of members in this enum. | |
| EnumerationBuilder & | AddMember (const std::string &name) |
| Add a member to the enum. | |
| EnumerationBuilder & | AddMemberWithValue (const std::string &name, uint64_t value) |
| Add a member to the enum with a set value. | |
| EnumerationBuilder & | RemoveMember (size_t idx) |
| Remove a member from the enum. | |
| EnumerationBuilder & | ReplaceMember (size_t idx, const std::string &name, uint64_t value) |
| Replace a member at an index. | |
◆ EnumerationBuilder() [1/5]
| EnumerationBuilder::EnumerationBuilder | ( | ) |
◆ EnumerationBuilder() [2/5]
◆ 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 | ( | ) |
◆ GetObject()
◆ 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
-
name Name 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
-
name Name of the enum member value Value of th enum member
- Returns
- A reference to this EnumerationBuilder
◆ RemoveMember()
| EnumerationBuilder & EnumerationBuilder::RemoveMember | ( | size_t | idx | ) |
◆ ReplaceMember()
| EnumerationBuilder & EnumerationBuilder::ReplaceMember | ( | size_t | idx, |
| const std::string & | name, | ||
| uint64_t | value ) |
Replace a member at an index.
- Parameters
-
idx Index to replace name Name of the new member value Value 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. | |
| TypeContainer (Ref< TypeLibrary > library) | |
| Get the Type Container for a Type Library. | |
| TypeContainer (Ref< TypeArchive > archive) | |
| Get the Type Container for a Type Archive. | |
| TypeContainer (Ref< Platform > platform) | |
| Get the Type Container for a Platform. | |
| ~TypeContainer () | |
| TypeContainer (const TypeContainer &other) | |
| TypeContainer (TypeContainer &&other) | |
| TypeContainer & | operator= (const TypeContainer &other) |
| TypeContainer & | operator= (TypeContainer &&other) |
| bool | operator== (const TypeContainer &other) const |
| bool | operator!= (const TypeContainer &other) const |
| BNTypeContainer * | GetObject () const |
| std::string | GetId () const |
| Get an id string for the Type Container. | |
| std::string | GetName () const |
| Get a user-friendly name for the Type Container. | |
| BNTypeContainerType | GetType () const |
| Get the type of underlying model the Type Container is accessing. | |
| bool | IsMutable () const |
| Test if the Type Container supports mutable operations (add, rename, delete). | |
| Ref< Platform > | GetPlatform () const |
| Get the Platform object associated with this Type Container. | |
| std::optional< std::string > | AddType (QualifiedName name, Ref< Type > type) |
| Add or update a single type in the Type Container. | |
| std::optional< std::unordered_map< QualifiedName, std::string > > | AddTypes (const std::vector< std::pair< QualifiedName, Ref< Type > > > &types, ProgressFunction progress={}) |
| Add or update types to a Type Container. | |
| bool | RenameType (const std::string &typeId, const QualifiedName &newName) |
| Rename a type in the Type Container. | |
| bool | DeleteType (const std::string &typeId) |
| Delete a type in the Type Container. | |
| std::optional< std::string > | GetTypeId (const QualifiedName &typeName) const |
| Get the unique id of the type in the Type Container with the given name. | |
| std::optional< QualifiedName > | GetTypeName (const std::string &typeId) const |
| Get the unique name of the type in the Type Container with the given id. | |
| std::optional< Ref< Type > > | GetTypeById (const std::string &typeId) const |
| Get the definition of the type in the Type Container with the given id. | |
| std::optional< std::unordered_map< std::string, std::pair< QualifiedName, Ref< Type > > > > | GetTypes () const |
| Get a mapping of all types in a Type Container. | |
| std::optional< Ref< Type > > | GetTypeByName (const QualifiedName &typeName) const |
| Get the definition of the type in the Type Container with the given name. | |
| std::optional< std::unordered_set< std::string > > | GetTypeIds () const |
| Get all type ids in a Type Container. | |
| std::optional< std::unordered_set< QualifiedName > > | GetTypeNames () const |
| Get all type names in a Type Container. | |
| std::optional< std::unordered_map< std::string, QualifiedName > > | GetTypeNamesAndIds () const |
| Get a mapping of all type ids and type names in a Type Container. | |
| size_t | GetTypeCount () const |
| Get the number of types in a Type Container. | |
| bool | ParseTypeString (const std::string &source, bool importDependencies, 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. | |
| bool | ParseTypeString (const std::string &source, QualifiedNameAndType &result, std::vector< TypeParserError > &errors) |
| 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, bool importDependencies, 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. | |
| 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) |
Static Public Member Functions | |
| static TypeContainer | GetEmptyTypeContainer () |
| Get an empty type container which contains no types (immutable). | |
◆ TypeContainer() [1/7]
◆ TypeContainer() [2/7]
Get the Type Container for a given BinaryView.
- Parameters
◆ TypeContainer() [3/7]
◆ TypeContainer() [4/7]
◆ TypeContainer() [5/7]
◆ ~TypeContainer()
| TypeContainer::~TypeContainer | ( | ) |
◆ TypeContainer() [6/7]
| TypeContainer::TypeContainer | ( | const TypeContainer & | other | ) |
◆ TypeContainer() [7/7]
| TypeContainer::TypeContainer | ( | TypeContainer && | other | ) |
◆ operator=() [1/2]
| TypeContainer & TypeContainer::operator= | ( | const TypeContainer & | other | ) |
◆ operator=() [2/2]
| TypeContainer & TypeContainer::operator= | ( | TypeContainer && | other | ) |
◆ operator==()
|
inline |
◆ operator!=()
|
inline |
◆ GetObject()
◆ GetEmptyTypeContainer()
|
static |
Get an empty type container which contains no types (immutable).
- Returns
- Empty type container
◆ 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()
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()
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
-
name Name of type to add type Definition of type to add
- Returns
- String of added type's id, if successful, std::nullopt otherwise
◆ AddTypes()
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
-
types List of (name, definition) pairs of new types to add progress Optional 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
-
typeId Id of type to update newName New 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
-
typeId Id of type to delete
- Returns
- True if successful
◆ GetTypeId()
| std::optional< std::string > TypeContainer::GetTypeId | ( | const QualifiedName & | typeName | ) | const |
◆ GetTypeName()
| std::optional< QualifiedName > TypeContainer::GetTypeName | ( | const std::string & | typeId | ) | const |
◆ GetTypeById()
◆ 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 |
◆ 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.
Sort order is not guaranteed in 5.2 and later.
- 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
◆ GetTypeCount()
| size_t TypeContainer::GetTypeCount | ( | ) | const |
Get the number of types in a Type Container.
- Returns
- Number of types in the container
◆ ParseTypeString() [1/2]
Parse a single type and name from a string containing their definition, with knowledge of the types in the Type Container.
- Parameters
-
source Source code to parse importDependencies If Type Library / Type Archive types should be imported during parsing result Reference into which the resulting type and name will be written errors Reference to a list into which any parse errors will be written
- Returns
- True if parsing was successful
◆ ParseTypeString() [2/2]
- Deprecated
- Use `ParseTypeString` with the extra `importDependencies` param
◆ ParseTypesFromSource() [1/2]
| 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, | ||
| bool | importDependencies, | ||
| 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
-
text Source code to parse fileName Name of the file containing the source (optional: exists on disk) options Optional string arguments to pass as options, e.g. command line arguments includeDirs Optional list of directories to include in the header search path autoTypeSource Optional source of types if used for automatically generated types importDependencies If Type Library / Type Archive types should be imported during parsing result Reference to structure into which the results will be written errors Reference to a list into which any parse errors will be written
- Returns
- True if successful
◆ ParseTypesFromSource() [2/2]
| 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 ) |
- Deprecated
- Use `ParseTypesFromSource` with the extra `importDependencies` param