diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-05-20 20:18:52 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2024-05-23 18:12:05 -0400 |
| commit | 3375478963786425457931027834955525009658 (patch) | |
| tree | 33375aa2cfc2650bc27b231a69ba64787b849978 | |
| parent | 7e1e001b7b07285913d05a0dea31fba99395ca02 (diff) | |
Add TypeBuilder::SetWidth and TypeBuilder::SetAlignment
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | python/types.py | 8 | ||||
| -rw-r--r-- | type.cpp | 22 |
4 files changed, 34 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index d2cf74d2..d8db649b 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -8963,6 +8963,8 @@ namespace BinaryNinja { Ref<Enumeration> GetEnumeration() const; Ref<NamedTypeReference> GetNamedTypeReference() const; Confidence<BNMemberScope> GetScope() 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); diff --git a/binaryninjacore.h b/binaryninjacore.h index 9e0b6986..b865fadc 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -5920,6 +5920,8 @@ extern "C" BINARYNINJACOREAPI void BNSetTypeBuilderPure(BNTypeBuilder* type, BNBoolWithConfidence* pure); BINARYNINJACOREAPI void BNSetFunctionTypeBuilderParameters( BNTypeBuilder* type, BNFunctionParameter* params, size_t paramCount); + BINARYNINJACOREAPI void BNTypeBuilderSetWidth(BNTypeBuilder* type, size_t width); + BINARYNINJACOREAPI void BNTypeBuilderSetAlignment(BNTypeBuilder* type, size_t alignment); BINARYNINJACOREAPI void BNTypeBuilderSetConst(BNTypeBuilder* type, BNBoolWithConfidence* cnst); BINARYNINJACOREAPI void BNTypeBuilderSetVolatile(BNTypeBuilder* type, BNBoolWithConfidence* vltl); BINARYNINJACOREAPI void BNTypeBuilderSetSigned(BNTypeBuilder* type, BNBoolWithConfidence* sign); diff --git a/python/types.py b/python/types.py index 945b88be..aea8f02c 100644 --- a/python/types.py +++ b/python/types.py @@ -749,6 +749,10 @@ class TypeBuilder: def width(self) -> _int: return core.BNGetTypeBuilderWidth(self._handle) + @width.setter + def width(self, value: _int): + core.BNTypeBuilderSetWidth(self._handle, value) + def __len__(self): return self.width @@ -788,6 +792,10 @@ class TypeBuilder: def alignment(self) -> _int: return core.BNGetTypeBuilderAlignment(self._handle) + @alignment.setter + def alignment(self, alignment: _int): + core.BNTypeBuilderSetAlignment(self._handle, alignment) + @property def child(self) -> 'Type': type_conf = core.BNGetTypeBuilderChildType(self._handle) @@ -1349,12 +1349,34 @@ Confidence<bool> TypeBuilder::IsConst() const return Confidence<bool>(result.value, result.confidence); } + +Confidence<bool> TypeBuilder::IsVolatile() const +{ + BNBoolWithConfidence result = BNIsTypeBuilderVolatile(m_object); + return Confidence<bool>(result.value, result.confidence); +} + + void TypeBuilder::SetIntegerTypeDisplayType(BNIntegerDisplayType displayType) { BNSetIntegerTypeDisplayType(m_object, displayType); } +TypeBuilder& TypeBuilder::SetWidth(size_t width) +{ + BNTypeBuilderSetWidth(m_object, width); + return *this; +} + + +TypeBuilder& TypeBuilder::SetAlignment(size_t alignment) +{ + BNTypeBuilderSetAlignment(m_object, alignment); + return *this; +} + + TypeBuilder& TypeBuilder::SetConst(const Confidence<bool>& cnst) { BNBoolWithConfidence bc; |
