当前位置: 首页>>代码示例>>C++>>正文


C++ StringStorage::fromAnsiString方法代码示例

本文整理汇总了C++中StringStorage::fromAnsiString方法的典型用法代码示例。如果您正苦于以下问题:C++ StringStorage::fromAnsiString方法的具体用法?C++ StringStorage::fromAnsiString怎么用?C++ StringStorage::fromAnsiString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringStorage的用法示例。


在下文中一共展示了StringStorage::fromAnsiString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onRequest

void ClipboardExchange::onRequest(UINT32 reqCode, RfbInputGate *input)
{
  switch (reqCode) {
  case ClientMsgDefs::CLIENT_CUT_TEXT:
    input->readUInt8(); 
    input->readUInt16(); 
    {
      UINT32 length = input->readUInt32();
      char *receivedText = new char[length + 1];
      try {
        input->readFully(receivedText, length);
      } catch (...) {
        delete[] receivedText;
        throw;
      }
      if (!m_viewOnly) {
        receivedText[length] = '\0';
        StringStorage clipText;
        clipText.fromAnsiString(receivedText);
        delete[] receivedText;
        m_desktop->setNewClipText(&clipText);
      } else {
        delete[] receivedText;
      }
    }
    break;
  default:
    StringStorage errMess;
    errMess.format(_T("Unknown %d protocol code received"), (int)reqCode);
    throw Exception(errMess.getString());
    break;
  }
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:33,代码来源:ClipboardExchange.cpp

示例2: authFromFile

void ControlMessage::authFromFile()
{
  File passFile(m_passwordFile.getString());
  FileInputStream passInput(&passFile);
  char ansiPassword[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  passInput.read(ansiPassword, 8);
  for (int i = 0; i < 8; i++) {
    if (ansiPassword[i] == '\r' || ansiPassword[i] == '\n') {
      ansiPassword[i] = '\0';
    }
  }
  StringStorage password;
  password.fromAnsiString(ansiPassword);
  ControlAuth auth(m_gate, password.getString());
  send();
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:16,代码来源:ControlMessage.cpp

示例3: getServerInfo

void TvnServer::getServerInfo(TvnServerInfo *info)
{
  bool rfbServerListening = true;
  {
    AutoLock l(&m_mutex);
    rfbServerListening = m_rfbServer != 0;
  }

  StringStorage statusString;

  bool vncAuthEnabled = m_config->isUsingAuthentication();
  bool noVncPasswords = !m_config->hasPrimaryPassword() && !m_config->hasReadOnlyPassword();
  bool vncPasswordsError = vncAuthEnabled && noVncPasswords;

  if (rfbServerListening) {
    if (vncPasswordsError) {
      statusString = StringTable::getString(IDS_NO_PASSWORDS_SET);
    } else {
      char localAddressString[1024];
      getLocalIPAddrString(localAddressString, 1024);

      statusString.fromAnsiString(localAddressString);

      if (!vncAuthEnabled) {
        statusString.appendString(StringTable::getString(IDS_NO_AUTH_STATUS));
      } 
    } 
  } else {
    statusString = StringTable::getString(IDS_SERVER_NOT_LISTENING);
  } 

  UINT stringId = m_runAsService ? IDS_TVNSERVER_SERVICE : IDS_TVNSERVER_APP;

  info->m_statusText.format(_T("%s - %s"),
                            StringTable::getString(stringId),
                            statusString.getString());
  info->m_acceptFlag = rfbServerListening && !vncPasswordsError;
  info->m_serviceFlag = m_runAsService;
}
开发者ID:kaseya,项目名称:tightvnc2,代码行数:39,代码来源:TvnServer.cpp

示例4: authFromRegistry

void ControlMessage::authFromRegistry()
{
  HKEY rootKey = m_forService ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
  RegistrySettingsManager sm(rootKey, _T("Software\\TightVNC\\Server\\"), 0);

  unsigned char hidePassword[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  unsigned char plainPassword[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  size_t passSize = sizeof(hidePassword);

  if (sm.getBinaryData(_T("ControlPassword"),
                       hidePassword,
                       &passSize)) {
    VncPassCrypt::getPlainPass(plainPassword, hidePassword);

    StringStorage password;
    password.fromAnsiString((char *)plainPassword);
    memset(plainPassword, 0, sizeof(plainPassword));
    ControlAuth auth(m_gate, password.getString());

    send();
  } else {
  }
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:23,代码来源:ControlMessage.cpp

示例5: processRequest

void HttpRequestHandler::processRequest()
{
  HttpRequest httpRequest(m_dataInput);

  httpRequest.readHeader();

  StringStorage request;

  request.fromAnsiString(httpRequest.getRequest());

  if (!httpRequest.parseHeader()) {
    Log::warning(_T("invalid http request from %s"), m_peerHost.getString());
    return ;
  }

  request.replaceChar(_T('\n'), _T(' '));
  request.replaceChar(_T('\t'), _T(' '));

  Log::message(_T("\"%s\" from %s"), request.getString(), m_peerHost.getString());

  HttpReply reply(m_dataOutput);

  bool pageFound = false;

  if (strcmp(httpRequest.getFilename(), "/") == 0) {

    CharString paramsString("\n");

    bool isAppletArgsValid = true;

    bool paramsInUrlIsEnabled = Configurator::getInstance()->getServerConfig()->isAppletParamInUrlEnabled();

    if (httpRequest.hasArguments() && paramsInUrlIsEnabled) {
      ArgList *args = httpRequest.getArguments();

      for (size_t i = 0; i < args->getCount(); i++) {
        const char *key = args->getKey(i);

        AppletParameter parameter(key, args->getValue(key));

        if (!parameter.isValid()) {
          isAppletArgsValid = false;
          break;
        }

        paramsString.format("%s%s", paramsString.getString(),
                            parameter.getFormattedString());
      } 
    } 

    reply.send200();

    if (!isAppletArgsValid) {
      m_dataOutput->writeFully(HTTP_MSG_BADPARAMS, strlen(HTTP_MSG_BADPARAMS));
    } else {
      CharString page;

      StringStorage computerName(_T("TightVNC Server"));

      Environment::getComputerName(&computerName);

      size_t computerNameANSILength = computerName.getLength() + 1;

      char *computerNameANSI = new char[computerNameANSILength];

      computerName.toAnsiString(computerNameANSI, computerNameANSILength);

      page.format(HTTP_INDEX_PAGE_FORMAT,
                  computerNameANSI,
                  Configurator::getInstance()->getServerConfig()->getRfbPort(),
                  paramsString.getString());

      delete[] computerNameANSI;

      m_dataOutput->writeFully(page.getString(), page.getLength());
    } 

    pageFound = true;
  } else if ((strcmp(httpRequest.getFilename(), "/VncViewer.jar") == 0)) {
    reply.send200();
    m_dataOutput->writeFully(VNC_VIEWER_JAR_BODY, sizeof(VNC_VIEWER_JAR_BODY));

    pageFound = true;
  } 

  if (!pageFound) {
    reply.send404();
  }
}
开发者ID:kaseya,项目名称:tightvnc2,代码行数:89,代码来源:HttpRequestHandler.cpp


注:本文中的StringStorage::fromAnsiString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。