log_misc_events

summary: react to UI events/notifications

description:

hooks to be notified about certain UI events, and dump their information to the “Output” window

level: intermediate

Attributes

ui_hook_stat

Classes

MyUiHook

Module Contents

class log_misc_events.MyUiHook

Bases: ida_kernwin.UI_Hooks

cmdname = '<no command>'
inhibit_log = 0
preprocess_action(name)

ida ui is about to handle a user action.

Parameters:

name – (const char *) ui action name. these names can be looked up in ida[tg]ui.cfg

Returns:

0: ok

Returns:

nonzero: a plugin has handled the command

postprocess_action()

an ida ui action has been handled

saving()

The kernel is saving the database.

Returns:

Ignored

saved()

The kernel has saved the database.

Returns:

Ignored

term()

IDA is terminated and the database is already closed. The UI may close its windows in this callback.

This callback is best used within the context of a plugin_t with PLUGIN_FIX flags

get_ea_hint(ea)

The UI wants to display a simple hint for an address in the navigation band

Parameters:

ea – The address

Returns:

String with the hint or None

populating_widget_popup(widget, popup, ctx)

The UI is currently populating the widget popup. Now is a good time to attach actions.

finish_populating_widget_popup(widget, popup, ctx)

The UI is done populating the widget popup. Now is the last chance to attach actions.

range()

The disassembly range has been changed ( idainfo::min_ea … idainfo::max_ea). UI should redraw the scrollbars. See also: ui_lock_range_refresh

Returns:

void

idcstart()

Start of IDC engine work.

Returns:

void

idcstop()

Stop of IDC engine work.

Returns:

void

suspend()

Suspend graphical interface. Only the text version. Interface should respond to it.

Returns:

void

resume()

Resume the suspended graphical interface. Only the text version. Interface should respond to it

Returns:

void

debugger_menu_change(enable)

debugger menu modification detected

Parameters:

enable – (bool) true: debugger menu has been added, or a different debugger has been selected false: debugger menu will be removed (user switched to “No debugger”)

Returns:

void

widget_visible(widget)

TWidget is displayed on the screen. Use this event to populate the window with controls

Parameters:

widget – (TWidget *)

Returns:

void

widget_closing(widget)

TWidget is about to close. This event precedes ui_widget_invisible. Use this to perform some possible actions relevant to the lifecycle of this widget

Parameters:

widget – (TWidget *)

Returns:

void

widget_invisible(widget)

TWidget is being closed. Use this event to destroy the window controls

Parameters:

widget – (TWidget *)

Returns:

void

get_item_hint(ea, max_lines)

ui wants to display multiline hint for an item. See also more generic ui_get_custom_viewer_hint

Parameters:
  • ea – (ea_t) or item id like a structure or enum member

  • max_lines – (int) maximal number of lines

Returns:

true if generated a hint

get_custom_viewer_hint(viewer, place)
ui wants to display a hint for a viewer (idaview or custom). Every subscriber is supposed to append the hint lines to HINT and increment IMPORTANT_LINES accordingly. Completely overwriting the existing lines in HINT is possible but not recommended. If the REG_HINTS_MARKER sequence is found in the returned hints string, it will be replaced with the contents of the “regular” hints. If the SRCDBG_HINTS_MARKER sequence is found in the returned hints string, it will be replaced with the contents of the source-level debugger-generated hints. The following keywords might appear at the beginning of the returned hints: HIGHLIGHT text

where text will be highlighted CAPTION caption caption for the hint widget

Parameters:
  • viewer – (TWidget*) viewer

  • place – (place_t *) current position in the viewer

Returns:

0: continue collecting hints with other subscribers

Returns:

1: stop collecting hints

database_inited(is_new_database, idc_script)

database initialization has completed. the kernel is about to run idc scripts

Parameters:
  • is_new_database – (int)

  • idc_script – (const char *) - may be nullptr

Returns:

void See also ui_initing_database. This event is called for both new and old databases.

ready_to_run()

all UI elements have been initialized. Automatic plugins may hook to this event to perform their tasks.

Returns:

void

get_chooser_item_attrs(chooser, n, attrs)

get item-specific attributes for a chooser. This callback is generated only after enable_chooser_item_attrs()

Parameters:
  • chooser – (const chooser_base_t *)

  • n – (::size_t)

  • attrs – (chooser_item_attrs_t *)

Returns:

void

updating_actions(ctx)

IDA is about to update all actions. If your plugin needs to perform expensive operations more than once (e.g., once per action it registers), you should do them only once, right away.

Parameters:

ctx – (action_update_ctx_t *)

Returns:

void

updated_actions()

IDA is done updating actions.

Returns:

void

plugin_loaded(plugin_info)

The plugin was loaded in memory.

Parameters:

plugin_info – (const plugin_info_t *)

plugin_unloading(plugin_info)

The plugin is about to be unloaded

Parameters:

plugin_info – (const plugin_info_t *)

current_widget_changed(widget, prev_widget)

The currently-active TWidget changed.

Parameters:
  • widget – (TWidget *)

  • prev_widget – (TWidget *)

Returns:

void

screen_ea_changed(ea, prev_ea)

The “current address” changed

Parameters:
  • ea – (ea_t)

  • prev_ea – (ea_t)

Returns:

void

create_desktop_widget(title, cfg)

create a widget, to be placed in the widget tree (at desktop-creation time.)

Parameters:
  • title – (const char *)

  • cfg – (const jobj_t *)

Returns:

TWidget * the created widget, or null

get_lines_rendering_info(out, widget, info)

get lines rendering information

Parameters:
  • out – (lines_rendering_output_t *)

  • widget – (const TWidget *)

  • info – (const lines_rendering_input_t *)

Returns:

void

get_widget_config(widget, cfg)

retrieve the widget configuration (it will be passed back at ui_create_desktop_widget-, and ui_set_widget_config-time)

Parameters:
  • widget – (const TWidget *)

  • cfg – (jobj_t *)

Returns:

void

set_widget_config(widget, cfg)

set the widget configuration

Parameters:
  • widget – (const TWidget *)

  • cfg – (const jobj_t *)

Returns:

void

initing_database()

database initialization has started.

Returns:

void See also ui_database_inited. This event is called for both new and old databases.

destroying_procmod(procmod)

The processor module is about to be destroyed

Parameters:

procmod – (const procmod_t *)

destroying_plugmod(plugmod, entry)

The plugin object is about to be destroyed

Parameters:
  • plugmod – (const plugmod_t *)

  • entry – (const plugin_t *)

desktop_applied(name, from_idb, type)

a desktop has been applied

Parameters:
  • name – (const char *) the desktop name

  • from_idb – (bool) the desktop was stored in the IDB (false if it comes from the registry)

  • type – (int) the desktop type (1-disassembly, 2-debugger, 3-merge)

log_misc_events.ui_hook_stat = 'un'