summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py35
1 files changed, 27 insertions, 8 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index fe270c9a..6adb8b1e 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -8545,7 +8545,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
def find_next_text(
self, start: int, text: str, settings: Optional[_function.DisassemblySettings] = None,
flags: FindFlag = FindFlag.FindCaseSensitive,
- graph_type: FunctionGraphType = FunctionGraphType.NormalFunctionGraph
+ graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph
) -> Optional[int]:
"""
``find_next_text`` searches for string ``text`` occurring in the linear view output starting at the virtual
@@ -8562,7 +8562,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
FindCaseSensitive Case-sensitive search
FindCaseInsensitive Case-insensitive search
==================== ============================
- :param FunctionGraphType graph_type: the IL to search within
+ :param FunctionViewType graph_type: the IL to search within
"""
if not isinstance(text, str):
raise TypeError("text parameter is not str type")
@@ -8572,13 +8572,14 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
raise TypeError("settings parameter is not DisassemblySettings type")
result = ctypes.c_ulonglong()
+ graph_type = _function.FunctionViewType(graph_type)._to_core_struct()
if not core.BNFindNextText(self.handle, start, text, result, settings.handle, flags, graph_type):
return None
return result.value
def find_next_constant(
self, start: int, constant: int, settings: Optional[_function.DisassemblySettings] = None,
- graph_type: FunctionGraphType = FunctionGraphType.NormalFunctionGraph
+ graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph
) -> Optional[int]:
"""
``find_next_constant`` searches for integer constant ``constant`` occurring in the linear view output starting at the virtual
@@ -8587,7 +8588,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
:param int start: virtual address to start searching from.
:param int constant: constant to search for
:param DisassemblySettings settings: disassembly settings
- :param FunctionGraphType graph_type: the IL to search within
+ :param FunctionViewType graph_type: the IL to search within
"""
if not isinstance(constant, int):
raise TypeError("constant parameter is not integral type")
@@ -8597,6 +8598,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
raise TypeError("settings parameter is not DisassemblySettings type")
result = ctypes.c_ulonglong()
+ graph_type = _function.FunctionViewType(graph_type)._to_core_struct()
if not core.BNFindNextConstant(self.handle, start, constant, result, settings.handle, graph_type):
return None
return result.value
@@ -8706,7 +8708,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
def find_all_text(
self, start: int, end: int, text: str, settings: Optional[_function.DisassemblySettings] = None,
- flags=FindFlag.FindCaseSensitive, graph_type=FunctionGraphType.NormalFunctionGraph, progress_func=None,
+ flags=FindFlag.FindCaseSensitive, graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func=None,
match_callback=None
) -> QueueGenerator:
"""
@@ -8727,7 +8729,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
FindCaseSensitive Case-sensitive search
FindCaseInsensitive Case-insensitive search
==================== ============================
- :param FunctionGraphType graph_type: the IL to search within
+ :param FunctionViewType graph_type: the IL to search within
:param callback progress_func: optional function to be called with the current progress \
and total count. This function should return a boolean value that decides whether the \
search should continue or stop
@@ -8752,6 +8754,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
raise TypeError("settings parameter is not DisassemblySettings type")
if not isinstance(flags, FindFlag):
raise TypeError('flag parameter must have type FindFlag')
+ graph_type = _function.FunctionViewType(graph_type)._to_core_struct()
if progress_func:
progress_func_obj = ctypes.CFUNCTYPE(
@@ -8799,7 +8802,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
def find_all_constant(
self, start: int, end: int, constant: int, settings: Optional[_function.DisassemblySettings] = None,
- graph_type: FunctionGraphType = FunctionGraphType.NormalFunctionGraph, progress_func: Optional[ProgressFuncType] = None,
+ graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func: Optional[ProgressFuncType] = None,
match_callback: Optional[LineMatchCallbackType] = None
) -> QueueGenerator:
"""
@@ -8817,7 +8820,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
:param int constant: constant to search for
:param DisassemblySettings settings: DisassemblySettings object used to render the text \
to be searched
- :param FunctionGraphType graph_type: the IL to search within
+ :param FunctionViewType graph_type: the IL to search within
:param callback progress_func: optional function to be called with the current progress \
and total count. This function should return a boolean value that decides whether the \
search should continue or stop
@@ -8839,6 +8842,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
settings.set_option(DisassemblyOption.WaitForIL, True)
if not isinstance(settings, _function.DisassemblySettings):
raise TypeError("settings parameter is not DisassemblySettings type")
+ graph_type = _function.FunctionViewType(graph_type)._to_core_struct()
if progress_func:
progress_func_obj = ctypes.CFUNCTYPE(
@@ -9628,6 +9632,21 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
def memory_map(self):
return MemoryMap(handle=self.handle)
+ def stringify_unicode_data(
+ self, arch: Optional['architecture.Architecture'], buffer: 'databuffer.DataBuffer',
+ allow_short_strings: bool = False
+ ) -> Tuple[Optional[str], Optional[StringType]]:
+ string = ctypes.c_char_p()
+ string_type = ctypes.c_int()
+ if arch is not None:
+ arch = arch.handle
+ if not core.BNStringifyUnicodeData(
+ self.handle, arch, buffer.handle, allow_short_strings, ctypes.byref(string), ctypes.byref(string_type)):
+ return None, None
+ result = string.value
+ core.BNFreeString(string)
+ return result, StringType(string_type.value)
+
class BinaryReader:
"""
``class BinaryReader`` is a convenience class for reading binary data.