diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2023-03-16 19:54:07 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2023-03-30 18:05:12 -0400 |
| commit | d811fffd69ffba789b960edd4fa31cc3d3f5905e (patch) | |
| tree | 09d036bc3cedc4b93f9fc45b77ebf86659ee0aec /python/binaryview.py | |
| parent | 1113603311856740654617341767562218182618 (diff) | |
Add support for deriving structures from other structures
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 5c198986..3d2acbdb 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4488,6 +4488,35 @@ class BinaryView: finally: core.BNFreeDataReferences(refs) + def get_data_refs_from_for_type_field(self, name: '_types.QualifiedNameType', offset: int) -> List[int]: + """ + ``get_data_refs_from_for_type_field`` returns a list of virtual addresses of data which are referenced by the type ``name``. + + Only data referenced by structures with the ``__data_var_refs`` attribute are included. + + :param QualifiedName name: name of type to query for references + :param int offset: offset of the field, relative to the type + :return: list of integers + :rtype: list(integer) + :Example: + + >>> bv.get_data_refs_from_for_type_field('A', 0x8) + [4203812] + >>> + """ + count = ctypes.c_ulonglong(0) + _name = _types.QualifiedName(name)._to_core_struct() + refs = core.BNGetDataReferencesFromForTypeField(self.handle, _name, offset, count) + assert refs is not None, "core.BNGetDataReferencesFromForTypeField returned None" + + result = [] + try: + for i in range(0, count.value): + result.append(refs[i]) + return result + finally: + core.BNFreeDataReferences(refs) + def get_type_refs_for_type(self, name: '_types.QualifiedNameType') -> List['_types.TypeReferenceSource']: """ ``get_type_refs_for_type`` returns a list of TypeReferenceSource objects (xrefs or cross-references) that reference the provided QualifiedName. |
