MCPcopy Index your code
hub / github.com/keystone-engine/keypatch / __init__

Method __init__

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

Source from the content-addressed store, hash-verified

1075# Patcher form
1076class Keypatch_Patcher(Keypatch_Form):
1077 def __init__(self, kp_asm, address, assembly=None, opts=None):
1078 self.setup(kp_asm, address, assembly)
1079
1080 # create Patcher form
1081 Form.__init__(self,
1082 r"""STARTITEM {id:c_assembly}
1083BUTTON YES* Patch
1084KEYPATCH:: Patcher
1085
1086 {FormChangeCb}
1087 <Endian :{c_endian}>
1088 <~S~yntax :{c_syntax}>
1089 <Address :{c_addr}>
1090 <Original :{c_orig_assembly}>
1091 <- Encode:{c_orig_encoding}>
1092 <- Size :{c_orig_len}>
1093 <~A~ssembly :{c_assembly}>
1094 <- Fixup :{c_raw_assembly}>
1095 <- Encode:{c_encoding}>
1096 <- Size :{c_encoding_len}>
1097 <~N~OPs padding until next instruction boundary:{c_opt_padding}>
1098 <Save ~o~riginal instructions in IDA comment:{c_opt_comment}>{c_opt_chk}>
1099 """, {
1100 'c_endian': Form.DropdownListControl(
1101 items = self.kp_asm.endian_lists.keys(),
1102 readonly = True,
1103 selval = self.endian_id),
1104 'c_addr': Form.NumericInput(value=address, swidth=MAX_ADDRESS_LEN, tp=Form.FT_ADDR),
1105 'c_assembly': Form.StringInput(value=self.asm[:MAX_INSTRUCTION_STRLEN], width=MAX_INSTRUCTION_STRLEN),
1106 'c_orig_assembly': Form.StringInput(value=self.orig_asm[:MAX_INSTRUCTION_STRLEN], width=MAX_INSTRUCTION_STRLEN),
1107 'c_orig_encoding': Form.StringInput(value=self.orig_encoding[:MAX_ENCODING_LEN], width=MAX_ENCODING_LEN),
1108 'c_orig_len': Form.NumericInput(value=self.orig_len, swidth=8, tp=Form.FT_DEC),
1109 'c_raw_assembly': Form.StringInput(value='', width=MAX_INSTRUCTION_STRLEN),
1110 'c_encoding': Form.StringInput(value='', width=MAX_ENCODING_LEN),
1111 'c_encoding_len': Form.NumericInput(value=0, swidth=8, tp=Form.FT_DEC),
1112 'c_syntax': Form.DropdownListControl(
1113 items = self.syntax_keys,
1114 readonly = True,
1115 selval = self.syntax_id),
1116 'c_opt_chk':idaapi.Form.ChkGroupControl(('c_opt_padding', 'c_opt_comment', ''), value=opts['c_opt_chk']),
1117 'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
1118 })
1119
1120 self.Compile()
1121
1122 # callback to be executed when any form control changed
1123 def OnFormChange(self, fid):

Callers

nothing calls this directly

Calls 2

setupMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected