MCPcopy
hub / github.com/keystone-engine/keypatch / setup

Method setup

keypatch.py:872–905  ·  view source on GitHub ↗
(self, kp_asm, address, assembly=None)

Source from the content-addressed store, hash-verified

870class Keypatch_Form(idaapi.Form):
871 # prepare for form initializing
872 def setup(self, kp_asm, address, assembly=None):
873 self.kp_asm = kp_asm
874 self.address = address
875
876 # update ordered list of arch and syntax
877 self.syntax_keys = self.kp_asm.dict_to_ordered_list(self.kp_asm.syntax_lists)[0]
878 self.arch_keys = self.kp_asm.dict_to_ordered_list(self.kp_asm.arch_lists)[0]
879
880 # update current arch & mode
881 self.kp_asm.update_hardware_mode()
882
883 # find right value for c_arch & c_endian controls
884 mode = self.kp_asm.mode
885 self.endian_id = 0 # little endian
886 if self.kp_asm.mode & KS_MODE_BIG_ENDIAN:
887 self.endian_id = 1 # big endian
888 mode = self.kp_asm.mode - KS_MODE_BIG_ENDIAN
889
890 self.arch_id = self.kp_asm.find_arch_idx(self.kp_asm.arch, mode)
891
892 self.syntax_id = 0 # to make non-X86 arch happy
893 if self.kp_asm.arch == KS_ARCH_X86:
894 self.syntax_id = self.kp_asm.find_syntax_idx(self.kp_asm.syntax)
895
896 # get original instruction and bytes
897 self.orig_asm = kp_asm.ida_get_disasm(address)
898 (self.orig_encoding, self.orig_len) = kp_asm.ida_get_item(address, hex_output=True)
899 if self.orig_encoding == None:
900 self.orig_encoding = ''
901
902 if assembly is None:
903 self.asm = self.kp_asm.ida_get_disasm(self.address, fixup=True)
904 else:
905 self.asm = assembly
906
907 def __init__(self, kp_asm, address, assembly=None, patch_mode=False, opts=0):
908 pass

Callers 3

__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 6

dict_to_ordered_listMethod · 0.80
update_hardware_modeMethod · 0.80
find_arch_idxMethod · 0.80
find_syntax_idxMethod · 0.80
ida_get_disasmMethod · 0.80
ida_get_itemMethod · 0.80

Tested by

no test coverage detected