コード例 #1
0
ファイル: choosers.cpp プロジェクト: caznova/hexrays_tools
void idaapi function_list::get_line(void *obj,uint32 n,char * const *arrptr)
{
  if ( n == 0 ) // generate the column headers
  {
    for ( int i=0; i < qnumber(header); i++ )
      qstrncpy(arrptr[i], header[i], MAXSTR);
    return;
  }
  function_list & ms = *(function_list*)obj;

  ea_t ea = ms.functions[n-1];
  qsnprintf(arrptr[0], MAXSTR, "%08a", ea);
  get_func_name(ea, arrptr[1], MAXSTR);
  //get_short_name(BADADDR, ea, arrptr[1], MAXSTR);
  //get_demangled_name(BADADDR, ea,  arrptr[1], MAXSTR, inf.long_demnames, DEMNAM_NAME, 0);
  func_t * f = get_func(ea);
  if(f)
  {
	  const char * cmt = get_func_cmt(f, true);
	  if(cmt)
	  {
		  qstrncpy(arrptr[2], cmt, MAXSTR);		
	  }
	
  }

}
コード例 #2
0
ファイル: csyncthread.cpp プロジェクト: valarauco/galletica
int CSyncThread::getauth(const char *prompt,
                         char *buf,
                         size_t len,
                         int echo,
                         int verify,
                         void *userdata
                         )
{
    int re = 0;

    QString qPrompt = QString::fromLocal8Bit( prompt ).trimmed();
    _mutex.lock();

    if( qPrompt == QLatin1String("Enter your username:"******"OOO Username requested!";
        qstrncpy( buf, _user.toUtf8().constData(), len );
    } else if( qPrompt == QLatin1String("Enter your password:"******"OOO Password requested!";
        qstrncpy( buf, _passwd.toUtf8().constData(), len );
    } else {
        if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
            // SSL is requested. If the program came here, the SSL check was done by mirall
            // the answer is simply yes here.
            qstrcpy( buf, "yes" );
        } else {
            qDebug() << "Unknown prompt: <" << prompt << ">";
            re = -1;
        }
    }
    _mutex.unlock();
    return re;
}
コード例 #3
0
ファイル: choosers.cpp プロジェクト: caznova/hexrays_tools
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);		
	}	
}
コード例 #4
0
ファイル: findMalloc.cpp プロジェクト: melbcat/findMalloc
	TFuncMallocWrapper(char* f_name, char* _ancestor, int m_size_count )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		qstrncpy(ancestor,_ancestor,MAXSTR);
		push_malloc_size_count =m_size_count;
		address= BADADDR;
		type = STANDART;
	}
コード例 #5
0
ファイル: findMalloc.cpp プロジェクト: melbcat/findMalloc
	TFuncMallocWrapper(char* f_name, char* _ancestor, int m_size_count, ea_t _addr, int _type )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		qstrncpy(ancestor,_ancestor,MAXSTR);
		push_malloc_size_count =m_size_count;
		address = _addr;
		type = _type;
	}
コード例 #6
0
bool KMobileGnokii::setGnokiiStateMachine()
{
  // set the state machine to our configuration
  qstrncpy( state.config.model, m_modelnr.utf8(), sizeof(state.config.model)-1 );
  qstrncpy( state.config.port_device, m_port.utf8(), sizeof(state.config.port_device)-1 );
  state.config.connection_type = connectionToValue(m_connection);
  state.config.serial_baudrate = m_baud.toUInt();
  return true;
}
コード例 #7
0
/* Helper function to create a menu item */
static struct PluginMenuItem* createMenuItem(enum PluginMenuType type, int id, const char* text, const char* icon)
{
    struct PluginMenuItem* menuItem = (struct PluginMenuItem*)malloc(sizeof(struct PluginMenuItem));
    menuItem->type = type;
    menuItem->id = id;
    qstrncpy(menuItem->text, text, PLUGIN_MENU_BUFSZ);
    qstrncpy(menuItem->icon, icon, PLUGIN_MENU_BUFSZ);
    return menuItem;
}
コード例 #8
0
int ownCloudFolder::getauth(const char *prompt,
                         char *buf,
                         size_t len,
                         int echo,
                         int verify,
                         void *userdata
                         )
{
    int re = 0;
    QMutex mutex;

    QString qPrompt = QString::fromLatin1( prompt ).trimmed();
    QString user = CredentialStore::instance()->user();
    QString pwd  = CredentialStore::instance()->password();

    if( qPrompt == QLatin1String("Enter your username:"******"OOO Username requested!";
        QMutexLocker locker( &mutex );
        qstrncpy( buf, user.toUtf8().constData(), len );
    } else if( qPrompt == QLatin1String("Enter your password:"******"OOO Password requested!";
        qstrncpy( buf, pwd.toUtf8().constData(), len );
    } else {
        if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
            // SSL is requested. If the program came here, the SSL check was done by mirall
            // It needs to be checked if the  chain is still equal to the one which
            // was verified by the user.
            QRegExp regexp("fingerprint: ([\\w\\d:]+)");
            bool certOk = false;

            int pos = 0;

            // This is the set of certificates which QNAM accepted, so we should accept
            // them as well
            QList<QSslCertificate> certs = ownCloudInfo::instance()->certificateChain();

            while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) {
                QString neon_fingerprint = regexp.cap(1);

                foreach( const QSslCertificate& c, certs ) {
                    QString verified_shasum = Utility::formatFingerprint(c.digest(QCryptographicHash::Sha1).toHex());
                    qDebug() << "SSL Fingerprint from neon: " << neon_fingerprint << " compared to verified: " << verified_shasum;
                    if( verified_shasum == neon_fingerprint ) {
                        certOk = true;
                        break;
                    }
                }
            }
            // certOk = false;     DEBUG setting, keep disabled!
            if( !certOk ) { // Problem!
                qstrcpy( buf, "no" );
                re = -1;
            } else {
                qstrcpy( buf, "yes" ); // Certificate is fine!
            }
        } else {
コード例 #9
0
//---------------------------------------------------------------------------
static void idaapi ch_getl(void *obj, uint32 n, char *const *arrptr)
{
  x86seh_ctx_t *ctx = (x86seh_ctx_t *)obj;
  if ( n == 0 )
  {
    qstrncpy(arrptr[0], x86seh_chooser_cols[0], MAXSTR);
    qstrncpy(arrptr[1], x86seh_chooser_cols[1], MAXSTR);
    return;
  }
  uint32 addr = ctx->handlers[n-1];
  qsnprintf(arrptr[0], MAXSTR, "%08X", addr);
  get_nice_colored_name(addr, arrptr[1], MAXSTR, GNCN_NOCOLOR | GNCN_NOLABEL);
}
コード例 #10
0
ファイル: py_choose2.hpp プロジェクト: Hehouhua/idapython
  bool split_chooser_caption(qstring *out_title, qstring *out_caption, const char *caption) const
  {
    if ( get_embedded() != NULL )
    {
      // For embedded chooser, the "caption" will be overloaded to encode
      // the AskUsingForm's title, caption and embedded chooser id
      // Title:EmbeddedChooserID:Caption

      char title_buf[MAXSTR];
      const char *ptitle;

      static const char delimiter[] = ":";
      char temp[MAXSTR];
      qstrncpy(temp, caption, sizeof(temp));

      char *ctx;
      char *p = qstrtok(temp, delimiter, &ctx);
      if ( p == NULL )
        return false;

      // Copy the title
      char title_str[MAXSTR];
      qstrncpy(title_str, p, sizeof(title_str));

      // Copy the echooser ID
      p = qstrtok(NULL, delimiter, &ctx);
      if ( p == NULL )
        return false;

      char id_str[10];
      qstrncpy(id_str, p, sizeof(id_str));

      // Form the new title of the form: "AskUsingFormTitle:EchooserId"
      qsnprintf(title_buf, sizeof(title_buf), "%s:%s", title_str, id_str);

      // Adjust the title
      *out_title = title_buf;

      // Adjust the caption
      p = qstrtok(NULL, delimiter, &ctx);
      *out_caption = caption + (p - temp);
    }
    else
    {
      *out_title = title;
      *out_caption = caption;
    }
    return true;
  }
コード例 #11
0
ファイル: reg.cpp プロジェクト: nealey/vera
inline static bool idaapi choose_device(TView *[] = NULL, int = 0)
{
    bool ok = choose_ioport_device(cfgname, device, sizeof(device), NULL);
    if ( !ok )
        qstrncpy(device, NONEPROC, sizeof(device));
    return ok;
}
コード例 #12
0
ファイル: snes_spc.cpp プロジェクト: gocha/ida-snes_spc-ldr
//----------------------------------------------------------------------------
int idaapi accept_file(
        linput_t *li,
        char fileformatname[MAX_FILE_FORMAT_NAME],
        int n)
{
  if ( n > 0 )
    return 0;

  int32 spc_file_size = qlsize(li);
  if ( spc_file_size < 0x10200 )
    return 0;

  spc_file_t spc_info;
  if ( qlseek(li, 0) != 0 )
    return 0;
  if ( qlread(li, &spc_info, sizeof(spc_file_t)) != sizeof(spc_file_t) )
    return 0;

  if (memcmp(spc_info.signature, "SNES-SPC700 Sound File Data", 27) != 0
    || spc_info.signature[0x21] != 0x1a || spc_info.signature[0x22] != 0x1a)
    return 0;

  qstrncpy(fileformatname, "SNES-SPC700 Sound File Data", MAX_FILE_FORMAT_NAME);
  return 1;
}
コード例 #13
0
ファイル: mas.cpp プロジェクト: trietptm/usefulres
//-----------------------------------------------------------------------------
// load a macro assembler file in IDA.
void load_file(linput_t *li, ushort /*neflag*/, const char * /*fileformatname*/) {
    // already read the 2 first bytes
    qlseek(li, 2);

    // initialize static variables
    qstrncpy(creator, "UNKNOWN", sizeof(creator));
    entry_point = -1;

    bool finished = false;

    while (!finished) {
        uchar record_type = 0;

        // read the record type
        if (qlread(li, &record_type, 1) != 1)
            mas_error("unable to read the record type");

        finished = process_record(li, record_type, true);
    }

#if defined(DEBUG)
    msg("MAS: reading complete\n");
#endif

    mas_write_comments();
}
コード例 #14
0
ファイル: nes.cpp プロジェクト: IDA-RE-things/nesldr
//----------------------------------------------------------------------
//
//      check input file format. if recognized, then return 1
//      and fill 'fileformatname'.
//      otherwise return 0
//
int accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
	if( n!= 0 )
		return 0;

	// quit if file is smaller than size of iNes header
	if (qlsize(li) < sizeof(ines_hdr))
		return 0;

	// set filepos to offset 0
	qlseek(li, 0, SEEK_SET);

	// read NES header
	if(qlread(li, &hdr, INES_HDR_SIZE) != INES_HDR_SIZE)
		return 0;

	// is it a valid ROM image in iNes format?
	if( memcmp("NES", &hdr.id, sizeof(hdr.id)) != 0 || hdr.term != 0x1A )
		return 0;

	// this is the name of the file format which will be
	// displayed in IDA's dialog
	qstrncpy(fileformatname, "Nintendo Entertainment System ROM", MAX_FILE_FORMAT_NAME);

	// set processor to 6502
	if ( ph.id != PLFM_6502 )
	{
		msg("Nintendo Entertainment System ROM detected: setting processor type to M6502.\n");
		set_processor_type("M6502", SETPROC_ALL|SETPROC_FATAL);
	}


	return (1 | ACCEPT_FIRST);
}
コード例 #15
0
ファイル: module.cpp プロジェクト: bureg/amg-codec-tool
Module::Module(const char * _moduleName)
{
    size_t length = strlen(_moduleName) + 1;
    qstrncpy(moduleName,
             _moduleName,
             (length > MAX_MODULE_NAME_LENGTH) ? (MAX_MODULE_NAME_LENGTH) : (length));
}
コード例 #16
0
//---------------------------------------------------------------------------
uchar putVal(const op_t &x, uchar mode, uchar warn)
{
  char *ptr = get_output_ptr();
  {
    flags_t sv_uFlag = uFlag;
    uFlag = 0;
    OutValue(x, mode);
    uFlag = sv_uFlag;
  }

  char str[MAXSTR];
  char *end = set_output_ptr(ptr);
  size_t len = end - ptr;
  qstrncpy(str, ptr, qmin(len+1, sizeof(str)));

  if ( warn )
    out_tagon(COLOR_ERROR);

  if ( warn )
    len = tag_remove(str, str, 0);
  else
    len = tag_strlen(str);

  if ( chkOutLine(str, len) )
    return 0;

  if ( warn )
    out_tagoff(COLOR_ERROR);
  return 1;
}
コード例 #17
0
QFileSystemEntry QFileSystemEngine::currentPath()
{
    QFileSystemEntry result;
    QT_STATBUF st;
    if (QT_STAT(".", &st) == 0) {
#if defined(__GLIBC__) && !defined(PATH_MAX)
        char *currentName = ::get_current_dir_name();
        if (currentName) {
            result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
            ::free(currentName);
        }
#else
        char currentName[PATH_MAX+1];
        if (::getcwd(currentName, PATH_MAX)) {
#if defined(Q_OS_VXWORKS) && defined(VXWORKS_VXSIM)
            QByteArray dir(currentName);
            if (dir.indexOf(':') < dir.indexOf('/'))
                dir.remove(0, dir.indexOf(':')+1);

            qstrncpy(currentName, dir.constData(), PATH_MAX);
#endif
            result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
        }
# if defined(QT_DEBUG)
        if (result.isEmpty())
            qWarning("QFileSystemEngine::currentPath: getcwd() failed");
# endif
#endif
    } else {
# if defined(QT_DEBUG)
        qWarning("QFileSystemEngine::currentPath: stat(\".\") failed");
# endif
    }
    return result;
}
コード例 #18
0
ファイル: hex.cpp プロジェクト: Artorios/IDAplugins-1
//--------------------------------------------------------------------------
int idaapi accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
  char str[80];

  if ( n) return(0 );

  qlgets(str, sizeof(str), li);

  const char *p = str;
  while ( *p == ' ' ) p++;
  int  type = 0;
  if ( qisxdigit((uchar)*(p+1)) && qisxdigit((uchar)*(p+2))) switch(*p ) {
    case ':':
      p = "Intel Hex Object Format";
      type = f_HEX;
      break;

    case ';':
      p = "MOS Technology Hex Object Format";
      type = f_MEX;
      break;

    case 'S':
      p = "Intel S-record Format";
      type = f_SREC;
    default:
      break;

  }
  if ( type) qstrncpy(fileformatname, p, MAX_FILE_FORMAT_NAME );
  return(type);
}
コード例 #19
0
ファイル: readcfg++.cpp プロジェクト: serghei/kde3-kdenetwork
int read_user_config(const char * key, char * result, int max)
{
    KConfig * cfg;
    if (!strncmp(key,"Sound",5))
        // Any key starting with Sound is in ktalkannouncerc
        // talkprg is there too, but we don't care about it here
        cfg = ktkanncfg;
    else
        cfg = ktalkdcfg;

    if (!cfg) return 0; // file doesn't exist
    QString Qresult;
    if ((Qresult = cfg -> readEntry(key, "unset")) != "unset")
    {
        qstrncpy( result, Qresult.ascii(), max);

        if (Options.debug_mode) syslog(LOG_DEBUG,"User option %s : %s", key, result);
        return 1;
    }
    else 
    {
        ktalk_debug("User option %s NOT found", key);
        return 0;
    }
}
コード例 #20
0
ファイル: teloader.cpp プロジェクト: Yukariin/TELoader
/* verify if we can process the target file
 * return true if yes
 * false otherwise
 */
int idaapi
accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
    if (n != 0)
    {
        return 0;
    }
    qlseek(li, 0);
    EFI_IMAGE_TE_HEADER teHeader = {0};
    if (qlread(li, &teHeader, sizeof(EFI_IMAGE_TE_HEADER)) == sizeof(EFI_IMAGE_TE_HEADER) &&
        teHeader.Signature == EFI_IMAGE_TE_SIGNATURE)
    {
        msg("Signature: 0x%hx\n", teHeader.Signature);
        msg("Machine: 0x%hx\n", teHeader.Machine);
        msg("Number of Sections: 0x%hhx\n", teHeader.NumberOfSections);
        msg("Subsystem: 0x%hhx\n", teHeader.Subsystem);
        msg("Stripped size: 0x%hx\n", teHeader.StrippedSize);
        msg("Address of EntryPoint: 0x%0x\n", teHeader.AddressOfEntryPoint);
        msg("Base of code: 0x%x\n", teHeader.BaseOfCode);
        msg("Image base: 0x%llx\n", teHeader.ImageBase);
        qstrncpy(fileformatname, "TE put.as Loader", MAX_FILE_FORMAT_NAME);
        return true;
    }
    return 0;
}
コード例 #21
0
ファイル: Request.cpp プロジェクト: gateslu/renrentest
Result Request::syncRequest(const std::string &url, Method method,
							const RequestParam &params, Response *response)
{
	if(!response)
		return RESULT_NULL_POINTER;

	CURLcode res = ::curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str());
	if(url.npos != url.find("https"))
	{
		// https
		::curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYPEER, 0L);
		::curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYHOST, 0L);
	}

	::curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, Request::_receive);
	::curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, response);
	//curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1L);
	//curl_easy_setopt(m_curl, CURLOPT_HEADER, 1L);
	::curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1L);

	if(method == Post)
	{
		char paramStr[1024];
//		::strncpy_s(paramStr, 1024, params.toString().c_str(), params.toString().length());
        qstrncpy(paramStr, params.toString().c_str(), params.toString().length()+1);
//        qDebug() << QString(paramStr);
		::curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, paramStr);
		::curl_easy_setopt(m_curl, CURLOPT_POST, 1L);
	}

	res = ::curl_easy_perform(m_curl);

	return RESULT_OK;
}
コード例 #22
0
ファイル: findMalloc.cpp プロジェクト: melbcat/findMalloc
	TFuncMalloc(char* f_name,int m_size_count, ea_t _addr, int _type )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		push_malloc_size_count =m_size_count;
		address = _addr;
		type = _type;
	}
コード例 #23
0
 int formatResult(char * buffer, int bufferSize, T number, int significantDigits)
 {
     QString result = formatResult(number, significantDigits);
     qstrncpy(buffer, result.toAscii().constData(), bufferSize);
     int size = result.count();
     return size;
 }
コード例 #24
0
ファイル: findMalloc.cpp プロジェクト: melbcat/findMalloc
	TFuncMalloc(char* f_name,int m_size_count )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		push_malloc_size_count =m_size_count;
		address= BADADDR;
		type = STANDART;
	}
コード例 #25
0
ファイル: qstring.c プロジェクト: Zengwn/qhttpd
/**
 * Copy src string to dst. The dst string arrary will be always terminated by
 * NULL character.
 *
 * @param dst       a pointer of the string to be copied
 * @param size      the size of dst character arrary
 * @param src       a pointer of source string
 *
 * @return always returns a pointer of dst
 */
char *qstrcpy(char *dst, size_t size, const char *src)
{
    if (dst == NULL || size == 0 || src == NULL) return dst;

    size_t nbytes = strlen(src);
    return qstrncpy(dst, size, src, nbytes);
}
コード例 #26
0
ファイル: out.cpp プロジェクト: nealey/vera
// Output an instruction
void out(void) {

    //
    // print insn mnemonic
    //

    char buf[MAXSTR];
    init_output_buffer(buf, sizeof(buf));

    char postfix[5];
    postfix[0] = '\0';

    if ( is_jmp_cc(cmd.itype) )
        qstrncpy(postfix, ConditionCodes[cmd.auxpref], sizeof(postfix));

    OutMnem(8, postfix);

    //
    // print insn operands
    //

    out_one_operand(0);        // output the first operand

    if ( cmd.Op2.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(1);
    }

    if ( cmd.Op3.type != o_void ) {
        out_symbol(',');
        OutChar(' ');
        out_one_operand(2);
    }

    // output a character representation of the immediate values
    // embedded in the instruction as comments
    if ( isVoid(cmd.ea,uFlag,0)) OutImmChar(cmd.Op1 );
    if ( isVoid(cmd.ea,uFlag,1)) OutImmChar(cmd.Op2 );
    if ( isVoid(cmd.ea,uFlag,2)) OutImmChar(cmd.Op3 );

    if ( gr_cmt != NULL ) {
        OutChar(' ');
        out_line(ash.cmnt, COLOR_AUTOCMT);
        OutChar(' ');
        out_line(gr_cmt, COLOR_AUTOCMT);
        if ( ash.cmnt2 != NULL ) {
            OutChar(' ');
            out_line(ash.cmnt2, COLOR_AUTOCMT);
        }
        gr_cmt = NULL;
    }

    term_output_buffer();                   // terminate the output string
    gl_comm = 1;                            // ask to attach a possible user-
                                            // defined comment to it
    MakeLine(buf);                          // pass the generated line to the
                                            // kernel
}
コード例 #27
0
//--------------------------------------------------------------------------
int idaapi macbase_debmod_t::get_process_list(procvec_t *list)
{
  list->clear();
  int mypid = getpid();
  int sysControl[4];
  sysControl[0] = CTL_KERN;
  sysControl[1] = KERN_PROC;
  sysControl[2] = KERN_PROC_ALL;

  qvector<struct kinfo_proc> info;
  size_t length;
  int count = 0;
  int rc = -1;
  for ( int tries=0; rc != 0 && tries < 5; ++tries )
  {
    // the first call of sysctl() is used to determine the size of the buffer
    // will be passed to the second call
    length = 0;
    sysctl(sysControl, 3, NULL, &length, NULL, 0);

    // If the number of processes is greater than the size of the buffer
    // sysctl() supplies as much data as fits in the buffer and returns ENOMEM.
    // We reserve 100 extra elements for processes started after 1st sysctl
    // In case even this number is not sufficient we turn to the next attempt
    count = (length / sizeof (info[0])) + 100;
    if ( count <= 0 )
      return 0;
    if ( info.size() < count )
      info.resize(count);
    length = sizeof(info[0]) * info.size();
    rc = sysctl(sysControl, 3, info.begin(), &length, NULL, 0);
    if ( rc != 0 && errno != ENOMEM )
      return 0;
  }

  count = (length / sizeof (info[0])); // exact number of processes
  for ( int i=0; i < count; i++ )
  {
    extern_proc &ep = info[i].kp_proc;
    pid_t _pid = ep.p_pid;
    if ( _pid == mypid )
      continue;
    mach_port_t port;
    kern_return_t result = task_for_pid(mach_task_self(), _pid,  &port);
    if ( result == KERN_SUCCESS )
    {
      ext_process_info_t &pi = list->push_back();
      qstrncpy(pi.name, ep.p_comm, sizeof(pi.name));
      pi.pid = _pid;
      pi.addrsize = get_process_bitness(_pid);
      build_process_ext_name(&pi);
    }
    else
    {
      debdeb("%d: %s is unavailable for debugging\n", _pid, info[i].kp_proc.p_comm);
    }
  }
  return list->size();
}
コード例 #28
0
ファイル: common.cpp プロジェクト: Artorios/IDAplugins-1
//--------------------------------------------------------------------------
static char *token2str(char *buf, size_t bufsize, GEOStoken &t)
{
  if ( t.str[0] )
    qsnprintf(buf, bufsize, "%4.4s/%u", t.str, t.num);
  else
    qstrncpy(buf, "-", bufsize);
  return buf;
}
コード例 #29
0
static QString U32_2_String(uint32_t fourcc)
{
  char *fcc = (char *)&(fourcc);
  char fcc1[5];
  qstrncpy(fcc1, fcc, 5);
  fcc1[4] = '\0';
  return QString(QString::fromUtf8(fcc1));
}
コード例 #30
0
ファイル: callgraph.cpp プロジェクト: nealey/vera
//--------------------------------------------------------------------------
int callgraph_t::find_first(const char *text)
{
  if ( text == NULL || text[0] == '\0' )
    return -1;
  qstrncpy(cur_text, text, sizeof(cur_text));
  cur_node = 0;
  return find_next();
}