void initdatabases(void) { if (!init) { clr_index(); working(1, 0, 0); set_color(WHITE, BLACK); ftnd_mvprintw( 5, 6, " INIT DATABASES"); IsDoing("Init Databases"); } config_read(); InitArchive(); InitDomain(); InitFilearea(); InitFilefind(); InitFGroup(); InitFidonetdb(); InitFidonet(); InitHatch(); InitLanguage(); InitLimits(); InitMagics(); InitMsgarea(); InitMGroup(); InitModem(); InitNewfiles(); InitNGroup(); InitNodes(); InitOneline(); InitProtocol(); InitService(); InitTicarea(); InitTtyinfo(); InitUsers(); InitVirus(); InitRoute(); InitFDB(); InitIBC(); if (!init) { clr_index(); } }
HANDLE WINAPI EXP_NAME(OpenPlugin)(int OpenFrom, INT_PTR Item) { // Options.Read(); AutoUTF cline; if (OpenFrom == OPEN_PLUGINSMENU) { FarPnl pi(PANEL_ACTIVE); if (pi.IsOK()) { AutoUTF buf(MAX_PATH_LEN, L'\0'); fsf.GetCurrentDirectory(buf.capacity(), (PWSTR)buf.c_str()); if (!buf.empty()) ::PathAddBackslash((PWSTR)buf.c_str()); PluginPanelItem &PPI = pi[pi.CurrentItem()]; buf += PPI.FindData.lpwszFileName; cline = buf; } } else if (OpenFrom == OPEN_COMMANDLINE) { cline = (PCWSTR)Item; } FarList users; if (InitUsers(users)) { enum { HEIGHT = 14, WIDTH = 48, }; InitDialogItemF Items[] = { {DI_DOUBLEBOX, 3, 1, WIDTH - 4, HEIGHT - 2, 0, (PCWSTR)DlgTitle}, {DI_TEXT, 5, 2, 0, 0, 0, (PCWSTR)MUsername}, {DI_COMBOBOX, 5, 3, 42, 0, DIF_SELECTONENTRY, L""}, {DI_TEXT, 5, 4, 0, 0, 0, (PCWSTR)MPasword}, {DI_PSWEDIT, 5, 5, 42, 0, 0, L""}, {DI_CHECKBOX , 5, 6, 42, 0, 0, (PCWSTR)MRestricted}, {DI_TEXT, 0, 7, 0, 0, DIF_SEPARATOR, L""}, {DI_TEXT, 5, 8, 0, 0, 0, (PCWSTR)MCommandLine}, {DI_EDIT, 5, 9, 42, 0, DIF_HISTORY, cline.c_str()}, {DI_TEXT, 0, HEIGHT - 4, 0, 0, DIF_SEPARATOR, L""}, {DI_BUTTON, 0, HEIGHT - 3, 0, 0, DIF_CENTERGROUP, (PCWSTR)txtBtnOk}, {DI_BUTTON, 0, HEIGHT - 3, 0, 0, DIF_CENTERGROUP, (PCWSTR)txtBtnCancel}, }; size_t size = sizeofa(Items); FarDialogItem FarItems[size]; InitDialogItemsF(Items, FarItems, size); FarItems[size - 2].DefaultButton = 1; FarItems[2].ListItems = &users; FarItems[8].History = L"runas.comline"; FarDlg hDlg; if (hDlg.Init(psi.ModuleNumber, -1, -1, WIDTH, HEIGHT, L"Contents", FarItems, size)) { HRESULT err = NO_ERROR; while (true) { int ret = hDlg.Run(); if (ret > 0 && Items[ret].Data == (PCWSTR)txtBtnOk) { AutoUTF cmd(hDlg.Str(8)); if (hDlg.Check(5)) { err = ExecRestricted(cmd.c_str()); } else { AutoUTF user(hDlg.Str(2)); AutoUTF pass(hDlg.Str(4)); err = ExecAsUser(cmd.c_str(), user.c_str(), pass.c_str()); } if (err == NO_ERROR) { break; } else { PCWSTR Msg[] = {GetMsg(MError), cmd.c_str(), L"", GetMsg(txtBtnOk), }; ::SetLastError(err); psi.Message(psi.ModuleNumber, FMSG_WARNING | FMSG_ERRORTYPE, L"Contents", Msg, sizeofa(Msg), 1); } } else { break; } } } FreeUsers(users); } return INVALID_HANDLE_VALUE; }