summaryrefslogtreecommitdiff
path: root/python/interaction.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/interaction.py')
-rw-r--r--python/interaction.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/interaction.py b/python/interaction.py
index 5b78b278..49b4e024 100644
--- a/python/interaction.py
+++ b/python/interaction.py
@@ -21,12 +21,13 @@
import ctypes
import traceback
-# Binary Ninja components -- additional imports belong in the appropriate class
+# Binary Ninja components
from binaryninja import _binaryninjacore as core
from binaryninja.enums import FormInputFieldType, MessageBoxIcon, MessageBoxButtonSet, MessageBoxButtonResult
+from binaryninja import binaryview
# 2-3 compatibility
-from six.moves import range
+from binaryninja import range
class LabelField(object):
@@ -152,7 +153,11 @@ class AddressField(object):
class ChoiceField(object):
"""
``ChoiceField`` prompts the user to choose from the list of strings provided in ``choices``. Result is stored
- in self.result as an index in to the coices array.
+ in self.result as an index in to the choices array.
+
+ :attr str prompt: prompt to be presented to the user
+ :attr list(str) choices: list of choices to choose from
+
"""
def __init__(self, prompt, choices):
self.prompt = prompt
@@ -164,7 +169,7 @@ class ChoiceField(object):
value.prompt = self.prompt
choice_buf = (ctypes.c_char_p * len(self.choices))()
for i in range(0, len(self.choices)):
- choice_buf[i] = str(self.choices[i])
+ choice_buf[i] = self.choices[i].encode('charmap')
value.choices = choice_buf
value.count = len(self.choices)
@@ -242,8 +247,6 @@ class DirectoryNameField(object):
class InteractionHandler(object):
-
- from binaryninja import binaryview
_interaction_handler = None
def __init__(self):
@@ -617,7 +620,7 @@ def get_choice_input(prompt, title, choices):
"""
choice_buf = (ctypes.c_char_p * len(choices))()
for i in range(0, len(choices)):
- choice_buf[i] = str(choices[i])
+ choice_buf[i] = str(choices[i]).encode('charmap')
value = ctypes.c_ulonglong()
if not core.BNGetChoiceInput(value, prompt, title, choice_buf, len(choices)):
return None