void VideoRegionsConfigDialog::updateUI() { StringVector *videoClasses = m_config->getVideoClassNames(); std::vector<Rect> *videoRects = m_config->getVideoRects(); StringStorage textAreaData; TCHAR endLine[3] = {13, 10, 0}; { AutoLock al(m_config); textAreaData.setString(_T("")); for (size_t i = 0; i < videoClasses->size(); i++) { textAreaData.appendString(videoClasses->at(i).getString()); textAreaData.appendString(&endLine[0]); } TCHAR buffer[32]; _ltot(m_config->getVideoRecognitionInterval(), &buffer[0], 10); m_videoRecognitionInterval.setText(buffer); } m_videoClasses.setText(textAreaData.getString()); { AutoLock al(m_config); textAreaData.setString(_T("")); for (size_t i = 0; i < videoRects->size(); i++) { Rect r = videoRects->at(i); StringStorage s; RectSerializer::toString(&r, &s); textAreaData.appendString(s.getString()); textAreaData.appendString(&endLine[0]); } } m_videoRects.setText(textAreaData.getString()); }
void DownloadOperation::tryCalcInputFilesSize() { FileInfoList *fil = m_toCopy; while (fil != NULL) { if (fil->getFileInfo()->isDirectory()) { StringStorage pathNoRoot; StringStorage pathToFile; fil->getAbsolutePath(&pathNoRoot, _T('/')); pathToFile.setString(m_pathToSourceRoot.getString()); if (!pathToFile.endsWith(_T('/'))) { pathToFile.appendString(_T("/")); } pathToFile.appendString(pathNoRoot.getString()); m_foldersToCalcSizeLeft++; m_sender->sendFolderSizeRequest(pathToFile.getString()); } else { m_totalBytesToCopy += fil->getFileInfo()->getSize(); } fil = fil->getNext(); } }
void ControlClient::getServerInfoMsgRcvd() { bool acceptFlag = false; bool serviceFlag = false; StringStorage logPath; StringStorage statusText; TvnServerInfo info; TvnServer::getInstance()->getServerInfo(&info); StringStorage status; { AutoLock al(&m_tcpDispValuesMutex); if (m_tcpDispId != 0) { status.format(_T("[ID = %u] %s"), m_tcpDispId, info.m_statusText.getString()); } else { status.setString(info.m_statusText.getString()); } } m_gate->writeUInt32(ControlProto::REPLY_OK); m_gate->writeUInt8(info.m_acceptFlag ? 1 : 0); m_gate->writeUInt8(info.m_serviceFlag ? 1 : 0); m_gate->writeUTF8(status.getString()); }
void RfbInitializer::sendDesktopName() { StringStorage deskName; if (!Environment::getComputerName(&deskName)) { deskName.setString(DefaultNames::DEFAULT_COMPUTER_NAME); } AnsiStringStorage ansiName(&deskName); unsigned int dnLen = (unsigned int)ansiName.getLength(); _ASSERT(dnLen == ansiName.getLength()); m_output->writeUInt32(dnLen); m_output->writeFully(ansiName.getString(), dnLen); }
void RfbInitializer::sendDesktopName() { StringStorage deskName; if (!Environment::getComputerName(&deskName)) { deskName.setString(_T("TightVNC Server")); } size_t dnLen = deskName.getLength(); char *ansiName = new char[dnLen + 1]; deskName.toAnsiString(ansiName, dnLen + 1); m_output->writeUInt32(dnLen); m_output->writeFully(ansiName, dnLen); }
void DesktopServerProto::readConfigSettings(BlockingGate *gate) { ServerConfig *srvConf = Configurator::getInstance()->getServerConfig(); // Log srvConf->setLogLevel(gate->readUInt32()); // Polling srvConf->setPollingInterval(gate->readUInt32()); srvConf->setGrabTransparentWindowsFlag(gate->readUInt8() != 0); srvConf->blockLocalInput(gate->readUInt8() != 0); srvConf->setLocalInputPriority(gate->readUInt8() != 0); srvConf->setLocalInputPriorityTimeout(gate->readUInt32()); srvConf->enableRemovingDesktopWallpaper(gate->readUInt8() != 0); // Receive video class names AutoLock al(srvConf); size_t stringCount = gate->readUInt32(); StringStorage tmpString; for (size_t i = 0; i < stringCount; i++) { gate->readUTF8(&tmpString); srvConf->getVideoClassNames()->push_back(tmpString); } // Receive video rects stringCount = gate->readUInt32(); tmpString.setString(_T("")); for (size_t i = 0; i < stringCount; i++) { gate->readUTF8(&tmpString); srvConf->getVideoRects()->push_back(RectSerializer::toRect(&tmpString)); } // Receive video recognition interval srvConf->setVideoRecognitionInterval(gate->readUInt32()); // Receive socket timeout srvConf->setIdleTimeout(gate->readUInt32()); }
UINT64 UploadOperation::getInputFilesSize() { UINT64 totalFilesSize = 0; FileInfoList *fil = m_toCopy; while (fil != NULL) { StringStorage pathNoRoot; StringStorage pathToFile; fil->getAbsolutePath(&pathNoRoot, _T('\\')); pathToFile.setString(m_pathToSourceRoot.getString()); pathToFile.appendString(_T("\\")); pathToFile.appendString(pathNoRoot.getString()); totalFilesSize += getFileSize(pathToFile.getString()); fil = fil->getNext(); } return totalFilesSize; }
void AdministrationConfigDialog::updateUI() { m_logLevel.setSignedInt(m_config->getLogLevel()); m_useControlAuth.check(m_config->isControlAuthEnabled()); ConfigDialog *configDialog = (ConfigDialog *)m_parentDialog; StringStorage logPath; m_config->getLogFilePath(&logPath); if (logPath.isEmpty()) { logPath.setString(StringTable::getString(IDS_LOGPATH_UNAVALIABLE)); m_openLogPathButton.setEnabled(false); m_logPathTB.setEnabled(false); } m_logPathTB.setText(logPath.getString()); StringStorage folder; getFolderName(logPath.getString(), &folder); HANDLE hDoc = CreateFile(folder.getString(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, 0); if (hDoc == INVALID_HANDLE_VALUE) { m_openLogPathButton.setEnabled(false); } else { CloseHandle(hDoc); m_openLogPathButton.setEnabled(true); } for (int i = 0; i < 5; i++) { m_shared[0].check(false); } if (m_config->isAlwaysShared() && !m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) { m_shared[0].check(true); } if (!m_config->isAlwaysShared() && m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) { m_shared[1].check(true); } if (!m_config->isAlwaysShared() && m_config->isNeverShared() && m_config->isDisconnectingExistingClients()) { m_shared[2].check(true); } if (!m_config->isAlwaysShared() && !m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) { m_shared[3].check(true); } if (!m_config->isAlwaysShared() && !m_config->isNeverShared() && m_config->isDisconnectingExistingClients()) { m_shared[4].check(true); } for (int i = 0; i < 3; i++) { m_disconnectAction[i].check(false); } switch (m_config->getDisconnectAction()) { case ServerConfig::DA_DO_NOTHING: m_disconnectAction[0].check(true); break; case ServerConfig::DA_LOCK_WORKSTATION: m_disconnectAction[1].check(true); break; case ServerConfig::DA_LOGOUT_WORKSTATION: m_disconnectAction[2].check(true); break; } m_logForAllUsers.check(m_config->isSaveLogToAllUsersPathFlagEnabled()); if (m_config->hasControlPassword()) { unsigned char cryptedPassword[8]; m_config->getControlPassword(cryptedPassword); m_cpControl->setCryptedPassword((char *)cryptedPassword); } m_cpControl->setEnabled(m_config->isControlAuthEnabled()); }