summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2025-03-12 18:54:51 -0400
committerkat <kat@vector35.com>2025-03-19 15:04:23 -0400
commitd2371c2edabb7d70c2b31150bfa0e46d7acd1e5e (patch)
treecd87b95725be78b859921cebb97faee6f0cb5d92 /python/binaryview.py
parent7b1813b331f8872ec9bded4fd2df6059fae3d902 (diff)
Add API for BinaryView::FinalizeNewSegments
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 753f589d..b3e4e3d3 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -3678,6 +3678,21 @@ class BinaryView:
finally:
core.BNFreeRelocationRanges(ranges)
+ def finalize_new_segments(self) -> bool:
+ """
+ Performs "finalization" on segments added after initial Finalization (performed after an Init() has completed).
+
+ Finalizing a segment involves optimizing the relocation info stored in that segment, so if a segment is added
+ and relocations are defined for that segment by some automated process, this function should be called afterwards.
+
+ An example of this can be seen in the KernelCache plugin, in `KernelCache::LoadImageWithInstallName`.
+ After we load an image, map new segments, and define relocations for all of them, we call this function
+ to let core know it is now safe to finalize the new segments
+
+ :return: Whether finalization was successful
+ """
+ return core.BNBinaryViewFinalizeNewSegments(self.handle)
+
def range_contains_relocation(self, addr: int, size: int) -> bool:
"""Checks if the specified range overlaps with a relocation"""
return core.BNRangeContainsRelocation(self.handle, addr, size)