From 677a2c3461d3c95b012367c07640987d608dc382 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Mon, 3 May 2021 22:33:48 -0400 Subject: BinaryView.create_user_function() now returns the created function Resolves #1318 --- python/binaryview.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index ca288486..43f2e9db 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3039,7 +3039,7 @@ class BinaryView(object): """ if plat is None: plat = self.platform - core.BNCreateUserFunction(self.handle, plat.handle, addr) + return binaryninja.function.Function(self, core.BNCreateUserFunction(self.handle, plat.handle, addr)) def remove_user_function(self, func): """ @@ -5515,21 +5515,21 @@ class BinaryView(object): graph_type): return None return result.value - + class QueueGenerator: def __init__(self, t, results): self.thread = t self.results = results t.start() - + def __iter__(self): return self - + def __next__(self): while True: if not self.results.empty(): return self.results.get() - + if (not self.thread.is_alive()) and self.results.empty(): raise StopIteration @@ -5672,7 +5672,7 @@ class BinaryView(object): ctypes.POINTER(core.BNLinearDisassemblyLine))\ (lambda ctxt, addr, match, line: not match_callback(addr, match,\ self._LinearDisassemblyLine_convertor(line)) is False) - + return core.BNFindAllTextWithProgress(self.handle, start, end, text, settings.handle, flags, graph_type, None, progress_func_obj, None, match_callback_obj) else: @@ -5689,7 +5689,7 @@ class BinaryView(object): return self.QueueGenerator(t, results) - def find_all_constant(self, start, end, constant, settings = None, + def find_all_constant(self, start, end, constant, settings = None, graph_type = FunctionGraphType.NormalFunctionGraph, progress_func = None, match_callback = None): """ @@ -5748,7 +5748,7 @@ class BinaryView(object): t = threading.Thread(target = lambda: core.BNFindAllConstantWithProgress(self.handle, start, end, constant, settings.handle, graph_type, None, progress_func_obj, None,\ match_callback_obj)) - + return self.QueueGenerator(t, results) def reanalyze(self): -- cgit v1.3.1