static bool idaapi decompile_func(vdui_t &vu)
{
	// Determine the ctree item to highlight
	vu.get_current_item(USE_KEYBOARD);
	citem_t *highlight = vu.item.is_citem() ? vu.item.e : NULL;

	if (highlight != NULL)
	{
		// if it is an expression
		if (highlight->is_expr())
		{
			cexpr_t *e = (cexpr_t *)highlight;

			char *citem_name = get_expr_name(highlight);
			char *proc_name = citem_name + strlen(citem_name);

			while ((proc_name > citem_name) && (*(proc_name - 1) != '>'))
				proc_name--;

			if (proc_name != citem_name) {
				func_t * func = get_func_by_name(proc_name);
				if (func != NULL)
				{
					vdui_t * decompiled_window = open_pseudocode(func->startEA, -1);
				}
			}
		}
	}

	return true;
}
static bool idaapi decompile_func(vdui_t &vu)
{
  // Determine the ctree item to highlight
  vu.get_current_item(USE_KEYBOARD);
  citem_t *highlight = vu.item.is_citem() ? vu.item.e : NULL;
  
  if(highlight != NULL)
  {
	  if(highlight->is_expr())
	  //if(highlight->op == cot_call)
	  {
		  cexpr_t *e = (cexpr_t *)highlight;
		  char tmp[512];
		  memset(tmp, 0x00, sizeof(tmp));
		  e->print1(tmp, sizeof(tmp), NULL);
		  tag_remove(tmp, tmp, sizeof(tmp));

		  char *proc_name = tmp + strlen(tmp);


		  while((proc_name > tmp) && (*(proc_name - 1) != '>'))
			  proc_name --;

		  msg("Function %s is choosen\n", proc_name);

		  func_t * func = get_func_by_name(proc_name);
		  if(func != NULL)
		  {
			  vdui_t * decompiled_window = open_pseudocode(func->startEA, -1);
			  /*
			  hexrays_failure_t error;
			  cfuncptr_t decompiled = decompile(func, &error);
			  if(decompiled != NULL)
				switch_to(decompiled);
				*/
		  }
	  }
  }
  
  return true;                          // Success!
}
Пример #3
0
static bool idaapi decompile_func(vdui_t &vu)
{
  // Determine the ctree item to highlight
  vu.get_current_item(USE_KEYBOARD);
  citem_t *highlight = vu.item.is_citem() ? vu.item.e : NULL;
  
  if(highlight != NULL)
  {
	  // if it is an expression
	  if(highlight->is_expr())
	  {
		  cexpr_t *e = (cexpr_t *)highlight;
		  
		  // retrieve the name of the routine
		  char tmp[1024];
		  memset(tmp, 0x00, sizeof(tmp));
		  e->print1(tmp, sizeof(tmp), NULL);
		  tag_remove(tmp, tmp, sizeof(tmp));

		  char *proc_name = tmp + strlen(tmp);

		  while((proc_name > tmp) && (*(proc_name - 1) != '>'))
			  proc_name --;

		  if (proc_name != tmp) {
			  func_t * func = get_func_by_name(proc_name);
			  if(func != NULL)
			  {
				  vdui_t * decompiled_window = open_pseudocode(func->startEA, -1);
			  }
		  }
	  }
  }
  
  return true;                    
}