diff options
| author | Josh Ferrell <josh@vector35.com> | 2021-03-01 14:03:17 -0500 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2021-03-01 14:03:17 -0500 |
| commit | 7acfe6f01fc669bf08cd301631601a24486bee74 (patch) | |
| tree | e6a4407659175c76e414446fb9515584e7e25ef0 | |
| parent | 41c617baa83557c053616694306053e5aa3d8ad4 (diff) | |
Add methods for creating wide char types
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | python/types.py | 12 | ||||
| -rw-r--r-- | type.cpp | 12 |
4 files changed, 27 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index eac2f6b8..cd52dc44 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -2618,6 +2618,7 @@ __attribute__ ((format (printf, 1, 2))) static Ref<Type> BoolType(); static Ref<Type> IntegerType(size_t width, const Confidence<bool>& sign, const std::string& altName = ""); static Ref<Type> FloatType(size_t width, const std::string& typeName = ""); + static Ref<Type> WideCharType(size_t width, const std::string& typeName = ""); static Ref<Type> StructureType(Structure* strct); static Ref<Type> NamedType(NamedTypeReference* ref, size_t width = 0, size_t align = 1); static Ref<Type> NamedType(const QualifiedName& name, Type* type); @@ -2738,6 +2739,7 @@ __attribute__ ((format (printf, 1, 2))) 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 NamedType(NamedTypeReference* ref, size_t width = 0, size_t align = 1); static TypeBuilder NamedType(const QualifiedName& name, Type* type); diff --git a/binaryninjacore.h b/binaryninjacore.h index b6cefa1d..425a8d3c 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -4254,6 +4254,7 @@ __attribute__ ((format (printf, 1, 2))) BINARYNINJACOREAPI BNType* BNCreateBoolType(void); BINARYNINJACOREAPI BNType* BNCreateIntegerType(size_t width, BNBoolWithConfidence* sign, const char* altName); BINARYNINJACOREAPI BNType* BNCreateFloatType(size_t width, const char* altName); + BINARYNINJACOREAPI BNType* BNCreateWideCharType(size_t width, const char* altName); BINARYNINJACOREAPI BNType* BNCreateStructureType(BNStructure* s); BINARYNINJACOREAPI BNType* BNCreateEnumerationType(BNArchitecture* arch, BNEnumeration* e, size_t width, bool isSigned); BINARYNINJACOREAPI BNType* BNCreatePointerType(BNArchitecture* arch, BNTypeWithConfidence* type, @@ -4274,6 +4275,7 @@ __attribute__ ((format (printf, 1, 2))) BINARYNINJACOREAPI BNTypeBuilder* BNCreateBoolTypeBuilder(void); BINARYNINJACOREAPI BNTypeBuilder* BNCreateIntegerTypeBuilder(size_t width, BNBoolWithConfidence* sign, const char* altName); BINARYNINJACOREAPI BNTypeBuilder* BNCreateFloatTypeBuilder(size_t width, const char* altName); + BINARYNINJACOREAPI BNTypeBuilder* BNCreateWideCharTypeBuilder(size_t width, const char* altName); BINARYNINJACOREAPI BNTypeBuilder* BNCreateStructureTypeBuilder(BNStructure* s); BINARYNINJACOREAPI BNTypeBuilder* BNCreateEnumerationTypeBuilder(BNArchitecture* arch, BNEnumeration* e, size_t width, bool isSigned); BINARYNINJACOREAPI BNTypeBuilder* BNCreatePointerTypeBuilder(BNArchitecture* arch, BNTypeWithConfidence* type, diff --git a/python/types.py b/python/types.py index e6ab5c2b..76f8c7f0 100644 --- a/python/types.py +++ b/python/types.py @@ -811,7 +811,7 @@ class Type(object): @classmethod def float(self, width, altname=""): """ - ``float`` class method for creating an floating point Types. + ``float`` class method for creating floating point Types. :param int width: width of the floating point number in bytes :param str altname: alternate name for type @@ -819,6 +819,16 @@ class Type(object): return Type(core.BNCreateFloatTypeBuilder(width, altname)) @classmethod + def wide_char(self, width, altname=""): + """ + ``wide_char`` class method for creating wide char Types. + + :param int width: width of the wide character in bytes + :param str altname: alternate name for type + """ + return Type(core.BNCreateWideCharTypeBuilder(width, altname)) + + @classmethod def structure_type(self, structure_type): return Type(core.BNCreateStructureTypeBuilder(structure_type.handle)) @@ -708,6 +708,12 @@ Ref<Type> Type::FloatType(size_t width, const string& altName) } +Ref<Type> Type::WideCharType(size_t width, const string& altName) +{ + return new Type(BNCreateWideCharType(width, altName.c_str())); +} + + Ref<Type> Type::StructureType(Structure* strct) { return new Type(BNCreateStructureType(strct->GetObject())); @@ -1340,6 +1346,12 @@ TypeBuilder TypeBuilder::FloatType(size_t width, const string& altName) } +TypeBuilder TypeBuilder::WideCharType(size_t width, const string& altName) +{ + return TypeBuilder(BNCreateWideCharTypeBuilder(width, altName.c_str())); +} + + TypeBuilder TypeBuilder::StructureType(Structure* strct) { return TypeBuilder(BNCreateStructureTypeBuilder(strct->GetObject())); |
