Beispiel #1
0
long reg_query_winscp_value_ex(HKEY Key, const char * ValueName, unsigned long * /*Reserved*/,
  unsigned long * Type, uint8_t * Data, unsigned long * DataSize)
{
  long R;
  DebugAssert(GetConfiguration() != nullptr);

  THierarchicalStorage * Storage = reinterpret_cast<THierarchicalStorage *>(Key);
  AnsiString Value;
  if (Storage == nullptr)
  {
    if (UnicodeString(ValueName) == L"RandSeedFile")
    {
      Value = AnsiString(GetConfiguration()->GetRandomSeedFileName());
      R = ERROR_SUCCESS;
    }
    else
    {
      DebugFail();
      R = ERROR_READ_FAULT;
    }
  }
  else
  {
    if (Storage->ValueExists(ValueName))
    {
      Value = AnsiString(Storage->ReadStringRaw(ValueName, L""));
      R = ERROR_SUCCESS;
    }
    else
    {
      R = ERROR_READ_FAULT;
    }
  }

  if (R == ERROR_SUCCESS)
  {
    DebugAssert(Type != nullptr);
    *Type = REG_SZ;
    char * DataStr = reinterpret_cast<char *>(Data);
    int sz = static_cast<int>(*DataSize);
    if (sz > 0)
    {
        strncpy(DataStr, Value.c_str(), sz);
        DataStr[sz - 1] = '\0';
    }
    *DataSize = static_cast<uint32_t>(strlen(DataStr));
  }

  return R;
}
Beispiel #2
0
// get short name for loft
std::string CCPACSFuselage::GetShortShapeName ()
{
    unsigned int findex = 0;
    for (int i = 1; i <= GetConfiguration().GetFuselageCount(); ++i) {
        tigl::CCPACSFuselage& f = GetConfiguration().GetFuselage(i);
        if (GetUID() == f.GetUID()) {
            findex = i;
            std::stringstream shortName;
            shortName << "F" << findex;
            return shortName.str();
        }
    }
    return "UNKNOWN";
}
Beispiel #3
0
int CMPIPTV_RTSP::Initialize(HANDLE lockMutex, CParameterCollection *configuration)
{
  if (configuration != NULL)
  {
    CParameterCollection *vlcParameters = GetConfiguration(&this->logger, PROTOCOL_IMPLEMENTATION_NAME, METHOD_INITIALIZE_NAME, CONFIGURATION_SECTION_UDP);
    configuration->Append(vlcParameters);
    delete vlcParameters;
  }

  int result = this->CMPIPTV_UDP::Initialize(lockMutex, configuration);

  this->receiveDataTimeout = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_RECEIVE_DATA_TIMEOUT, true, RTSP_RECEIVE_DATA_TIMEOUT_DEFAULT);
  this->rtspUdpSinkMaxPayloadSize = this->configurationParameters->GetValueUnsignedInt(CONFIGURATION_RTSP_UDP_SINK_MAX_PAYLOAD_SIZE, true, RTSP_UDP_SINK_MAX_PAYLOAD_SIZE_DEFAULT);
  this->rtspUdpPortRangeStart = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_UDP_PORT_RANGE_START, true, RTSP_UDP_PORT_RANGE_START_DEFAULT);
  this->rtspUdpPortRangeEnd = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_UDP_PORT_RANGE_END, true, RTSP_UDP_PORT_RANGE_END_DEFAULT);
  this->rtspTeardownRequestMaximumCount = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_TEARDOWN_REQUEST_MAXIMUM_COUNT, true, RTSP_TEARDOWN_REQUEST_MAXIMUM_COUNT_DEFAULT);
  this->rtspTeardownRequestTimeout = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_TEARDOWN_REQUEST_TIMEOUT, true, RTSP_TEARDOWN_REQUEST_TIMEOUT_DEFAULT);
  this->openConnetionMaximumAttempts = this->configurationParameters->GetValueLong(CONFIGURATION_RTSP_OPEN_CONNECTION_MAXIMUM_ATTEMPTS, true, RTSP_OPEN_CONNECTION_MAXIMUM_ATTEMPTS_DEFAULT);

  this->receiveDataTimeout = (this->receiveDataTimeout < 0) ? RTSP_RECEIVE_DATA_TIMEOUT_DEFAULT : this->receiveDataTimeout;
  this->rtspUdpSinkMaxPayloadSize = (this->rtspUdpSinkMaxPayloadSize < 0) ? RTSP_UDP_SINK_MAX_PAYLOAD_SIZE_DEFAULT : this->rtspUdpSinkMaxPayloadSize;
  this->rtspUdpPortRangeStart = (this->rtspUdpPortRangeStart <= 1024) ? RTSP_UDP_PORT_RANGE_START_DEFAULT : this->rtspUdpPortRangeStart;
  this->rtspUdpPortRangeEnd = (this->rtspUdpPortRangeEnd < this->rtspUdpPortRangeStart) ? min(65535, this->rtspUdpPortRangeStart + 1000) : min(65535, this->rtspUdpPortRangeEnd);
  this->rtspTeardownRequestMaximumCount = (this->rtspTeardownRequestMaximumCount <= 0) ? RTSP_TEARDOWN_REQUEST_MAXIMUM_COUNT_DEFAULT : this->rtspTeardownRequestMaximumCount;
  this->rtspTeardownRequestTimeout = (this->rtspTeardownRequestTimeout < 0) ? RTSP_TEARDOWN_REQUEST_TIMEOUT_DEFAULT : this->rtspTeardownRequestTimeout;
  this->openConnetionMaximumAttempts = (this->openConnetionMaximumAttempts < 0) ? RTSP_OPEN_CONNECTION_MAXIMUM_ATTEMPTS_DEFAULT : this->openConnetionMaximumAttempts;

  this->rtspScheduler = RtspTaskScheduler::createNew();
  this->rtspEnvironment = BasicUsageEnvironment::createNew(*this->rtspScheduler);

  result |= (this->rtspScheduler == NULL);
  result |= (this->rtspEnvironment == NULL);

  return (result == STATUS_OK) ? STATUS_OK : STATUS_ERROR;
}
Beispiel #4
0
void CWorkspacePreferencesDialog::OnOK()
{
#if 0
	if (GetFocus() == GetDlgItem(IDC_WORKSPACE_SIZE))
	{
		GetDlgItem(IDOK)->SetFocus();
	}

	else
#endif
	if (OnValidateWorkspaceSize(0, 0L))
	{
	/* Check that the number they typed is valid. */
		DWORD dwAvailableSize = Util::GetAvailableDiskSpace(m_csWorkspaceDirectory);

		dwAvailableSize += m_cache->get_physical_size();

		if (m_dwWorkspaceSize > dwAvailableSize)
		{
		/*
		// This is not a good idea.
		// Inform the user that a lower number is required.
		*/

			GetConfiguration()->MessageBox(IDS_ErrWorkspaceExceedsDiskSpace, 0,
													 MB_OK | MB_ICONEXCLAMATION);
			GetDlgItem(IDC_WORKSPACE_SIZE)->SetFocus();
		}
		else
		{
		/* Go home. */
			CPmwDialog::OnOK();
		}
	}
}
Beispiel #5
0
VSIOSSHandleHelper* VSIOSSHandleHelper::BuildFromURI( const char* pszURI,
                                                      const char* pszFSPrefix,
                                                      bool bAllowNoObject,
                                                      CSLConstList papszOptions )
{
    CPLString osSecretAccessKey;
    CPLString osAccessKeyId;
    if( !GetConfiguration(papszOptions, osSecretAccessKey, osAccessKeyId) )
    {
        return nullptr;
    }

    const CPLString osEndpoint = CSLFetchNameValueDef(papszOptions,
        "OSS_ENDPOINT",
        CPLGetConfigOption("OSS_ENDPOINT", "oss-us-east-1.aliyuncs.com"));
    CPLString osBucket;
    CPLString osObjectKey;
    if( pszURI != nullptr && pszURI[0] != '\0' &&
        !GetBucketAndObjectKey(pszURI, pszFSPrefix, bAllowNoObject,
                               osBucket, osObjectKey) )
    {
        return nullptr;
    }
    const bool bUseHTTPS = CPLTestBool(CPLGetConfigOption("OSS_HTTPS", "YES"));
    const bool bIsValidNameForVirtualHosting =
        osBucket.find('.') == std::string::npos;
    const bool bUseVirtualHosting = CPLTestBool(
        CPLGetConfigOption("OSS_VIRTUAL_HOSTING",
                           bIsValidNameForVirtualHosting ? "TRUE" : "FALSE"));
    return new VSIOSSHandleHelper(osSecretAccessKey, osAccessKeyId,
                                 osEndpoint,
                                 osBucket, osObjectKey, bUseHTTPS,
                                 bUseVirtualHosting);
}
void VideoFormats::getProfileLevel(
        ResolutionType type, size_t index,
        ProfileType *profile, LevelType *level) const{
    CHECK_LT(type, kNumResolutionTypes);
    CHECK(GetConfiguration(type, index, NULL, NULL, NULL, NULL));

    int i, bestProfile = -1, bestLevel = -1;

    for (i = 0; i < kNumProfileTypes; ++i) {
        if (mConfigs[type][index].profile & (1ul << i)) {
            bestProfile = i;
        }
    }

    for (i = 0; i < kNumLevelTypes; ++i) {
        if (mConfigs[type][index].level & (1ul << i)) {
            bestLevel = i;
        }
    }

    if (bestProfile == -1 || bestLevel == -1) {
        ALOGE("Profile or level not set for resolution type %d, index %d",
              type, index);
        bestProfile = PROFILE_CBP;
        bestLevel = LEVEL_31;
    }

    *profile = (ProfileType) bestProfile;
    *level = (LevelType) bestLevel;
}
bool VideoFormats::isResolutionEnabled(
        ResolutionType type, size_t index) const {
    CHECK_LT(type, kNumResolutionTypes);
    CHECK(GetConfiguration(type, index, NULL, NULL, NULL, NULL));

    return mResolutionEnabled[type] & (1ul << index);
}
Beispiel #8
0
int main()
{
    const char *configuration = GetConfiguration();
    printf("Configuration is '%s'\n", configuration);

    return 0;
}
Beispiel #9
0
VOID CCardView::set_card_panel_view(SHORT new_panel)
{
/*
// If this is a demo card back, then we don't allow editing.
*/
   if ((new_panel == CARD_PANEL_Back) && !GetConfiguration()->SupportsCardBack())
   {
      return;
   }

#if 1
   BeforePageChange();
   SetPanel(new_panel);
#else
/*
// Get the document and build the undo/redo command for this.
*/

   CPmwDoc* pDoc = GetDocument();

   CCmdCardPanel* pCommand = new CCmdCardPanel(IDCmd_Panel[new_panel+1]);

   if (pCommand->Snapshot(this, pDoc->get_current_panel(), new_panel))
   {
      pDoc->AddCommand(pCommand);
   }
   else
   {
      delete pCommand;

   /* Fall through. */
//    SetPanel(new_panel);
   }
#endif
}
Beispiel #10
0
REGRESULT CRegisterDLL::IsBonusEnabled(void)
{
#ifdef LOCALIZE
	if (GetConfiguration()->RemoveRegistration())
		return REGRESULT_AlreadyRegistered;
#endif
	return RegSendCommand(REGCOMMAND_IsBonusEnabled);
}
Beispiel #11
0
REGRESULT CRegisterDLL::RegisterBonus(void)
{
#ifdef LOCALIZE
	if (GetConfiguration()->RemoveRegistration())
		return TRUE;
#endif
	return RegSendCommand(REGCOMMAND_Register " /C /A");
}
status_t ArpAccentRandomizerFilter::Configure(ArpVectorI<BView*>& panels)
{
	BMessage config;
	status_t err = GetConfiguration(&config);
	if (err != B_OK) return err;
	panels.push_back(new ArpAccentRandomizerFilterSettings(mHolder, config));
	return B_OK;
}
Beispiel #13
0
status_t ArpUncertainChorusFilter::Configure(ArpVectorI<BView*>& panels)
{
    BMessage config;
    status_t err = GetConfiguration(&config);
    if (err != B_OK) return err;
    panels.push_back(new ArpUncertainChorusSettings(mHolder, config));
    return B_OK;
}
Beispiel #14
0
status_t ArpControllerRangeFilter::Configure(ArpVectorI<BView*>& panels)
{
	BMessage config;
	status_t err = GetConfiguration(&config);
	if (err != B_OK) return err;
	panels.push_back(new _ControllerRangeSettings(mHolder, config));
	return B_OK;
}
Beispiel #15
0
int CAEN_V814::Config(BoardConfig *bC)
{
  Board::Config(bC);
  //Set All Configuration to 0
  for (unsigned int i=0;i<CAEN_V814_CHANNELS;++i)
    GetConfiguration()->chThreshold[i]=0;
  //here the parsing of the xmlnode...
  GetConfiguration()->baseAddress=Configurator::GetInt( bC->getElementContent("baseAddress"));
  GetConfiguration()->patternMask=Configurator::GetInt( bC->getElementContent("patternMask"));
  GetConfiguration()->outputWidth=Configurator::GetInt( bC->getElementContent("outputWidth"));
  GetConfiguration()->majorityThreshold=Configurator::GetInt( bC->getElementContent("majorityThreshold"));
  GetConfiguration()->commonThreshold=Configurator::GetInt( bC->getElementContent("commonThreshold"));


  //Now threshold per channel if they exist in configuration
  char chThresholdKey[100];
  for (unsigned int i=0;i<CAEN_V814_CHANNELS;++i)
    {
      sprintf(chThresholdKey,"ch%dThreshold",i);
      if (bC->getElementContent(chThresholdKey) == "NULL")
	continue;
      GetConfiguration()->chThreshold[i]==(int)Configurator::GetInt( bC->getElementContent(chThresholdKey) );
    }

  return 0;
}
Beispiel #16
0
void CoreLoad()
{
  bool SessionList = false;
  std::unique_ptr<THierarchicalStorage> SessionsStorage(GetConfiguration()->CreateStorage(SessionList));
  THierarchicalStorage * ConfigStorage = nullptr;
  std::unique_ptr<THierarchicalStorage> ConfigStorageAuto;
  if (!SessionList)
  {
    // can reuse this for configuration
    ConfigStorage = SessionsStorage.get();
  }
  else
  {
    ConfigStorageAuto.reset(GetConfiguration()->CreateConfigStorage());
    ConfigStorage = ConfigStorageAuto.get();
  }

  assert(GetConfiguration() != nullptr);

  try
  {
    GetConfiguration()->Load(ConfigStorage);
  }
  catch (Exception & E)
  {
    ShowExtendedException(&E);
  }

  // should be noop, unless exception occurred above
  ConfigStorage->CloseAll();

  StoredSessions = new TStoredSessionList();

  try
  {
    if (SessionsStorage->OpenSubKey(GetConfiguration()->GetStoredSessionsSubKey(), false))
    {
      StoredSessions->Load(SessionsStorage.get());
    }
  }
  catch (Exception & E)
  {
    ShowExtendedException(&E);
  }
}
Beispiel #17
0
void CAddonProgressDialog::OnCancel()
{
	// make sure the user really wants to cancel the installation
	
	if (GetConfiguration()->MessageBox(IDS_ADDON_CONFIRM_ABORT, 0, MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION) == IDYES)
	{
		m_fIsAborted = TRUE;
	}
}
void VideoFormats::setProfileLevel(
        ResolutionType type, size_t index,
        ProfileType profile, LevelType level) {
    CHECK_LT(type, kNumResolutionTypes);
    CHECK(GetConfiguration(type, index, NULL, NULL, NULL, NULL));

    mConfigs[type][index].profile = (1ul << profile);
    mConfigs[type][index].level = (1ul << level);
}
Beispiel #19
0
static long OpenWinSCPKey(HKEY Key, const char * SubKey, HKEY * Result, bool CanCreate)
{
  long R;
  assert(GetConfiguration() != nullptr);

  assert(Key == HKEY_CURRENT_USER);
  USEDPARAM(Key);

  UnicodeString RegKey = SubKey;
  UnicodeString OriginalPuttyRegistryStorageKey(_T(PUTTY_REG_POS));
  intptr_t PuttyKeyLen = OriginalPuttyRegistryStorageKey.Length();
  assert(RegKey.SubString(1, PuttyKeyLen) == OriginalPuttyRegistryStorageKey);
  RegKey = RegKey.SubString(PuttyKeyLen + 1, RegKey.Length() - PuttyKeyLen);
  if (!RegKey.IsEmpty())
  {
    assert(RegKey[1] == L'\\');
    RegKey.Delete(1, 1);
  }

  if (RegKey.IsEmpty())
  {
    *Result = static_cast<HKEY>(nullptr);
    R = ERROR_SUCCESS;
  }
  else
  {
    // we expect this to be called only from verify_host_key() or store_host_key()
    assert(RegKey == L"SshHostKeys");

    std::unique_ptr<THierarchicalStorage> Storage(GetConfiguration()->CreateConfigStorage());
    Storage->SetAccessMode((CanCreate ? smReadWrite : smRead));
    if (Storage->OpenSubKey(RegKey, CanCreate))
    {
      *Result = reinterpret_cast<HKEY>(Storage.release());
      R = ERROR_SUCCESS;
    }
    else
    {
      R = ERROR_CANTOPEN;
    }
  }

  return R;
}
Beispiel #20
0
bool SeqPrefWin::QuitRequested()
{
	if( !inherited::QuitRequested() ) return false;
	BMessage	config;
	if( GetConfiguration( &config ) == B_OK ) {
		if( seq_is_quitting() ) seq_app->AddShutdownMessage( "window_settings", &config );
		else seq_app->SetAuxiliaryWindowSettings(SeqApplication::PREF_WIN_INDEX, config);
	}
	return true;
}
bool SeqPhrasePropertyWindow::QuitRequested()
{
	if (!inherited::QuitRequested() ) return false;
	BMessage	config;
	if (GetConfiguration(&config) == B_OK) {
		if (seq_is_quitting()) seq_app->AddShutdownMessage("window_settings", &config);
//		else seq_app->SetEditDeviceSettings(config);
	}
	return true;
}
Beispiel #22
0
void DeleteConfiguration()
{
  static bool ConfigurationDeleted = false;
  if (!ConfigurationDeleted)
  {
    TConfiguration * Conf = GetConfiguration();
    SAFE_DESTROY(Conf);
    ConfigurationDeleted = true;
  }
}
Beispiel #23
0
int main()
{
    const char *bitSize = GetBitSize();
    const char *config = GetConfiguration();
    printf("Hello world, C, in %s (%s)\n", bitSize, config);
    printf("From library, '%s'\n", libraryFunction());
    printf("From library2, '%d'\n", library2Function());

    return 0;
}
Beispiel #24
0
void CSmartFieldsDialog::OnSender()
{
/*
// Finish up any current edit.
*/

	if (m_pList->Editing())
	{
		m_pList->FinishEdit();
		GetDlgItem(IDC_SENDER)->SetFocus();
	}
	
/*
// Make sure the configuration supports address books.
*/

	if (!GetConfiguration()->SupportsAddressBook())
	{
		return;
	}

	// Allow the user to edit the sender record for the current address book.
   
   if (m_pDoc->EditSender())
   {
		// Reset all the sender fields back to their database values.
		
		int nItem = 0;
		int nItems = m_pList->GetCount();
		
		while (nItem < nItems)
		{
			CSmartFieldListBoxItem* pItem = (CSmartFieldListBoxItem*)m_pList->GetItemData(nItem);
			if (pItem != NULL)
			{
				CMacro* pMacro = pItem->Macro();
				
				if (pMacro != NULL)
				{
					if (pMacro->MacroType() == CMacro::MACRO_TYPE_Sender)
					{
						// We have a sender field, reset it back to its database value.
						pMacro->MacroValueType(CMacro::VALUE_TYPE_Field);
						pMacro->Value("");
					}
				}
			}
			
			nItem++;
		}
		
		UpdateFields(TRUE);
		m_pList->Invalidate();
   }
}
Beispiel #25
0
void CInstallRegistrationDialog::OnCancel()
{
	/*
	// Confirm that the user really does want to cancel.
	*/
	
	if (GetConfiguration()->MessageBox(IDS_ConfirmExitInstallation, 0, MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION) == IDYES)
	{
		CPmwDialog::OnCancel();
	}
}
Beispiel #26
0
long reg_close_winscp_key(HKEY Key)
{
  DebugAssert(GetConfiguration() != nullptr);

  THierarchicalStorage * Storage = reinterpret_cast<THierarchicalStorage *>(Key);
  if (Storage != nullptr)
  {
    SAFE_DESTROY_EX(THierarchicalStorage, Storage);
  }

  return ERROR_SUCCESS;
}
void ArpRemoteTerminal::TermReset(bool hard)
{
	ArpD(cdb << ADH << "ArpRemoteTerminal: Reset hard=" << hard << endl);
	inherited::TermReset(hard);
	if( HaveWatchers() ) {
		BMessage config;
		if( GetConfiguration(&config) == B_NO_ERROR ) {
			ArpD(cdb << ADH << "Reporting change: " << config << endl);
			ReportChange(&config);
		}
	}
}
bool SeqManageRosterWindow::QuitRequested()
{
	if (!inherited::QuitRequested() ) return false;
	BMessage	config;
	if (GetConfiguration(&config) == B_OK) {
		if (seq_is_quitting()) seq_app->AddShutdownMessage("window_settings", &config);
		else seq_app->SetAuxiliaryWindowSettings(WindowSettingsIndex(), config);
	}
	AmFileRoster*	roster = Roster();
	if (roster) roster->RemoveObserver(this);

	return true;
}
void VideoFormats::enableResolutionUpto(
        ResolutionType type, size_t index,
        ProfileType profile, LevelType level) {
    size_t width, height, fps, score;
    bool interlaced;
    if (!GetConfiguration(type, index, &width, &height,
            &fps, &interlaced)) {
        ALOGE("Maximum resolution not found!");
        return;
    }
    score = width * height * fps * (!interlaced + 1);
    for (size_t i = 0; i < kNumResolutionTypes; ++i) {
        for (size_t j = 0; j < 32; j++) {
            if (GetConfiguration((ResolutionType)i, j,
                    &width, &height, &fps, &interlaced)
                    && score >= width * height * fps * (!interlaced + 1)) {
                setResolutionEnabled((ResolutionType)i, j);
                setProfileLevel((ResolutionType)i, j, profile, level);
            }
        }
    }
}
Beispiel #30
0
//
// Save the toolbar states
//
void ToolManager::WriteConfig()
{
   if( !gPrefs )
   {
      return;
   }

   wxString oldpath = gPrefs->GetPath();
   int ndx;

   // Change to the bar root
   gPrefs->SetPath( wxT("/GUI/ToolBars") );

   // Save state of each bar
   for( ndx = 0; ndx < ToolBarCount; ndx++ )
   {
      ToolBar *bar = mBars[ ndx ].get();

      // Change to the bar subkey
      gPrefs->SetPath( bar->GetSection() );

      // Search both docks for toolbar order
      bool to = mTopDock->GetConfiguration().Contains( bar );
      bool bo = mBotDock->GetConfiguration().Contains( bar );

      // Save
      gPrefs->Write( wxT("Dock"), (int) (to ? TopDockID : bo ? BotDockID : NoDockID ));
      auto dock = to ? mTopDock : bo ? mBotDock : nullptr;
      ToolBarConfiguration::Write
         (dock ? &dock->GetConfiguration() : nullptr, bar);

      wxPoint pos( -1, -1 );
      wxSize sz = bar->GetSize();
      if( !bar->IsDocked() && bar->IsPositioned() )
      {
         pos = bar->GetParent()->GetPosition();
         sz = bar->GetParent()->GetSize();
      }
      gPrefs->Write( wxT("X"), pos.x );
      gPrefs->Write( wxT("Y"), pos.y );
      gPrefs->Write( wxT("W"), sz.x );
      gPrefs->Write( wxT("H"), sz.y );

      // Change back to the bar root
      gPrefs->SetPath( wxT("..") );
   }

   // Restore original config path
   gPrefs->SetPath( oldpath );
   gPrefs->Flush();
}