我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用idaapi.UI_Hooks()。
def __init__(self, skel_conn): idaapi.UI_Hooks.__init__(self) self.skel_conn = skel_conn
def init(self): """init callback, invoked by IDA when the plugin is loaded.""" self.core = Continuum() zelf = self # Place UI hook so we know when to create our UI stuff. class UiHooks(idaapi.UI_Hooks): def ready_to_run(self, *_): zelf.ui_init() zelf.ui_hook.unhook() self.ui_hook = UiHooks() self.ui_hook.hook() # Setup IDP hook for type changes. class IdbHooks(idaapi.IDB_Hooks): def local_types_changed(self, *args): if zelf.core.client and not zelf.core.project.ignore_changes: zelf.core.project.index.index_types_for_this_idb(purge_locally_deleted=True) zelf.core.client.send_sync_types(purge_non_indexed=True) return 0 self.idb_hook = IdbHooks() self.idb_hook.hook() # Hack ref to plugin core object into idaapi for easy debugging. idaapi.continuum = self.core print("[continuum] v0.0.0 by athre0z (zyantific.com) loaded!") return idaapi.PLUGIN_KEEP
def __start_ida__(cls): api = [ ('idp', idaapi.IDP_Hooks), ('idb', idaapi.IDB_Hooks), ('ui', idaapi.UI_Hooks), ] priorityhook = internal.interface.priorityhook for attr, hookcls in api: if not hasattr(cls, attr): setattr(cls, attr, priorityhook(hookcls)) continue return