ida sdk add_struc_member array

  tid_t tid = get_struc_id ( "foo_type" ) ;
  struc_t * sptr = get_struc ( tid );
  
  if ( sptr == NULL )
  {
    tid = add_struc ( BADNODE,    "foo_type" ) ;
    sptr = get_struc ( tid );
    
    if ( sptr == NULL )
      return;
      
    add_struc_member ( sptr, "memb0", 0, dwrdflag(), NULL, 4 );
    add_struc_member ( sptr, "memb4", 4, dwrdflag(), NULL, 4 );
    add_struc_member ( sptr, "membC", 12, dwrdflag(), NULL, 4 );
    tid = get_struc_id ( "bar_type" ) ;
    sptr = get_struc ( tid );
    
    if ( sptr == NULL )
    {
      tid = add_struc ( BADNODE,    "bar_type" ) ;
      sptr = get_struc ( tid );
      
      if ( sptr == NULL )
        return;
        
      typeinfo_t mt;
      mt.tid = get_struc_id ( "foo_type" ) ;
      add_struc_member ( sptr, "memb0", 0, dwrdflag(), NULL, 4 );
      add_struc_member ( sptr, "memb1", 4, struflag(), &mt,
                         get_struc_size ( mt.tid ) * 4 );
      add_struc_member ( sptr, "memb2", -1, dwrdflag(), NULL, 4 );
    }
  }

posted @ 2013-10-21 07:23  IAmAProgrammer  阅读(669)  评论(0编辑  收藏  举报