示例#1
0
void idaapi matched_structs_with_offsets::get_type_line(void *obj,uint32 n,char * const *arrptr)
{
	matched_structs_with_offsets & ms = *(matched_structs_with_offsets*)obj;
	if (n==0)
	{
		qstrncpy(arrptr[0], "member", MAXSTR);
		qstrncpy(arrptr[1], "type", MAXSTR);		
	}
	else
	{
		char name[MAXSTR];
		name[0]=0;

		char type_str[MAXSTR];
		type_str[0]=0;

		tid_t id = ms.idcka[n-1];
		struc_t * struc = get_struc(id);
		print_struct_member_name(struc, ms.offset, name, sizeof(name));
		member_t * member = 0;
		if(struct_get_member(get_struc(id), ms.offset, &member) && member)
		{
			//typestring type;
			tinfo_t type;
			if(get_member_type(member, &type))
			{
				type.print(new qstring(type_str));
			}
		}
		qstpncpy(arrptr[0],  name, MAXSTR);
		qstpncpy(arrptr[1],  type_str, MAXSTR);		
	}	
}
示例#2
0
static int idaapi selectManufacturer ( int * pManufacturer )
{
  char dialog_form[MAXSTR * 8];
  char * dest = dialog_form;

  // where number is a number of input field the cursor will stand on (0 based)
  dest = qstpncpy ( dest, strStartItem, sizeof ( strStartItem ) );

  // Help
  dest = qstpncpy ( dest, strHelp, sizeof ( strHelp ) );
  dest = qstpncpy ( dest, strManufacturerHelp,
                    sizeof ( strManufacturerHelp ) );
  dest = qstpncpy ( dest, strEndHelp, sizeof ( strEndHelp ) );

  // Title : Next there must be the title line and 2 empty lines
  dest = qstpncpy ( dest, strManufacturerTitle,
                    sizeof ( strManufacturerTitle ) );

  // All text in the dialog box text string is copied to the dialog
  // without any modifications
  // dest = qstpncpy ( dest, strSelectText, sizeof ( strSelectText ) );

  // All input field types (except B and K) are valid format specifiers
  // Input fields are represented by the following combination
  //
  // < # hint_message # label : type : width : swidth : @hlp[] >
  //
  for ( int i = 0; i < DEVICE_MANF_COUNT; i++ )
  {
    dest = qstpncpy ( dest, "<", 2 );
    dest = qstpncpy ( dest, &manufacturers[i][0], sizeof ( manufacturers[i] ) );
    dest = qstpncpy ( dest, ":R", 3 );

    if ( i == DEVICE_MANF_COUNT - 1 )
      dest = qstpncpy ( dest, ">", 2 );

    dest = qstpncpy ( dest, ">\n", 3 );
  }

  return AskUsingForm_c ( dialog_form, pManufacturer );
}
示例#3
0
char * idaapi matched_structs::get_type_line(void *obj, uint32 n, char *buf)
{
	matched_structs & ms = *(matched_structs*)obj;
	if (n==0)
		qstpncpy( buf, "type", MAXSTR );
	else
	{
		qstring name;
;
		tid_t id =  ms.idcka[n-1];
		struc_t * struc = get_struc(id);
		if (struc)
			get_struc_name(&name, id);
		//asize_t size = get_struc_size(id);
		qsnprintf(buf, MAXSTR, "%s", name.c_str());
	}
	return buf;
}
示例#4
0
文件: choose2.cpp 项目: nealey/vera
//--------------------------------------------------------------------------
//
//      The plugin method
//
//      This is the main function of plugin.
//
void idaapi run(int /*arg*/)
{
  char title[MAXSTR];
  // Let's display the functions called from the current one
  // or from the selected area

  // First we determine the working area

  func_item_iterator_t fii;
  bool ok;
  ea_t ea1, ea2;
  if ( callui(ui_readsel, &ea1, &ea2).cnd )    // the selection is present?
  {
    callui(ui_unmarksel);                      // unmark selection
    qsnprintf(title, sizeof(title), "Functions called from %08a..%08a", ea1, ea2);
    ok = fii.set_range(ea1, ea2);
  }
  else                                         // nothing is selected
  {
    func_t *pfn = get_func(get_screen_ea());   // try the current function
    if ( pfn == NULL )
    {
      warning("Please position the cursor on a function or select an area");
      return;
    }
    ok = fii.set(pfn);
    static const char str[] = "Functions called from ";
    char *ptr = qstpncpy(title, str, sizeof(title));
    get_func_name(pfn->startEA, ptr, sizeof(title)-(ptr-title));
  }

  // We are going to remember the call instruction addresses
  // in a netnode
  // altval(i) will contain the address of the call instruction

  netnode *node = new netnode;
  node->create();
  int counter = 0;
  while ( ok )
  {
    ea_t ea = fii.current();
    if ( is_call_insn(ea) )       // a call instruction is found
      node->altset(counter++, ea);//get_first_fcref_from(ea));
    ok = fii.next_code();
  }

  // altval(-1) will contain the number of pairs
  node->altset(-1, counter);

  // now open the window
  choose2(0,                    // non-modal window
          -1, -1, -1, -1,       // position is determined by the OS
          node,                 // pass the created netnode to the window
          qnumber(header),      // number of columns
          widths,               // widths of columns
          sizer,                // function that returns number of lines
          desc,                 // function that generates a line
          title,                // window title
          -1,                   // use the default icon for the window
          0,                    // position the cursor on the first line
          NULL,                 // "kill" callback
          NULL,                 // "new" callback
          NULL,                 // "update" callback
          NULL,                 // "edit" callback
          enter_cb,             // function to call when the user pressed Enter
          destroy_cb,           // function to call when the window is closed
          NULL,                 // use default popup menu items
          NULL);                // use the same icon for all lines
}