bool idaapi show_citem_custom_view(void *ud, qstring ctree_item, qstring item_name)
{
	HWND hwnd = NULL;
	qstring form_name = "Ctree Item View: ";
	form_name.append(item_name);
	TForm *form = create_tform(form_name.c_str(), &hwnd);
	func_ctree_info_t *si = new func_ctree_info_t(form);

	istringstream s_citem_str(ctree_item.c_str());
	string tmp_str;
	while (getline(s_citem_str, tmp_str, ';'))
	{
		qstring tmp_qstr = tmp_str.c_str();
		si->sv.push_back(simpleline_t(tmp_qstr));
	}

	simpleline_place_t s1;
	simpleline_place_t s2(ctree_item.size());
	si->cv = create_custom_viewer("Ctree Item View: ", NULL, &s1, &s2, &s1, 0, &si->sv);
	si->codeview = create_code_viewer(form, si->cv, CDVF_NOLINES);
	set_custom_viewer_handlers(si->cv, NULL, NULL, NULL, NULL, NULL, NULL, si);
	open_tform(form, FORM_ONTOP | FORM_RESTORE);

	return false;
}
static bool idaapi show_vtbl_xrefs_window_cb(void *ud)
{
	get_xrefs_to_vtbl();
	if (!xref_list.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform(vtbl_t_list[current_line_pos].vtbl_name.c_str(), &hwnd);

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator xref_iter;
		for (xref_iter = xref_list.begin(); xref_iter != xref_list.end(); xref_iter++)
			si->sv.push_back(simpleline_t(*xref_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, NULL, NULL, ct_vtbl_xrefs_window_click, NULL, NULL, si);
		open_tform(form, FORM_ONTOP | FORM_RESTORE);

		return true;
	}

	warning("ObjectExplorer not found any xrefs here ...");

	return false;
}
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_rtti_window_cb(void *ud)
{
	if (!rtti_list.empty() && !rtti_addr.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform("RTTI Objects List", &hwnd);

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator rtti_iter;
		for (rtti_iter = rtti_list.begin(); rtti_iter != rtti_list.end(); rtti_iter++)
			si->sv.push_back(simpleline_t(*rtti_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, NULL, NULL, ct_rtti_window_click, NULL, NULL, si);
		open_tform(form, FORM_ONTOP | FORM_RESTORE);

		return true;
	}

	warning("ObjectExplorer not found any RTTI objects ...");

	return false;
}
Example #5
0
void createCollabStatus() {
	HWND hwnd = NULL;
	TForm *form = create_tform("CollabREate", &hwnd);
	if (hwnd != NULL) {
		//hook_to_notification_point(HT_UI, ui_collab, form);
		open_tform(form, FORM_MDI | FORM_TAB | FORM_MENU | FORM_RESTORE | FORM_QWIDGET);
	}
	else {
		close_tform(form, FORM_SAVE);
	}
}
Example #6
0
//--------------------------------------------------------------------------
void idaapi run(int /*arg*/)
{
  HWND hwnd = NULL;
  TForm *form = create_tform("Sample graph", &hwnd);
  if ( hwnd != NULL )
  {
    // get a unique graph id
    netnode id;
    id.create("$ ugraph sample");
    graph_viewer_t *gv = create_graph_viewer(form,  id, callback, NULL, 0);
    open_tform(form, FORM_MDI|FORM_TAB|FORM_MENU);
    if ( gv != NULL )
    {
      viewer_fit_window(gv);
      viewer_add_menu_item(gv, "User function", menu_callback, gv, NULL, 0);
    }
  }
  else
  {
    close_tform(form, 0);
  }
}
// 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;
}
Example #8
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;
}
Example #9
0
//--------------------------------------------------------------------------
void idaapi run(int arg)
{
  if ( arg == -1 )
  {
    load_options();
    show_options();
    return;
  }

  func_t *pfn = get_func(get_screen_ea());
  if ( pfn == NULL )
  {
    warning("Please position the cursor in a function first!");
    return;
  }
  load_options();
  qstring title;
  graph_info_t::get_title(pfn->startEA, &title);

  HWND hwnd = NULL;
  TForm *form = create_tform(title.c_str(), &hwnd);
  if ( hwnd != NULL )
  {
    // window is new, but instance is in the list?
    graph_info_t *gi = graph_info_t::find(title.c_str());
    if ( gi != NULL )
    {
      // in that case let us "recycle" the instance
      gi->func_ea = pfn->startEA;
    }
    else
    {
      // we create a new instance
      gi = graph_info_t::create(pfn->startEA);
    }

    if ( gi != NULL )
    {
      // get a unique graph id
      netnode id;
      id.create();

      gi->mark_for_refresh();
      gi->form = form;
      gi->gv = create_graph_viewer(form, id, gr_callback, gi, 0);
      open_tform(form, FORM_MDI|FORM_TAB|FORM_MENU);
      if ( gi->gv != NULL )
      {
        viewer_fit_window(gi->gv);
        viewer_add_menu_item(gi->gv, "Options", menu_options_cb, gi, "O", 0);
        viewer_add_menu_item(gi->gv, "Goto to first node", menu_home_cb, gi, "H", 0);
        viewer_add_menu_item(gi->gv, "Refresh", menu_refresh_cb, gi, "R", 0);
        viewer_add_menu_item(gi->gv, "Search first", menu_searchfirst_cb, gi, "S", 0);
        viewer_add_menu_item(gi->gv, "Search next", menu_searchnext_cb, gi, "N", 0);
      }
      else
      {
        graph_info_t::destroy(gi);
        gi = NULL;
      }
    }
    // failed to creat a graph view?
    if ( gi == NULL )
    {
      warning("Failed to create call graph window!\n");
      return;
    }
  }
  else
  {
    graph_info_t *gi = graph_info_t::find(title.c_str());
    if ( gi != NULL )
    {
      gi->refresh();
      open_tform(gi->form, FORM_MDI|FORM_TAB|FORM_MENU);
    }
  }
}
Example #10
0
QWidget *IdaFrontend::createWidget(const QString &caption) {
    HWND hwnd;
    TForm *form = create_tform(caption.toLocal8Bit().constData(), &hwnd);
    open_tform(form, FORM_MDI | FORM_TAB | FORM_MENU | FORM_QWIDGET);
    return reinterpret_cast<QWidget *>(form);
}