summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2021-05-05 17:23:49 +0800
committerXusheng <xusheng@vector35.com>2021-05-26 17:46:13 +0800
commit7c9ada78241e08bf36bd04d989f742a6de721575 (patch)
tree4134fd2f12a504ab17cc0b9acc1fb8d27552490f /python/types.py
parentfd1974b407be042fd84f0267a328a5adabce28e1 (diff)
Add the ability to automatically create struct members
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/types.py b/python/types.py
index 39378963..af62e5b4 100644
--- a/python/types.py
+++ b/python/types.py
@@ -19,6 +19,8 @@
# IN THE SOFTWARE.
from __future__ import absolute_import
+
+from binaryninja.log import log_warn
max_confidence = 255
import ctypes
@@ -1452,26 +1454,26 @@ class Structure(object):
tc.confidence = t.confidence
core.BNAddStructureBuilderMember(self._handle, tc, name)
- def insert(self, offset, t, name = ""):
+ def insert(self, offset, t, name = "", overwriteExisting = True):
if not self._mutable:
raise AttributeError("Finalized Structure object is immutable, use mutable_copy()")
tc = core.BNTypeWithConfidence()
tc.type = t.handle
tc.confidence = t.confidence
- core.BNAddStructureBuilderMemberAtOffset(self._handle, tc, name, offset)
+ core.BNAddStructureBuilderMemberAtOffset(self._handle, tc, name, offset, overwriteExisting)
def remove(self, i):
if not self._mutable:
raise AttributeError("Finalized Structure object is immutable, use mutable_copy()")
core.BNRemoveStructureBuilderMember(self._handle, i)
- def replace(self, i, t, name = ""):
+ def replace(self, i, t, name = "", overwriteExisting = True):
if not self._mutable:
raise AttributeError("Finalized Structure object is immutable, use mutable_copy()")
tc = core.BNTypeWithConfidence()
tc.type = t.handle
tc.confidence = t.confidence
- core.BNReplaceStructureBuilderMember(self._handle, i, tc, name)
+ core.BNReplaceStructureBuilderMember(self._handle, i, tc, name, overwriteExisting)
def mutable_copy(self):
if self._mutable: