BOOL PContainer::setupItems()
{
 PMINIRECORDCORE  prec;
 RECORDINSERT     ri;

 if (!getProcesses())         // OProcStat::getProcesses()
   OThrowPM("OProcStat::getProcesses() failed", 0, OException::unrecoverable);


 if ((prec = allocRecords(1)) == NULL)
   return(FALSE);

 prec->cb = sizeof(MINIRECORDCORE);
 prec->flRecordAttr = CRA_EXPANDED;
 prec->pszIcon = "OS2KRNL";
 prec->hptrIcon = hptr;

 memset(&ri, 0, sizeof(RECORDINSERT));
 ri.cb                = sizeof(RECORDINSERT);
 ri.pRecordOrder      = (PRECORDCORE) CMA_END;
 ri.pRecordParent     = (PRECORDCORE) NULL;
 ri.zOrder            = (USHORT) CMA_TOP;
 ri.cRecordsInsert    = 1;
 ri.fInvalidateRecord = FALSE;

 // insert them in one shot
 insertRecord(prec, &ri);

 return((insertChilds(prec, 0)) &&   // insert childs of kernel
        (insertChilds(prec, 1)) &&
        (setCnrInfo(CMA_LINESPACING | CMA_CXTREEINDENT)) &&
        (invalidateRecord()));
}
示例#2
0
STDMETHODIMP GuestSessionWrap::COMGETTER(Processes)(ComSafeArrayOut(IGuestProcess *, aProcesses))
{
    LogRelFlow(("{%p} %s: enter aProcesses=%p\n", this, "GuestSession::getProcesses", aProcesses));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aProcesses);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getProcesses(ArrayComTypeOutConverter<IGuestProcess>(ComSafeArrayOutArg(aProcesses)).array());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aProcesses=%zu hrc=%Rhrc\n", this, "GuestSession::getProcesses", ComSafeArraySize(*aProcesses), hrc));
    return hrc;
}
示例#3
0
// DynamicRunner initializer
// sets up the app image and gets the functions from the app
DynamicRunner::DynamicRunner(int pid, std::vector<ClassProfile>& c) {
	std::vector<BPatch_process*> *getProcesses();

	bpatch = new BPatch();
	// Attach the bpatch to the process given by pid
    appProc = bpatch->processAttach("exe", pid);
    // Get the process image
    appImage = appProc->getImage();
    classes = c;
}
QueryData genOpenSockets(QueryContext &context) {
  QueryData results;
  struct kinfo_proc* procs = nullptr;
  struct procstat* pstat = nullptr;

  auto cnt = getProcesses(context, &pstat, &procs);

  for (size_t i = 0; i < cnt; i++) {
    genSockets(pstat, &procs[i], results);
  }

  procstatCleanup(pstat, procs);

  return results;
}