void object_explorer_form_init()
{
	if (!vtbl_list.empty() && !vtbl_t_list.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform("Object Explorer", &hwnd);
		if (hwnd == NULL)
		{
			warning("Object Explorer window already open. Switching to it.");
			form = find_tform("Object Explorer");
			if (form != NULL)
				switchto_tform(form, true);
			return;
		}

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator vtbl_iter;
		for (vtbl_iter = vtbl_list.begin(); vtbl_iter != vtbl_list.end(); vtbl_iter++)
			si->sv.push_back(simpleline_t(*vtbl_iter));

		simpleline_place_t s1;
		simpleline_place_t s2(si->sv.size() - 1);
		si->cv = create_custom_viewer("", NULL, &s1, &s2, &s1, 0, &si->sv);
		si->codeview = create_code_viewer(form, si->cv, CDVF_STATUSBAR);
		set_custom_viewer_handlers(si->cv, ct_object_explorer_keyboard, ct_object_explorer_popup, ct_object_explorer_click, NULL, NULL, si);
		hook_to_notification_point(HT_UI, ui_object_explorer_callback, si);
		open_tform(form, FORM_TAB | FORM_MENU | FORM_RESTORE);
	}
	else
		warning("ObjectExplorer not found any virtual tables here ...");
}
//---------------------------------------------------------------------------
static bool idaapi show_window(void *)
{
  thid_t tid = get_current_thread();

  // Find and refresh existing window
  char title[MAXSTR];
  qsnprintf(title, sizeof(title), "[%04X] - Structured exception handlers list", tid);
  TForm *form = find_tform(title); //lint !e64
  if ( form != NULL )
  {
    switchto_tform(form, true); //lint !e64
    return true;
  }

  x86seh_ctx_t *ch = new x86seh_ctx_t(tid, title);
  if ( !ch->get_sehlist() )
  {
    delete ch;
    return false;
  }

  int code = choose2(CH_NOBTNS,
          -1, -1, -1, -1,
          ch,
          qnumber(x86seh_chooser_cols),
          widths,
          ch_sizer,
          ch_getl,
          title,
          144, // icon
          1,
          NULL,
          NULL,
          ch_update,
          NULL,
          ch_enter,
          ch_destroy,
          NULL,
          NULL);
  if ( code != -1 )
    hook_to_notification_point(HT_DBG, dbg_callback, ch);

  //lint -esym(429,ch) custodial pointer has not been freed or returned
  return true;
}
// Display ctree graph for current decompiled function
static bool idaapi display_ctree_graph(void *ud)
{
	vdui_t &vu = *(vdui_t *)ud;

	// Determine the ctree item to highlight
	vu.get_current_item(USE_KEYBOARD);
	citem_t *highlight = vu.item.is_citem() ? vu.item.e : NULL;
	graph_info_t *gi = graph_info_t::create(vu.cfunc->entry_ea, highlight);

	netnode id;
	id.create();

	qstring title = gi->title;

	HWND hwnd = NULL;
	TForm *form = create_tform(title.c_str(), &hwnd);
	if (hwnd == NULL)
	{
		warning("Ctree Graph window already open. Switching to it.");
		logmsg(DEBUG, "Ctree Graph window already open. Switching to it.");
		form = find_tform(title.c_str());
		if (form != NULL)
			switchto_tform(form, true);
		return true;
	}

	if (hwnd != NULL)
	{
		gi->vu = (vdui_t *)ud;
		gi->form = form;
		gi->gv = create_graph_viewer(form, id, gr_callback, gi, 0);
		open_tform(form, FORM_TAB | FORM_MENU | FORM_QWIDGET);

		viewer_fit_window(gi->gv);
	}

	return true;
}
Esempio n. 4
0
static bool pgraph_create(slist_t *sl, int num)
{
	HWND hwnd = NULL;
	char form_name[512];
	char node_name[512];
	TForm *form;
	bool form_is_new = true;

	create_form_name(form_name, sl, num);
	qsnprintf(node_name, sizeof(node_name), "$ %s", form_name);
	
	form = find_tform(form_name);

	netnode id;
	bool already_existed = !id.create(node_name);
	if (form && already_existed)
	{
		form_is_new = false;
		switchto_tform(form, true);
		sl->gv = get_graph_viewer(form);
	}
	else
	{
		form = create_tform(form_name, &hwnd);
		if (hwnd)
		{
			sl->gv = create_graph_viewer(form, id, graph_callback, sl, 0);
			open_tform(form, FORM_TAB|FORM_MENU|FORM_QWIDGET);
			if (sl->gv)
			{
				viewer_fit_window(sl->gv);
				viewer_add_menu_item(sl->gv, "Jump to code", menu_callback, sl, NULL, 0);			
			}
		}
	}

	return form_is_new;
}