abstract_vframe* processOopClass::vframe_at(smi index, void *FH, Process*& p, frame*& last) { p = checkProcess(this); if (!p) { prim_failure(FH, NOPROCESSERROR); return NULL; } if (index < 0 || !p->inSelf()) { prim_failure(FH, BADINDEXERROR); return NULL; } FlushRegisterWindows(); last = p->last_self_frame(false); abstract_vframe* vf = new_vframe(last); if (vf->is_prologue()) vf = vf->sender(); bool hideFirst = p != vmProcess; int32 i = 0; for ( ;; ) { if (i == index) break; vf = vf->sender(); i++; if (!vf) break; } if (!vf || (vf->is_first_self_vframe() && hideFirst)) { prim_failure(FH, BADINDEXERROR); return NULL; } return vf; }
void DWindowUI::SwitchToProcessUI() { QLayoutItem *child; while ((child = actionLayout_->takeAt(0)) != 0) { if (child->widget()) { child->widget()->setVisible(false); } } while ((child = selectLayout_->takeAt(0)) != 0) { if (child->widget()) { child->widget()->setVisible(false); } } QLabel *processHints = new QLabel(tr("<a style='color:#ffffff; font-size:12px'>Please </a>" "<a style='color:#ebab4c; font-size:12px'>DO NOT</a>" "<a style='color:#ffffff; font-size:12px'> remove the USB flash drive or shutdown while file is writing.<a>")); processHints->setFixedWidth(labelMaxWidth); processHints->setWordWrap(true); selectLayout_->addStretch(); selectLayout_->addWidget(processHints); selectLayout_->setAlignment(processHints, Qt::AlignVCenter); usbLabel_->setText("<p style='color:white; font-size:10px;'>0% </p>"); QMovie *processMovie = new QMovie(":/ui/images/process-active.gif"); processLabel_->setMovie(processMovie); processMovie->start(); processTimer_ = new QTimer(this); processTimer_->setInterval(5000); connect(processTimer_, SIGNAL(timeout()), this, SLOT(checkProcess())); processTimer_->start(); isoLabel_->start(); }
PeerguardianInfo::PeerguardianInfo( const QString &logPath, QObject *parent ) : QObject( parent ) { m_DaemonState = false; m_LogPath = logPath; getLoadedIps(); checkProcess(); }
Process* processOopClass::TWAINS_receiver_check(void* FH) { Process* proc = checkProcess(this); if (!proc || !proc->isRunnable()) { prim_failure(FH, NOPROCESSERROR); return NULL; } return proc; }
void antisandbox::startDetect(){ printf("========= Checks for AntiSandbox =======\n"); isCWSandbox(); isAnubis(); checkProcess(); checkFile(); checkRegistry(); findWindows(); }
// debugging primitives smi processOopClass::StackDepth_prim(void *FH) { Process* p = checkProcess(this); if (!p) { prim_failure(FH, NOPROCESSERROR); return NULL; } int32 vdepth = p->stack()->vdepth(); if (p != vmProcess && vdepth > 0) vdepth--; // hide dummy doIt vframe return vdepth; }
oop processOopClass::AbortProcess_prim(void *FH) { Process* proc = checkProcess(this); if (!proc) { prim_failure(FH, NOPROCESSERROR); return NULL; } if (proc == twainsProcess) { prim_failure(FH, PRIMITIVEFAILEDERROR); return NULL; } preserved pres(this); proc->abort(); if (proc->state == defunct) fatal("process already deleted"); delete proc; return pres.value; }
void virtualbox::startDetect(){ printf("========= Checks for VirtualBox =======\n"); printf("Process Checks\n"); checkProcess(); printf("\n"); printf("Registry Checks\n"); checkRegistry(); printf("\n\n"); printf("File Checks\n"); checkFile(); printf("\n\n"); printf("MAC Checks\n"); checkMAC(); printf("\n"); }
oop processOopClass::PrintProcessStack_prim(void *FH) { Process* p = checkProcess(this); if (!p) { prim_failure(FH, NOPROCESSERROR); return NULL; } switch (p->state) { case ready: case stopped: p->stack()->print(); break; case initialized: lprintf("\nProcess has not started yet.\n"); break; case aborting: lprintf("\nProcess is aborting.\n"); break; case defunct: default: fatal("illegal process status"); }; return this; }
int KIPC::getProcessId(const QString &kludgetId) { int pid = 0; QString pidfile = getPIDFile(kludgetId); if (QFile::exists(pidfile)) { QFile file; file.setFileName(pidfile); if (file.open(QIODevice::ReadOnly)) { QString text = file.readAll(); file.close(); pid = text.toInt(); } } // qDebug(">>%s %d", qPrintable(kludgetId), pid); if (!checkProcess(pid)) return 0; return pid; }
void PeerguardianInfo::updateDaemonState() { QString oldPID = m_ProcessPID; bool oldState = m_DaemonState; checkProcess(); if ( m_ProcessPID != oldPID ) { emit processPIDChange( m_ProcessPID ); } if ( m_DaemonState != oldState ) { emit processStateChange( m_DaemonState ); if ( m_DaemonState == true ) { emit pgldStarted(); } else { emit pgldStopped(); } } }
bool AI::init(int engine) { bool engine_started = false; bool b64bit = isOS64Bit(); bool jobSuccess = false; m_engine = engine; memset(m_engine_path, 0, sizeof(m_engine_path)); // set up the security attributes m_sa.bInheritHandle = true; m_sa.lpSecurityDescriptor = NULL; m_sa.nLength = sizeof(SECURITY_ATTRIBUTES); // setup job to kill the child process when calling process terminates m_hJob = CreateJobObject(NULL, NULL); if(m_hJob != NULL){ m_jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; jobSuccess = SetInformationJobObject(m_hJob, JobObjectExtendedLimitInformation, &m_jeli, sizeof(m_jeli)); } // open a pipe to the AI engine if(!CreatePipe(&m_child_stdin, &m_hWrite, &m_sa, 0)){ throw std::runtime_error("CreatePipe - stdin"); return false; } if(!CreatePipe(&m_hRead, &m_child_stdout, &m_sa, 0)){ throw std::runtime_error("CreatePipe - stdout"); cleanup(); return false; } // prepare to launch the process GetStartupInfo(&m_si); m_si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; m_si.wShowWindow = SW_HIDE; m_si.hStdOutput = m_child_stdout; m_si.hStdError = m_child_stdout; m_si.hStdInput = m_child_stdin; for(;!engine_started;){ switch(m_engine){ case ENGINE_HOUDINI: if(b64bit){ strcpy(m_engine_path, "Data/Engines/Houdini_x64.exe"); checkProcess("Houdini_x64.exe"); } else{ strcpy(m_engine_path, "Data/Engines/Houdini_x86.exe"); checkProcess("Houdini_x86.exe"); } break; case ENGINE_STOCKFISH: if(b64bit){ strcpy(m_engine_path, "Data/Engines/Stockfish_x64.exe"); checkProcess("Stockfish_x64.exe"); } else{ strcpy(m_engine_path, "Data/Engines/Stockfish_x86.exe"); checkProcess("Stockfish_x86.exe"); } break; case ENGINE_CRITTER: if(b64bit){ strcpy(m_engine_path, "Data/Engines/Critter_x64.exe"); checkProcess("Critter_x64.exe"); } else{ strcpy(m_engine_path, "Data/Engines/Critter_x86.exe"); checkProcess("Critter_x86.exe"); } break; case ENGINE_CUSTOM: strcpy(m_engine_path, "Data/Engines/Custom.exe"); break; default: throw std::runtime_error("No valid engine found"); cleanup(); return false; } // attempt to launch the process engine_started = CreateProcess(m_engine_path, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &m_si, &m_pi); if(!engine_started){ if(engine > 0) engine = 0; else ++engine; continue; } break; } // assign the job to the process if(jobSuccess){ jobSuccess = AssignProcessToJobObject(m_hJob, m_pi.hProcess); } // change states //m_active = true; //m_thinking = true; // set process priority to below normal to prevent destruction of the CPU SetPriorityClass(m_pi.hProcess, BELOW_NORMAL_PRIORITY_CLASS); // set AI to active if(engine_started){ m_active = true; // start the state machine thread (void)CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&InitThread, this, 0, 0); } return true; }
BOOL getInitParam(int argc, char *argv[], SRVR_INIT_PARAM_Def &initParam, char* strName, char* strValue) { int count; char* arg = NULL; int number; BOOL retcode; BOOL argEmpty = FALSE; BOOL argWrong = FALSE; initParam.debugFlag = 0; initParam.eventFlag = 0; initParam.asSrvrObjRef[0] = '\0'; initParam.srvrType = SRVR_UNKNOWN; initParam.startType = NON_INTERACTIVE; initParam.noOfServers = DEFAULT_NUMBER_OF_SERVERS; initParam.cfgSrvrTimeout = DEFAULT_CFGSRVR_TIMEOUT; initParam.DSId = PUBLIC_DSID; initParam.transport = CEE_TRANSPORT_TCP; initParam.portNumber = DEFAULT_PORT_NUMBER; initParam.majorVersion = DEFAULT_MAJOR_VERSION; initParam.IpPortRange = DEFAULT_PORT_RANGE; initParam.DSName[0] = '\0'; count = 1; strName[0] = 0; strValue[0] = 0; #ifdef NSK_PLATFORM initTcpProcessName(initParam.TcpProcessName); initParam.ASProcessName[0] = '\0'; strcpy( initParam.EmsName, DEFAULT_EMS ); initParam.EmsTimeout = DEFAULT_EMS_TIMEOUT; initParam.initIncSrvr = DEFAULT_INIT_SRVR; initParam.initIncTime = DEFAULT_INIT_TIME; initParam.DSG =DEFAULT_DSG; initParam.srvrTrace = false; initParam.TraceCollector[0] = '\0'; initParam.RSCollector[0] = '\0'; #else initParam.IpAddress[0] = '\0'; #endif while ( count < argc) { if( (arg = (char*)realloc( arg, strlen( argv[count]) + 1) ) == NULL) { strcpy( strName, "realloc"); sprintf( strValue, "%d",strlen( argv[count]) + 1); return FALSE; } strcpy(arg, argv[count]); strupr(arg); if (strcmp(arg, "-A") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.asSrvrObjRef)-1) strcpy(initParam.asSrvrObjRef, argv[count]); else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-D") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) initParam.debugFlag = number; else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-E") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { if( number != 0 && number != 1 && number !=2 ) { argWrong = TRUE; break; } initParam.eventFlag = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-DS") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.DSId = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-DSN") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.DSName)-1) strcpy(initParam.DSName, argv[count]); else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-PN") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE && checkPortNumber(number) == TRUE ) { initParam.portNumber = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-PR") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE && number >= 3) { initParam.IpPortRange = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } #ifdef NSK_PLATFORM else if (strcmp(arg, "-TCP") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.TcpProcessName)-1) { if( checkProcess( argv[count]) != TRUE ) { argWrong = TRUE; break; } strcpy(initParam.TcpProcessName, argv[count]); } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-AS") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.ASProcessName)-1) { if( checkProcess( argv[count]) != TRUE ) { argWrong = TRUE; break; } strcpy(initParam.ASProcessName, argv[count]); } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-EMS") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.EmsName)-1) { strcpy(initParam.EmsName, argv[count]); } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-TMC") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.TraceCollector)-1) { strcpy(initParam.TraceCollector, argv[count]); } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-RMC") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.RSCollector)-1) { strcpy(initParam.RSCollector, argv[count]); } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-TE") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.EmsTimeout = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-ISRVR") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.initIncSrvr = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-ITIME") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.initIncTime = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-DSG") == 0) { initParam.DSG =true; } else if (strcmp(arg, "-STC") == 0) { if (++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < 2) { if (strcmp(argv[count], "Y") == 0) initParam.srvrTrace = true; else initParam.srvrTrace = false; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } #else else if (strcmp(arg, "-IP") == 0) { if(++count < argc && argv[count][0] != '-' ) { if (strlen(argv[count]) < sizeof(initParam.IpAddress)-1) strcpy(initParam.IpAddress, argv[count]); else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } #endif else if (strcmp(arg, "-T") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.transport = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-N") == 0) { if (++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.noOfServers = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-TO") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.cfgSrvrTimeout = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-V") == 0) { if(++count < argc && argv[count][0] != '-' ) { if( getNumber( argv[count], number ) == TRUE ) { initParam.majorVersion = number; } else { argWrong = TRUE; break; } } else { argEmpty = TRUE; break; } } else if (strcmp(arg, "-I") == 0) initParam.startType = INTERACTIVE; else if (strcmp(arg, "-FO") == 0) initParam.startType = FAILOVER; else { argWrong = TRUE; count = argc; break; } count++; } #ifdef NSK_PLATFORM if (initParam.TraceCollector[0] == '\0') strcpy(initParam.TraceCollector, initParam.EmsName); if (initParam.RSCollector[0] == '\0') strcpy(initParam.RSCollector, initParam.EmsName); #endif if( argEmpty == TRUE || argWrong == TRUE ) { strcpy( strName, arg); if(count < argc) strcpy( strValue, argv[count]); else strcpy( strValue, ""); retcode = FALSE; } else retcode = TRUE; if( arg != NULL ) free(arg); return retcode; }
bool processOopClass::is_live_process() { return checkProcess(this) != NULL; }
oop processOopClass::ActivationStack_prim(void *FH) { ResourceMark rm; Process* p = checkProcess(this); if (p == currentProcess) p->killVFrameOopsAndSetWatermark( p->last_self_frame(false)); if (!p) { prim_failure(FH, NOPROCESSERROR); return NULL; } FlushRegisterWindows(); vframeBList = new VFrameBList(1000); p->stack()->vframes_do(addVFrameToList); bool hideFirst = p != vmProcess; if (vframeBList->nonEmpty() && hideFirst) (void) vframeBList->pop(); smi len= vframeBList->length(); objVectorOop resultVec= Memory->objVectorObj->cloneSize(len, CANFAIL); if (oop(resultVec) == failedAllocationOop) { out_of_memory_failure(FH, Memory->objVectorObj->size() + len); return NULL; } oop* resultp = resultVec->objs(); // Build the result as a merge of vframeBList and existing vframeOops // and save mirrors of all the resulting vframeOops. vframeOop prev = vframeList(); vframeOop merge = prev->next(); for (int i = 0; i < vframeBList->length(); i++) { abstract_vframe* vf = vframeBList->nth(i); mirrorOop mirror; if (merge && merge->is_equal(vf)) { mirror= merge->as_mirror_or_fail(); if (oop(mirror) == failedAllocationOop) { out_of_memory_failure(FH); return NULL; } prev = merge; merge = merge->next(); } else { vframeOop vfo= clone_vframeOop(vf, p, CANFAIL); if (oop(vfo) == failedAllocationOop) { out_of_memory_failure(FH); return NULL; } mirror= vfo->as_mirror_or_fail(); if (oop(mirror) == failedAllocationOop) { out_of_memory_failure(FH); return NULL; } vfo->insertAfter(prev); prev = vfo; } Memory->store(resultp++, mirror); } if (p == currentProcess) p->killVFrameOopsAndSetWatermark( p->last_self_frame(false)); return resultVec; }