bool User::ChangeName(const char* gecos) { if (!this->fullname.compare(gecos)) return true; if (IS_LOCAL(this)) { ModResult MOD_RESULT; FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (IS_LOCAL(this),gecos)); if (MOD_RESULT == MOD_RES_DENY) return false; FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos)); } this->fullname.assign(gecos, 0, ServerInstance->Config->Limits.MaxGecos); return true; }
frmRestore::frmRestore(frmMain *_form, pgObject *obj) : ExternProcessDialog(form) { object=obj; if (object->GetMetaType() == PGM_SERVER) server = (pgServer*)object; else server=object->GetDatabase()->GetServer(); form=_form; wxWindowBase::SetFont(settings->GetSystemFont()); LoadResource(_form, wxT("frmRestore")); RestorePosition(); SetTitle(wxString::Format(_("Restore %s %s"), object->GetTranslatedTypeName().c_str(), object->GetQuotedFullIdentifier().c_str())); if (object->GetConnection()->EdbMinimumVersion(8,0)) restoreExecutable=edbRestoreExecutable; else if (object->GetConnection()->GetIsGreenplum()) restoreExecutable=gpRestoreExecutable; else restoreExecutable=pgRestoreExecutable; if (object->GetMetaType() != PGM_DATABASE) { chkOnlySchema->SetValue(object->GetMetaType() == PGM_FUNCTION || object->GetMetaType() == PGM_INDEX || object->GetMetaType() == PGM_TRIGGER); chkOnlyData->SetValue(object->GetMetaType() == PGM_TABLE || object->GetMetaType() == GP_PARTITION); if (object->GetMetaType() != PGM_SCHEMA) { chkOnlyData->Disable(); chkOnlySchema->Disable(); } if (object->GetMetaType() == PGM_FUNCTION) { chkClean->SetValue(true); chkClean->Disable(); } btnView->Disable(); } wxString val; settings->Read(wxT("frmRestore/LastFile"), &val, wxEmptyString); txtFilename->SetValue(val); // Icon SetIcon(wxIcon(restore_xpm)); txtMessages = CTRL_TEXT("txtMessages"); txtMessages->SetMaxLength(0L); btnOK->Disable(); filenameValid=false; if (!server->GetPasswordIsStored()) environment.Add(wxT("PGPASSWORD="******"PGSSLMODE=") + server->GetConnection()->GetSslModeName()); if (!pgAppMinimumVersion(restoreExecutable, 8, 4)) { chkNoTablespaces->Disable(); chkSingleXact->Disable(); txtNumberOfJobs->Disable(); } if (!pgAppMinimumVersion(restoreExecutable, 8, 2)) { chkNoDataForFailedTables->Disable(); } if (!pgAppMinimumVersion(restoreExecutable, 8, 0)) { chkExitOnError->Disable(); } wxCommandEvent ev; OnChangeName(ev); }
BOOL CGeneralCRC::OnInitDialog() { CDialog::OnInitDialog(); settings_.push_back("Dummy"); // Reserve index 0 since we use the index as the menu ID and an ID of zero is not allowed // Create the popup menu to attach to the "Select" button CMenu mm; mm.CreatePopupMenu(); // Add predefined CRC settings - add names to menu and store corresponding parameters strings in settings_ mm.AppendMenu(MF_STRING, settings_.size(), "CRC 8"); settings_.push_back("8|07|0|0|0|0|F4"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 10"); settings_.push_back("10|233|0|0|0|0|199"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 12"); settings_.push_back("12|80F|0|0|0|1|DAF"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 16"); settings_.push_back("16|8005|0|0|1|1|BB3D"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 16 USB"); settings_.push_back("16|8005|FFFF|FFFF|1|1|B4C8"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 16 CCITT"); settings_.push_back("16|1021|0|0|1|1|2189"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC CCITT F"); settings_.push_back("16|1021|FFFF|0|0|0|29B1"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC CCITT AUG"); settings_.push_back("16|1021|1D0F|0|0|0|E5CC"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC-A"); settings_.push_back("16|1021|C6C6|0|1|1|BF05"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC X-25"); settings_.push_back("16|1021|FFFF|FFFF|1|1|906E"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC XModem"); settings_.push_back("16|1021|0|0|0|0|31C3"); //mm.AppendMenu(MF_STRING, settings_.size(), "CRC XModem"); //settings_.push_back("16|8408|0|0|1|1"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC 32"); settings_.push_back("32|04C11DB7|FFFFFFFF|FFFFFFFF|1|1|CBF43926"); mm.AppendMenu(MF_STRING, settings_.size(), "CRC MPEG-2"); settings_.push_back("32|04C11DB7|FFFFFFFF|0|0|0|0376E6E7"); mm.AppendMenu(MF_SEPARATOR); last_selected_ = -1; last_predefined_ = settings_.size(); // Get any saved settings from the registry HKEY hkey; if (::RegCreateKey(HKEY_CURRENT_USER, reg_locn, &hkey) == ERROR_SUCCESS) { LONG err; // error return from registry enum function char name[80]; // buffer to hold the name of any registry setting found BYTE value[80]; // buffer to hold the value of any registry setting found DWORD name_len = sizeof(name), value_len = sizeof(value); // corresponding buffer lengths DWORD type; // the type of registry entry found (we only want strings = REG_SZ) for (int ii = 0; (err = ::RegEnumValue(hkey, ii, name, &name_len, NULL, &type, value, &value_len)) != ERROR_NO_MORE_ITEMS; ++ii) { // If we got a valid string entry if (err == ERROR_SUCCESS && type == REG_SZ) { mm.AppendMenu(MF_STRING, settings_.size(), name); settings_.push_back((char*)value); } // Reset in/out vars that have been modified name_len = sizeof(name); value_len = sizeof(value); } ::RegCloseKey(hkey); } // Attach the menu to the button select_menu_.m_hMenu = mm.GetSafeHmenu(); mm.Detach(); OnChangeName(); return TRUE; }