void user_init() { user.defs=varinit(LN_str,MAX_var); user.var=varinit(LN_str,MAX_var); user.mptr=varinit(LN_longdig,MAX_var); user.member=atoi(getvar("member",sys.var)); op_system(); sion_sr("def","signup"); sion_read(user.defs); sion_close(); ulist_init(); }
int main(void) { NavConstantInit(); //Navigation constants initialisation /* Data Required to be loaded from GUI*/ MasterLat = 17.0*cdr; MasterLon=78.0*cdr; MasterAlt= 500.0; NavTime = 300.0; mdl_si=0.0; mdl_phi=0.0; mdl_theta = 0.0; /* Variables initialisation*/ varinit(); // These flags required for executing navigation run nav_flag = 1; level_flag = 0; //Initialised to computed euler angles FinsLat = MasterLat; FinsLon = MasterLon; while (rcnt < NavTime * 400) { navig(); //Navigation Module } return 0; }
void sys_init() { char *p,buf[LN_buf+1]; char t; time_t e,s; ch.frug.called=0; ch.frug.monitor=1; ch.frug.esc=0; ch.fp=NULL; sys.rs=FALSE; /* ch.env=NULL;*/ /* debug_start();*/ ed_init(); sion_init(); nowvar=varinit(LN_str,MAX_var); sys.var=varinit(LN_str,MAX_var); sys.result=varinit(LN_result,MAX_var); strcpy(sys.home,"."); op_system(); if (sion_sr("config","system")==0) { exit(1); } sion_read(sys.var); sion_sr("config","result"); sion_read(sys.result); sion_close(); sys.execute=atoi(getvar("execute",sys.var))+1; sys.logon =atoi(getvar("logon",sys.var)); sys.post =atoi(getvar("post",sys.var)); sys.t_logon=atoi(getvar("tdlogon",sys.var)); sys.t_post =atoi(getvar("tdpost",sys.var)); strjncpy(sys.netname,getvar("netname",sys.var),LN_title); strjncpy(sys.netid,getvar("netid",sys.var),LN_netid); strjncpy(sys.home ,getvar("home",sys.var),LN_dirs); strjncpy(sys.temp ,getvar("temp",sys.var),LN_dirs); pool.max=atoi(getvar("poolmax",sys.var)); copyright(); p=getvar("opentime",sys.var); tzset(); /* 時空関数がまだ現れていないので呼ぶ必要あり */ if (p==NULL) { sys.opentime=DT_daytime; sys.starttime=0; }else { p=pull(buf,p); t=atoi(buf); p=pull(buf,p); s=(t*60+atoi(buf))*60; p=pull(buf,p); t=atoi(buf); p=pull(buf,p); e=(t*60+atoi(buf))*60; /*dbprintf("s:%ld,e:%ld",s,e);*/ sys.opentime=e+(e<s?DT_daytime:0)-s; sys.starttime=DT_daytime-s; /*dbprintf("o:%ld,s:%ld",sys.opentime,sys.starttime);*/ } stack_init(); where_init(); user_init(); art_init(); pool_init(); sys.rs=rs_init(); /* sys_log("●システム起動");*/ }
extern "C" DLL_EXPORT const char* _dbg_dbginit() { if(!EngineCheckStructAlignment(UE_STRUCT_TITAN_ENGINE_CONTEXT, sizeof(TITAN_ENGINE_CONTEXT_t))) return "Invalid TITAN_ENGINE_CONTEXT_t alignment!"; if(sizeof(TITAN_ENGINE_CONTEXT_t) != sizeof(REGISTERCONTEXT)) return "Invalid REGISTERCONTEXT alignment!"; dputs("Initializing wait objects..."); waitinitialize(); dputs("Initializing debugger..."); dbginit(); dputs("Initializing debugger functions..."); dbgfunctionsinit(); dputs("Setting JSON memory management functions..."); json_set_alloc_funcs(json_malloc, json_free); dputs("Initializing capstone..."); Capstone::GlobalInitialize(); dputs("Initializing Yara..."); if(yr_initialize() != ERROR_SUCCESS) return "Failed to initialize Yara!"; dputs("Getting directory information..."); wchar_t wszDir[deflen] = L""; if(!GetModuleFileNameW(hInst, wszDir, deflen)) return "GetModuleFileNameW failed!"; char dir[deflen] = ""; strcpy_s(dir, StringUtils::Utf16ToUtf8(wszDir).c_str()); int len = (int)strlen(dir); while(dir[len] != '\\') len--; dir[len] = 0; strcpy_s(alloctrace, dir); strcat_s(alloctrace, "\\alloctrace.txt"); DeleteFileW(StringUtils::Utf8ToUtf16(alloctrace).c_str()); setalloctrace(alloctrace); strcpy_s(dbbasepath, dir); //debug directory strcat_s(dbbasepath, "\\db"); CreateDirectoryW(StringUtils::Utf8ToUtf16(dbbasepath).c_str(), 0); //create database directory char szLocalSymbolPath[MAX_PATH] = ""; strcpy_s(szLocalSymbolPath, dir); strcat_s(szLocalSymbolPath, "\\symbols"); char cachePath[MAX_SETTING_SIZE]; if(!BridgeSettingGet("Symbols", "CachePath", cachePath) || !*cachePath) { strcpy_s(szSymbolCachePath, szLocalSymbolPath); BridgeSettingSet("Symbols", "CachePath", ".\\symbols"); } else { if (_strnicmp(cachePath, ".\\", 2) == 0) { strncpy_s(szSymbolCachePath, dir, _TRUNCATE); strncat_s(szSymbolCachePath, cachePath + 1, _TRUNCATE); } else { // Trim the buffer to fit inside MAX_PATH strncpy_s(szSymbolCachePath, cachePath, _TRUNCATE); } if(strstr(szSymbolCachePath, "http://") || strstr(szSymbolCachePath, "https://")) { if(Script::Gui::MessageYesNo("It is strongly discouraged to use symbol servers in your path directly (use the store option instead).\n\nDo you want me to fix this?")) { strcpy_s(szSymbolCachePath, szLocalSymbolPath); BridgeSettingSet("Symbols", "CachePath", ".\\symbols"); } } } dputs(szSymbolCachePath); SetCurrentDirectoryW(StringUtils::Utf8ToUtf16(dir).c_str()); dputs("Allocating message stack..."); gMsgStack = MsgAllocStack(); if(!gMsgStack) return "Could not allocate message stack!"; dputs("Initializing global script variables..."); varinit(); dputs("Registering debugger commands..."); registercommands(); dputs("Starting command loop..."); hCommandLoopThread = CreateThread(0, 0, DbgCommandLoopThread, 0, 0, 0); char plugindir[deflen] = ""; strcpy_s(plugindir, dir); strcat_s(plugindir, "\\plugins"); CreateDirectoryW(StringUtils::Utf8ToUtf16(plugindir).c_str(), 0); dputs("Loading plugins..."); pluginload(plugindir); dputs("Handling command line..."); //handle command line int argc = 0; wchar_t** argv = CommandLineToArgvW(GetCommandLineW(), &argc); if(argc == 2) //we have an argument { String str = "init \""; str += StringUtils::Utf16ToUtf8(argv[1]); str += "\""; DbgCmdExec(str.c_str()); } else if(argc == 5) //4 arguments (JIT) { if(_wcsicmp(argv[1], L"-a") == 0 && !_wcsicmp(argv[3], L"-e")) { String str = "attach ."; str += StringUtils::Utf16ToUtf8(argv[2]); str += ", ."; str += StringUtils::Utf16ToUtf8(argv[4]); DbgCmdExec(str.c_str()); } } LocalFree(argv); dputs("Initialization successful!"); bIsStopped = false; return nullptr; }
int main(int argc, char **argv) { int c = -1; /* command character */ int f; /* default flag */ int n; /* numeric repeat count */ int mflag; /* negative flag on repeat */ struct buffer *bp; /* temp buffer pointer */ int firstfile; /* first file flag */ int carg; /* current arg to scan */ int startflag; /* startup executed flag */ struct buffer *firstbp = NULL; /* ptr to first buffer in cmd line */ int basec; /* c stripped of meta character */ int viewflag; /* are we starting in view mode? */ int gotoflag; /* do we need to goto a line at start? */ int gline = 0; /* if so, what line? */ int searchflag; /* Do we need to search at start? */ int saveflag; /* temp store for lastflag */ int errflag; /* C error processing? */ char bname[NBUFN]; /* buffer name of file to read */ #if CRYPT int cryptflag; /* encrypting on the way in? */ char ekey[NPAT]; /* startup encryption key */ #endif int newc; #if PKCODE & VMS (void) umask(-1); /* Use old protection (this is at wrong place). */ #endif #if PKCODE & BSD sleep(1); /* Time for window manager. */ #endif #if UNIX #ifdef SIGWINCH signal(SIGWINCH, sizesignal); #endif #endif if (argc == 2) { if (strcmp(argv[1], "--help") == 0) { usage(EXIT_FAILURE); } if (strcmp(argv[1], "--version") == 0) { version(); exit(EXIT_SUCCESS); } } /* Initialize the editor. */ vtinit(); /* Display */ edinit("main"); /* Buffers, windows */ varinit(); /* user variables */ viewflag = FALSE; /* view mode defaults off in command line */ gotoflag = FALSE; /* set to off to begin with */ searchflag = FALSE; /* set to off to begin with */ firstfile = TRUE; /* no file to edit yet */ startflag = FALSE; /* startup file not executed yet */ errflag = FALSE; /* not doing C error parsing */ #if CRYPT cryptflag = FALSE; /* no encryption by default */ #endif /* Parse the command line */ for (carg = 1; carg < argc; ++carg) { /* Process Switches */ #if PKCODE if (argv[carg][0] == '+') { gotoflag = TRUE; gline = atoi(&argv[carg][1]); } else #endif if (argv[carg][0] == '-') { switch (argv[carg][1]) { /* Process Startup macroes */ case 'a': /* process error file */ case 'A': errflag = TRUE; break; case 'e': /* -e for Edit file */ case 'E': viewflag = FALSE; break; case 'g': /* -g for initial goto */ case 'G': gotoflag = TRUE; gline = atoi(&argv[carg][2]); break; #if CRYPT case 'k': /* -k<key> for code key */ case 'K': cryptflag = TRUE; strcpy(ekey, &argv[carg][2]); break; #endif #if PKCODE case 'n': /* -n accept null chars */ case 'N': nullflag = TRUE; break; #endif case 'r': /* -r restrictive use */ case 'R': restflag = TRUE; break; case 's': /* -s for initial search string */ case 'S': searchflag = TRUE; strncpy(pat, &argv[carg][2], NPAT); break; case 'v': /* -v for View File */ case 'V': viewflag = TRUE; break; default: /* unknown switch */ /* ignore this for now */ break; } } else if (argv[carg][0] == '@') { /* Process Startup macroes */ if (startup(&argv[carg][1]) == TRUE) /* don't execute emacs.rc */ startflag = TRUE; } else { /* Process an input file */ /* set up a buffer for this file */ makename(bname, argv[carg]); unqname(bname); /* set this to inactive */ bp = bfind(bname, TRUE, 0); strcpy(bp->b_fname, argv[carg]); bp->b_active = FALSE; if (firstfile) { firstbp = bp; firstfile = FALSE; } /* set the modes appropriatly */ if (viewflag) bp->b_mode |= MDVIEW; #if CRYPT if (cryptflag) { bp->b_mode |= MDCRYPT; myencrypt((char *) NULL, 0); myencrypt(ekey, strlen(ekey)); strncpy(bp->b_key, ekey, NPAT); } #endif } } #if UNIX signal(SIGHUP, emergencyexit); signal(SIGTERM, emergencyexit); #endif /* if we are C error parsing... run it! */ if (errflag) { if (startup("error.cmd") == TRUE) startflag = TRUE; } /* if invoked with no other startup files, run the system startup file here */ if (startflag == FALSE) { startup(""); startflag = TRUE; } discmd = TRUE; /* P.K. */ /* if there are any files to read, read the first one! */ bp = bfind("main", FALSE, 0); if (firstfile == FALSE && (gflags & GFREAD)) { swbuffer(firstbp); zotbuf(bp); } else bp->b_mode |= gmode; /* Deal with startup gotos and searches */ if (gotoflag && searchflag) { update(FALSE); mlwrite("(Can not search and goto at the same time!)"); } else if (gotoflag) { if (gotoline(TRUE, gline) == FALSE) { update(FALSE); mlwrite("(Bogus goto argument)"); } } else if (searchflag) { if (forwhunt(FALSE, 0) == FALSE) update(FALSE); } /* Setup to process commands. */ lastflag = 0; /* Fake last flags. */ loop: /* Execute the "command" macro...normally null. */ saveflag = lastflag; /* Preserve lastflag through this. */ execute(META | SPEC | 'C', FALSE, 1); lastflag = saveflag; #if TYPEAH && PKCODE if (typahead()) { newc = getcmd(); update(FALSE); do { fn_t execfunc; if (c == newc && (execfunc = getbind(c)) != NULL && execfunc != insert_newline && execfunc != insert_tab) newc = getcmd(); else break; } while (typahead()); c = newc; } else { update(FALSE); c = getcmd(); } #else /* Fix up the screen */ update(FALSE); /* get the next command from the keyboard */ c = getcmd(); #endif /* if there is something on the command line, clear it */ if (mpresf != FALSE) { mlerase(); update(FALSE); #if CLRMSG if (c == ' ') /* ITS EMACS does this */ goto loop; #endif } f = FALSE; n = 1; /* do META-# processing if needed */ basec = c & ~META; /* strip meta char off if there */ if ((c & META) && ((basec >= '0' && basec <= '9') || basec == '-')) { f = TRUE; /* there is a # arg */ n = 0; /* start with a zero default */ mflag = 1; /* current minus flag */ c = basec; /* strip the META */ while ((c >= '0' && c <= '9') || (c == '-')) { if (c == '-') { /* already hit a minus or digit? */ if ((mflag == -1) || (n != 0)) break; mflag = -1; } else { n = n * 10 + (c - '0'); } if ((n == 0) && (mflag == -1)) /* lonely - */ mlwrite("Arg:"); else mlwrite("Arg: %d", n * mflag); c = getcmd(); /* get the next key */ } n = n * mflag; /* figure in the sign */ } /* do ^U repeat argument processing */ if (c == reptc) { /* ^U, start argument */ f = TRUE; n = 4; /* with argument of 4 */ mflag = 0; /* that can be discarded. */ mlwrite("Arg: 4"); while (((c = getcmd()) >= '0' && c <= '9') || c == reptc || c == '-') { if (c == reptc) if ((n > 0) == ((n * 4) > 0)) n = n * 4; else n = 1; /* * If dash, and start of argument string, set arg. * to -1. Otherwise, insert it. */ else if (c == '-') { if (mflag) break; n = 0; mflag = -1; } /* * If first digit entered, replace previous argument * with digit and set sign. Otherwise, append to arg. */ else { if (!mflag) { n = 0; mflag = 1; } n = 10 * n + c - '0'; } mlwrite("Arg: %d", (mflag >= 0) ? n : (n ? -n : -1)); } /* * Make arguments preceded by a minus sign negative and change * the special argument "^U -" to an effective "^U -1". */ if (mflag == -1) { if (n == 0) n++; n = -n; } } /* and execute the command */ execute(c, f, n); goto loop; }
MainWindow::MainWindow() { varinit(); setupUi(this); if (tr("LTR") == "RTL") { qApp->setLayoutDirection(Qt::RightToLeft); } #ifndef Q_WS_WIN testPageSplitter->setPalette(this->palette()); #endif remainingTimeLcdNumber->setVisible(false); remainingTimeProgressBar->setVisible(false); label_minutes->setVisible(false); questionTextSvgSplitter->setCollapsible(0, false); questionTextSvgSplitter->setCollapsible(1, true); tcpSocket = new QTcpSocket(this); progress_dialog = NULL; current_test_use_groups = false; current_connection_local = false; QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateTime())); QObject::connect(tbtnQuit, SIGNAL(released()), this, SLOT(close())); QObject::connect(tbtnAbout, SIGNAL(released()), this, SLOT(about())); QObject::connect(tbtnGetReady, SIGNAL(released()), this, SLOT(getReady())); QObject::connect(tbtnStart, SIGNAL(released()), this, SLOT(start())); QObject::connect(tbtnBrowse_DBPath, SIGNAL(released()), this, SLOT(browse_i())); QObject::connect(tbtnBrowse_savePath, SIGNAL(released()), this, SLOT(browse_o())); QObject::connect(tbtnLoad, SIGNAL(released()), this, SLOT(loadFile())); QObject::connect(useDefaultOutputCheckBox, SIGNAL(toggled(bool)), savePathLineEdit, SLOT(setDisabled(bool))); QObject::connect(useDefaultOutputCheckBox, SIGNAL(toggled(bool)), tbtnBrowse_savePath, SLOT(setDisabled(bool))); QObject::connect(serverNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableConnectButton())); QObject::connect(serverPortLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableConnectButton())); QObject::connect(DBPathLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableLoadButton())); QObject::connect(tbtnConnect, SIGNAL(released()), this, SLOT(connectSocket())); QObject::connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readIncomingData())); QObject::connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError))); QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion())); QObject::connect(svgDisplayWidget, SIGNAL(titleClicked(const QString &)), this, SLOT(previewSvg(const QString &))); QObject::connect(btnNext, SIGNAL(released()), this, SLOT(nextQuestion())); QObject::connect(btnLast, SIGNAL(released()), this, SLOT(lastQuestion())); QObject::connect(btnFinish, SIGNAL(released()), this, SLOT(finish())); QObject::connect(btnNewTest, SIGNAL(released()), this, SLOT(newTest())); QObject::connect(btnQuit, SIGNAL(released()), this, SLOT(close())); rbtngrpInputType = new QButtonGroup (this); rbtngrpInputType->addButton(rbtnNetwork); rbtngrpInputType->addButton(rbtnFromFile); QObject::connect(rbtngrpInputType, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(toggleInputType(QAbstractButton *))); QObject::connect(answersView, SIGNAL(buttonReleased(Question::Answers)), this, SLOT(setQuestionAnswered(Question::Answers))); for (int i = 0; i < 8; ++i) {infoTableWidget->setItem(i, 0, new QTableWidgetItem);} ITW_test_name = infoTableWidget->item(0, 0); ITW_test_date = infoTableWidget->item(1, 0); ITW_test_timestamp = infoTableWidget->item(2, 0); ITW_test_time = infoTableWidget->item(3, 0); ITW_test_qnum = infoTableWidget->item(4, 0); ITW_test_fnum = infoTableWidget->item(5, 0); ITW_test_flags = infoTableWidget->item(6, 0); ITW_test_passmark = infoTableWidget->item(7, 0); ITW_test_comments = new QTextBrowser (infoTableWidget); infoTableWidget->setCellWidget(8, 0, ITW_test_comments); infoTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); infoTableWidget->verticalHeader()->setResizeMode(8, QHeaderView::Stretch); resultsTableWidget->setColumnCount(1); resultsTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); resultsTableWidget->horizontalHeader()->hide(); loadSettings(); // Check app args ---------------------------------------------------------- if (qApp->arguments().count() > 2) { if (qApp->arguments().at(1) == "-port") { serverNameLineEdit->setText("Localhost"); serverPortLineEdit->setText(qApp->arguments().at(2)); connectSocket(); } } else if (qApp->arguments().count() > 1) { openFile(qApp->arguments().at(1)); } }
extern "C" DLL_EXPORT const char* _dbg_dbginit() { if(!EngineCheckStructAlignment(UE_STRUCT_TITAN_ENGINE_CONTEXT, sizeof(TITAN_ENGINE_CONTEXT_t))) return "Invalid TITAN_ENGINE_CONTEXT_t alignment!"; if(sizeof(TITAN_ENGINE_CONTEXT_t) != sizeof(REGISTERCONTEXT)) return "Invalid REGISTERCONTEXT alignment!"; dputs("Initializing locks..."); SectionLockerGlobal::Initialize(); dputs("Initializing wait objects..."); waitinitialize(); dputs("Initializing debugger..."); dbginit(); dputs("Initializing debugger functions..."); dbgfunctionsinit(); dputs("Setting JSON memory management functions..."); json_set_alloc_funcs(json_malloc, json_free); dputs("Initializing capstone..."); Capstone::GlobalInitialize(); dputs("Initializing Yara..."); if(yr_initialize() != ERROR_SUCCESS) return "Failed to initialize Yara!"; dputs("Getting directory information..."); wchar_t wszDir[deflen] = L""; if(!GetModuleFileNameW(hInst, wszDir, deflen)) return "GetModuleFileNameW failed!"; char dir[deflen] = ""; strcpy_s(dir, StringUtils::Utf16ToUtf8(wszDir).c_str()); int len = (int)strlen(dir); while(dir[len] != '\\') len--; dir[len] = 0; strcpy_s(alloctrace, dir); strcat_s(alloctrace, "\\alloctrace.txt"); DeleteFileW(StringUtils::Utf8ToUtf16(alloctrace).c_str()); setalloctrace(alloctrace); strcpy_s(dbbasepath, dir); //debug directory strcat_s(dbbasepath, "\\db"); CreateDirectoryW(StringUtils::Utf8ToUtf16(dbbasepath).c_str(), 0); //create database directory strcpy_s(szSymbolCachePath, dir); strcat_s(szSymbolCachePath, "\\symbols"); SetCurrentDirectoryW(StringUtils::Utf8ToUtf16(dir).c_str()); dputs("Allocating message stack..."); gMsgStack = MsgAllocStack(); if(!gMsgStack) return "Could not allocate message stack!"; dputs("Initializing global script variables..."); varinit(); dputs("Registering debugger commands..."); registercommands(); dputs("Starting command loop..."); hCommandLoopThread = CreateThread(0, 0, DbgCommandLoopThread, 0, 0, 0); char plugindir[deflen] = ""; strcpy_s(plugindir, dir); strcat_s(plugindir, "\\plugins"); CreateDirectoryW(StringUtils::Utf8ToUtf16(plugindir).c_str(), 0); dputs("Loading plugins..."); pluginload(plugindir); dputs("Handling command line..."); //handle command line int argc = 0; wchar_t** argv = CommandLineToArgvW(GetCommandLineW(), &argc); if(argc == 2) //we have an argument { String str = "init \""; str += StringUtils::Utf16ToUtf8(argv[1]); str += "\""; DbgCmdExec(str.c_str()); } else if(argc == 5) //4 arguments (JIT) { if(_wcsicmp(argv[1], L"-a") == 0 && !_wcsicmp(argv[3], L"-e")) { String str = "attach ."; str += StringUtils::Utf16ToUtf8(argv[2]); str += ", ."; str += StringUtils::Utf16ToUtf8(argv[4]); DbgCmdExec(str.c_str()); } } LocalFree(argv); dputs("Initialization successful!"); return 0; }