summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2019-09-13 21:08:25 -0400
committerRyan Snyder <ryan@vector35.com>2019-09-24 10:42:26 -0400
commitca2d870a3aac0b2154b06f3ab075ca22bd0a0596 (patch)
treef2e56d17914d4412737f788959ab1ecc6531bfd9 /python/binaryview.py
parentc5bd94376017e9d9d98a4dba2fac6b49572cda6d (diff)
typelibrary: more consistent naming, type exports
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index fe3d7dbe..251e96dd 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1621,7 +1621,7 @@ class BinaryView(object):
def type_libraries(self):
"""List of imported type libraries (read-only)"""
count = ctypes.c_ulonglong(0)
- libraries = core.BNBinaryViewGetTypeLibraries(self.handle, count)
+ libraries = core.BNGetBinaryViewTypeLibraries(self.handle, count)
result = []
for i in range(0, count.value):
result.append(typelibrary.TypeLibrary(core.BNNewTypeLibraryReference(libraries[i])))
@@ -4500,7 +4500,7 @@ class BinaryView(object):
"""
if not isinstance(lib, typelibrary.TypeLibrary):
raise ValueError("must pass in a TypeLibrary object")
- core.BNBinaryViewAddTypeLibrary(self.handle, lib.handle)
+ core.BNAddBinaryViewTypeLibrary(self.handle, lib.handle)
def get_type_library(self, name):
"""
@@ -4512,7 +4512,7 @@ class BinaryView(object):
:Example:
"""
- handle = core.BNBinaryViewGetTypeLibrary(self.handle, name)
+ handle = core.BNGetBinaryViewTypeLibrary(self.handle, name)
if handle is None:
return None
return typelibrary.TypeLibrary(handle)
@@ -4640,7 +4640,7 @@ class BinaryView(object):
def import_library_type(self, name, lib = None):
if not isinstance(name, types.QualifiedName):
name = types.QualifiedName(name)
- handle = core.BNBinaryViewImportLibraryType(self.handle, None if lib is None else lib.handle, name._get_core_struct())
+ handle = core.BNBinaryViewImportTypeLibraryType(self.handle, None if lib is None else lib.handle, name._get_core_struct())
if handle is None:
return None
return types.Type(handle, platform = self.platform)
@@ -4648,11 +4648,29 @@ class BinaryView(object):
def import_library_object(self, name, lib = None):
if not isinstance(name, types.QualifiedName):
name = types.QualifiedName(name)
- handle = core.BNBinaryViewImportLibraryObject(self.handle, None if lib is None else lib.handle, name._get_core_struct())
+ handle = core.BNBinaryViewImportTypeLibraryObject(self.handle, None if lib is None else lib.handle, name._get_core_struct())
if handle is None:
return None
return types.Type(handle, platform = self.platform)
+ def export_type_to_library(self, lib, name, type_obj):
+ if not isinstance(name, types.QualifiedName):
+ name = types.QualifiedName(name)
+ if not isinstance(lib, typelibrary.TypeLibrary):
+ raise ValueError("lib must be a TypeLibrary object")
+ if not isinstance(type_obj, types.Type):
+ raise ValueError("type_obj must be a Type object")
+ core.BNBinaryViewExportTypeToTypeLibrary(self.handle, lib.handle, name._get_core_struct(), type_obj.handle)
+
+ def export_object_to_library(self, lib, name, type_obj):
+ if not isinstance(name, types.QualifiedName):
+ name = types.QualifiedName(name)
+ if not isinstance(lib, typelibrary.TypeLibrary):
+ raise ValueError("lib must be a TypeLibrary object")
+ if not isinstance(type_obj, types.Type):
+ raise ValueError("type_obj must be a Type object")
+ core.BNBinaryViewExportObjectToTypeLibrary(self.handle, lib.handle, name._get_core_struct(), type_obj.handle)
+
def register_platform_types(self, platform):
"""
``register_platform_types`` ensures that the platform-specific types for a :py:Class:`Platform` are available