mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-25 02:26:55 +01:00
109158fabb
- Added AskUsingForm() with embedded forms support (check ex_askusingform.py example and formchooser.py in the SDK) - Added idautils.DecodePreviousInstruction() / DecodePrecedingInstruction() - Added idc.BeginTypeUpdating() / EndTypeUpdating() for fast batch type update operations - Added more IDP callbacks - Added UI_Hooks with a few notification events - Added idaapi.process_ui_action() / idc.ProcessUiAction() - Added netnode.index() to get netnode number - Better handling of ea_t values with bitwise negation - Execute statement hotkey (Ctrl-F3), script timeout, and other options are now configurable with Python.cfg - bugfix: idaapi.msg() / error() and warning() so they don't accept vararg - bugfix: processor_t.id constants were incorrect - bugfix: get_debug_names() was broken with IDA64 - Various bugfixes
85 lines
2.1 KiB
Python
85 lines
2.1 KiB
Python
import idaapi
|
|
from idaapi import Choose2
|
|
|
|
class MyChoose2(Choose2):
|
|
|
|
def __init__(self, title, nb = 5):
|
|
Choose2.__init__(self, title, [ ["Address", 10], ["Name", 30] ])
|
|
self.n = 0
|
|
self.items = [ self.make_item() for x in xrange(0, nb+1) ]
|
|
self.icon = 5
|
|
self.selcount = 0
|
|
self.popup_names = ["Inzert", "Del leet", "Ehdeet", "Ree frech"]
|
|
print("created %s" % str(self))
|
|
|
|
def OnClose(self):
|
|
print "closed", str(self)
|
|
|
|
def OnEditLine(self, n):
|
|
self.items[n][1] = self.items[n][1] + "*"
|
|
print("editing %d" % n)
|
|
|
|
def OnInsertLine(self):
|
|
self.items.append(self.make_item())
|
|
print("insert line")
|
|
|
|
def OnSelectLine(self, n):
|
|
self.selcount += 1
|
|
Warning("[%02d] selectline '%s'" % (self.selcount, n))
|
|
|
|
def OnGetLine(self, n):
|
|
print("getline %d" % n)
|
|
return self.items[n]
|
|
|
|
def OnGetSize(self):
|
|
n = len(self.items)
|
|
print("getsize -> %d" % n)
|
|
return n
|
|
|
|
def OnDeleteLine(self, n):
|
|
print("del %d " % n)
|
|
del self.items[n]
|
|
return n
|
|
|
|
def OnRefresh(self, n):
|
|
print("refresh %d" % n)
|
|
return n
|
|
|
|
def OnCommand(self, n, cmd_id):
|
|
if cmd_id == self.cmd_a:
|
|
print "command A selected @", n
|
|
elif cmd_id == self.cmd_b:
|
|
print "command B selected @", n
|
|
else:
|
|
print "Unknown command:", cmd_id, "@", n
|
|
return 1
|
|
|
|
def OnGetIcon(self, n):
|
|
r = self.items[n]
|
|
t = self.icon + r[1].count("*")
|
|
print "geticon", n, t
|
|
return t
|
|
|
|
def show(self):
|
|
t = self.Show()
|
|
if t < 0:
|
|
return False
|
|
self.cmd_a = self.AddCommand("command A")
|
|
self.cmd_b = self.AddCommand("command B")
|
|
return True
|
|
|
|
def make_item(self):
|
|
r = [str(self.n), "func_%04d" % self.n]
|
|
self.n += 1
|
|
return r
|
|
|
|
def OnGetLineAttr(self, n):
|
|
print("getlineattr %d" % n)
|
|
if n == 1:
|
|
return [0xFF0000, 0]
|
|
|
|
for i in xrange(1, 5+1):
|
|
c = MyChoose2("choose2 - sample %d" % i, i*2)
|
|
r = c.show()
|
|
print r
|