static bool idaapi ct_object_explorer_click(TCustomControl *v, int shift, void *ud) { int x, y; place_t *place = get_custom_viewer_place(v, true, &x, &y); simpleline_place_t *spl = (simpleline_place_t *)place; int line_num = spl->n; ea_t cur_vt_ea = vtbl_t_list[line_num].ea_begin; jumpto(cur_vt_ea); return true; }
static bool idaapi ct_vtbl_xrefs_window_click(TCustomControl *v, int shift, void *ud) { int x, y; place_t *place = get_custom_viewer_place(v, true, &x, &y); simpleline_place_t *spl = (simpleline_place_t *)place; int line_num = spl->n; ea_t cur_xref_ea = xref_addr[line_num]; jumpto(cur_xref_ea); return true; }
//-------------------------------------------------------------------------- static void jump_to_node(graph_info_t *gi, const int nid) { viewer_center_on(gi->gv, nid); int x, y; // will return a place only when a node was previously selected place_t *old_pl = get_custom_viewer_place(gi->gv, false, &x, &y); if ( old_pl != NULL ) { user_graph_place_t *new_pl = (user_graph_place_t *) old_pl->clone(); new_pl->node = nid; jumpto(gi->gv, new_pl, x, y); delete new_pl; } }
static int idaapi hook_ui(void *user_data, int notification_code, va_list va) { switch (notification_code) { case ui_notification_t::ui_get_custom_viewer_hint: { TCustomControl *viewer = va_arg(va, TCustomControl *); place_t *place = va_arg(va, place_t *); int *important_lines = va_arg(va, int *); qstring &hint = *va_arg(va, qstring *); if (place == NULL) return 0; int x, y; if (get_custom_viewer_place(viewer, true, &x, &y) == NULL) return 0; char buf[MAXSTR]; const char *line = get_custom_viewer_curline(viewer, true); tag_remove(line, buf, sizeof(buf)); if (x >= (int)strlen(buf)) return 0; idaplace_t &pl = *(idaplace_t *)place; if (decode_insn(pl.ea) && dbg_started) { insn_t _cmd = cmd; int flags = calc_default_idaplace_flags(); linearray_t ln(&flags); for (int i = 0; i < qnumber(_cmd.Operands); i++) { op_t op = _cmd.Operands[i]; if (op.type != o_void) { switch (op.type) { case o_mem: case o_near: { idaplace_t here; here.ea = op.addr; here.lnnum = 0; ln.set_place(&here); hint.cat_sprnt((COLSTR(SCOLOR_INV"OPERAND#%d (ADDRESS: $%a)\n", SCOLOR_DREF)), op.n, op.addr); (*important_lines)++; int n = qmin(ln.get_linecnt(), 10); // how many lines for this address? (*important_lines) += n; for (int j = 0; j < n; ++j) { hint.cat_sprnt("%s\n", ln.down()); } } break; case o_phrase: case o_reg: { regval_t reg; int reg_idx = idp_to_dbg_reg(op.reg); const char *reg_name = dbg->registers(reg_idx).name; if (get_reg_val(reg_name, ®)) { idaplace_t here; here.ea = (uint32)reg.ival; here.lnnum = 0; ln.set_place(&here); hint.cat_sprnt((COLSTR(SCOLOR_INV"OPERAND#%d (REGISTER: %s)\n", SCOLOR_DREF)), op.n, reg_name); (*important_lines)++; int n = qmin(ln.get_linecnt(), 10); // how many lines for this address? (*important_lines) += n; for (int j = 0; j < n; ++j) { hint.cat_sprnt("%s\n", ln.down()); } } } break; case o_displ: { regval_t main_reg, add_reg; int main_reg_idx = idp_to_dbg_reg(op.reg); int add_reg_idx = idp_to_dbg_reg(op.specflag1 & 0xF); main_reg.ival = 0; add_reg.ival = 0; if (op.specflag2 & 0x10) { get_reg_val(dbg->registers(add_reg_idx).name, &add_reg); if (op.specflag1 & 0x10) add_reg.ival &= 0xFFFF; } if (main_reg_idx != R_PC) get_reg_val(dbg->registers(main_reg_idx).name, &main_reg); idaplace_t here; ea_t addr = (uint32)main_reg.ival + op.addr + (uint32)add_reg.ival; // TODO: displacements with PC and other regs unk_123(pc, d0.l); unk_111(d0, d2.w) here.ea = addr; here.lnnum = 0; ln.set_place(&here); hint.cat_sprnt((COLSTR(SCOLOR_INV"OPERAND#%d (DISPLACEMENT: [$%s%X($%X", SCOLOR_DREF)), op.n, ((int)op.addr < 0) ? "-" : "", ((int)op.addr < 0) ? -(int)op.addr : op.addr, (uint32)main_reg.ival ); if (op.specflag2 & 0x10) hint.cat_sprnt((COLSTR(",$%X", SCOLOR_DREF)), (uint32)add_reg.ival); hint.cat_sprnt((COLSTR(")])\n", SCOLOR_DREF))); (*important_lines)++; int n = qmin(ln.get_linecnt(), 10); // how many lines for this address? (*important_lines) += n; for (int j = 0; j < n; ++j) { hint.cat_sprnt("%s\n", ln.down()); } } break; } } } return 1; } } default: return 0; } }