Example #1
0
void CIISxpressHttpModule::OpenLog(IHttpContext* pHttpContext)
{
	if (pHttpContext != NULL && m_Config.GetLoggingLevel() >= IISXPRESS_LOGGINGLEVEL_BASIC)
	{
		CAtlString installPath;
		m_Config.GetInstallPath(installPath);

		if (installPath.GetLength() > 0)
		{		
			CPathT<CAtlString> LogPath(installPath);			
			LogPath.Append(_T("\\Logs"));

			if (LogPath.IsDirectory() == FALSE)
			{
				::CreateDirectory(LogPath, NULL);	
			}

			CAtlString sLogFilePrefix;
			sLogFilePrefix.LoadString(IDS_LOGFILENAMEPREFIX);

			CAtlString sAppName;
			if (GetAppPoolName(pHttpContext, sAppName) == true)
			{
				sLogFilePrefix += sAppName;
				sLogFilePrefix += "-";
			}		

			m_Log.Init(LogPath, sLogFilePrefix, _T("log"));		
		}
	}
}
Example #2
0
void CChatLog::adjust(const TCHAR* format, ...)
{
	CAtlString cs;
	va_list ap;

	va_start(ap, format);
	cs.FormatV(format, ap);
	va_end(ap);

	write(reinterpret_cast<const void*>(static_cast<const TCHAR*>(cs)), cs.GetLength());
}
Example #3
0
/*
 * Converts the specified (reply) string into a Variant value.
 * If the string contains tab characters ('\t), the string is
 * considered to contain an array of values.
 */
CComVariant CMELCommand::MakeVariant(const CAtlString& strText)
{
	int tabCount = 0;
	int tabPos = 0;
	while (tabPos < strText.GetLength()) {
		tabPos = strText.Find(L'\t', tabPos);
		if (tabPos < 0)
			break;
		++tabCount;
		++tabPos;
	}
	if (!tabCount) {
		return MakeVariantNotArray(strText);
	}
	CComSafeArray<VARIANT> safeArray;
	safeArray.Create(tabCount + 1);
	int curPos = 0;
	int index = 0;
	tabPos = strText.Find(L'\t');
	for (;;) {
		CAtlString strElement;
		if (tabPos > curPos) {
			strElement = strText.Mid(curPos, tabPos - curPos).Trim();
		}
		safeArray[index++] = MakeVariantNotArray(strElement);
		curPos = tabPos + 1;
		if (curPos == strText.GetLength()) {
			safeArray[index] = CComVariant(L"");
			break;
		}
		tabPos = strText.Find(L'\t', curPos);
		if (tabPos < 0) {
			safeArray[index] = MakeVariant(strText.Mid(curPos).Trim());
			break;
		}
	}
	return CComVariant(safeArray);
}
void CTedTransformDialog::PopulateCategory(DMOCategory& category) 
{
    TVINSERTSTRUCT treeInserter;
    treeInserter.hParent = TVI_ROOT;
    treeInserter.hInsertAfter = TVI_FIRST;

    CAtlString strName = LoadAtlString(category.m_nID);
    TVITEM item;
    item.mask = TVIF_TEXT;
    item.pszText = strName.GetBuffer();
    item.cchTextMax = strName.GetLength();

    treeInserter.item = item;
    HTREEITEM hBaseItem = (HTREEITEM) TreeView_InsertItem(m_hList, &treeInserter);

    assert(hBaseItem != NULL);

    treeInserter.hParent = hBaseItem;
    item.mask = TVIF_TEXT | TVIF_PARAM;

    DMO_PARTIAL_MEDIATYPE mediaType;
    CComPtr<IEnumDMO> spDMOList;

    mediaType.type = GUID_NULL;
    mediaType.subtype = GUID_NULL;
    
    IMFActivate** ppActivates = NULL;
    UINT32 cMFTs = 0;
    ::MFTEnumEx(category.m_GUID, MFT_ENUM_FLAG_ALL, NULL, NULL, &ppActivates, &cMFTs);

    for(DWORD i = 0; i < cMFTs; i++)
    {
        m_Activates.Add(ppActivates[i]);

        LPWSTR pszName = NULL;
        ppActivates[i]->GetAllocatedString(MFT_FRIENDLY_NAME_Attribute, &pszName, NULL);
        
        m_strNames.Add(CAtlStringW(pszName));
        item.pszText = m_strNames.GetAt(m_strNames.GetCount() - 1).GetBuffer();
        item.lParam = (LPARAM)  m_Activates.GetCount() - 1;

        treeInserter.item = item;

        TreeView_InsertItem(m_hList, &treeInserter);
        
        CoTaskMemFree(pszName);
    }

    CoTaskMemFree(ppActivates);
}
HRESULT 
CWlanManager::SetHostedNetworkKey(
    CAtlString& strKey
    )
{
    HRESULT hr = S_OK;
    DWORD dwError = ERROR_SUCCESS;
    UCHAR strKeyBuf[WLAN_MAX_NAME_LENGTH];
    DWORD dwKeyBufLen = WLAN_MAX_NAME_LENGTH;

    dwError = ConvertPassPhraseKeyStringToBuffer(
                strKey,
                strKey.GetLength(),
                DOT11_AUTH_ALGO_RSNA_PSK,
                strKeyBuf,
                &dwKeyBufLen
                );

    BAIL_ON_WIN32_ERROR(dwError, hr);

    if (0 == dwKeyBufLen)
    {
        BAIL_ON_WIN32_ERROR(ERROR_INVALID_PARAMETER, hr);
    }

    dwError = WlanHostedNetworkSetSecondaryKey(
                m_WlanHandle,
                dwKeyBufLen,
                strKeyBuf,
                TRUE,           // passphrase
                TRUE,           // persistent
                NULL,           // not interested in failure reason
                NULL            // reserved
                );

    BAIL_ON_WIN32_ERROR(dwError, hr);

error:
    return hr;
}
Example #6
0
void ChatControl::addUserToMessageText(const tstring& sUser) {
  int iSelBegin, iSelEnd;
  ctrlMessage.GetSel(iSelBegin, iSelEnd);
  if ((iSelBegin == 0) && (iSelEnd == 0)) {
    CAtlString sText;
    ctrlMessage.GetWindowText(sText);
    tstring text = sUser + _T(": ");
    if (sText.GetLength() == 0) {
      ctrlMessage.SetWindowText(text.c_str());
      ctrlMessage.SetFocus();
      ctrlMessage.SetSel(text.length(), text.length(), FALSE);
    } 
    else {
      ctrlMessage.ReplaceSel(text.c_str());
      ctrlMessage.SetFocus();
    }
  } 
  else {
    tstring text = sUser + _T(": ");
    ctrlMessage.ReplaceSel(text.c_str());
    ctrlMessage.SetFocus();
  }
}
Example #7
0
	virtual void _output_file(CAtlString& string) { _file.Write(static_cast<const TCHAR*>(string), string.GetLength()); }