Esempio n. 1
0
//--------------------------------------------------------------------------
static int idaapi start_process(
  const char *path,
  const char *args,
  const char *startdir,
  uint32 input_file_crc32)
{
  // check that the host application has been specified
  char p2[QMAXPATH];
  dbg_get_input_path(p2, sizeof(p2));
  if (is_dll && strcmp(qbasename(path), qbasename(p2)) == 0)
  {
    warning("AUTOHIDE NONE\n"
            "Please specify the host application first (Debugger, Process options)");
    return 0;
  }
  int flags = is_dll ? DBG_PROC_IS_DLL : 0;
  if ( callui(ui_get_hwnd).vptr != NULL )
    flags |= DBG_PROC_IS_GUI;
  const char *input;
  if ( is_temp_database() )
  {
    input = "";
  }
  else
  {
    // for mini databases the name of the input file won't have the full
    // path. make it full path so that we will use correct path for the input
    // file name.
    if ( is_miniidb() )
    {
      set_root_filename(path);
      input = path;
    }
    else
    {
      input = p2;
    }
  }
  int code;
  while ( true )
  {
    code = s_start_process(path, args, startdir, flags, input, input_file_crc32);
#ifdef REMOTE_DEBUGGER
    if ( code == -2 && debugger.open_file != NULL )
    {
      // if the file is missing on the remote location
      // then propose to copy it
      if ( ask_user_and_copy(p2) )
      {
        dbg_get_input_path(p2, sizeof(p2));
        path = p2;
        startdir = "";
        continue;
      }
    }
#endif
    break;
  }
  return code;
}
//--------------------------------------------------------------------------
inline int get_expected_addrsize(void)
{
  if ( is_miniidb() )
#ifdef __EA64__
    return 8;
#else
    return 4;
#endif
  return inf.is_64bit() ? 8 : 4;
}
Esempio n. 3
0
//--------------------------------------------------------------------------
static int idaapi _attach_process(pid_t process_id, int event_id)
{
  int r = s_attach_process(process_id, event_id);
  // If we attach to a process using one of the debuggers below and succeed then
  // the file is a PE file. We set the file type so other plugins can work properly
  // (since they check the file type)
#if (DEBUGGER_ID == DEBUGGER_ID_X86_IA32_WIN32_USER) || (DEBUGGER_ID == DEBUGGER_ID_ARM_WINCE_USER) || (DEBUGGER_ID == DEBUGGER_ID_WINDBG)
  if ( r == 1 && is_miniidb() && inf.filetype == 0 )
  {
    inf.filetype = f_PE;
  }
#endif
  return r;
}
//--------------------------------------------------------------------------
static bool init_plugin(void)
{
#ifndef RPC_CLIENT
  if (!init_subsystem())
    return false;
#endif
  if ( !netnode::inited() || is_miniidb() || inf.is_snapshot() )
  {
    //dosbox is always remote.
    return debugger.is_remote();
  }

  if ( inf.filetype != f_EXE && inf.filetype != f_COM )
    return false; // only MSDOS EXE or COM files
  if ( ph.id != PLFM_386 )
    return false; // only IBM PC

  return true;
}