예제 #1
0
void GetAvatarCache(LPTSTR szPath)
{
	// Получить путь новым способом
	if ( ServiceExists( MS_UTILS_REPLACEVARS ) )
	{
		LPTSTR szAvatarCache = Utils_ReplaceVarsT(
			_T("%miranda_avatarcache%\\") modname_t _T("\\") );
		if ( szAvatarCache && szAvatarCache != (LPTSTR)0x80000000 )
		{
			lstrcpyn( szPath, szAvatarCache, MAX_PATH );

			// Создание пути до будущего файла аватара
			CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath );
			return;
		}
	}

	// Получить путь старым способом
	char szProfilePath[ MAX_PATH ], szProfileName[ MAX_PATH ];
	CallService( MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath );
	CallService( MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM)szProfileName );
	char *pos = strrchr( szProfileName, '.' );
	if ( lstrcmpA( pos, ".dat" ) == 0 )
		*pos = 0;
	lstrcpy( szPath, CA2T( szProfilePath ) );
	lstrcat( szPath, _T("\\") );
	lstrcat( szPath, CA2T( szProfileName ) );
	lstrcat( szPath, _T("\\AvatarCache\\") modname_t _T("\\") );

	// Создание пути до будущего файла аватара
	CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath );
	return;
}
예제 #2
0
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
int	CWsHook::getaddrinfo(PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA * pHints, PADDRINFOA * ppResult)
{
	int ret = WSAEINVAL;
	bool overrideDNS = false;

	void * context = NULL;
	CString name = CA2T(pNodeName);
	CAtlArray<DWORD> addresses;
	if( dlg )
		overrideDNS = dlg->DnsLookupStart( name, context, addresses );

	if( _getaddrinfo && !overrideDNS )
		ret = _getaddrinfo(CT2A((LPCTSTR)name), pServiceName, pHints, ppResult);
	else if( overrideDNS ) {
		if( addresses.IsEmpty() )
			ret = EAI_NONAME;
		else {
			// build the response structure with the addresses we looked up
			ret = 0;
			DWORD count = addresses.GetCount();

			ADDRINFOA_ADDR * result = (ADDRINFOA_ADDR *)malloc(sizeof(ADDRINFOA_ADDR) * count);
			for (DWORD i = 0; i < count; i++) {
				memset( &result[i], 0, sizeof(ADDRINFOA_ADDR) );
				result->info.ai_family = AF_INET;
				result->info.ai_addrlen = sizeof(struct sockaddr_in);
				result->info.ai_addr = (struct sockaddr *)&(result->addr);
				result->addr.sin_family = AF_INET;
				result->addr.sin_addr.S_un.S_addr = addresses[i];
				if( i < count - 1 )
					result->info.ai_next = (PADDRINFOA)&result[i+1];
			}
			addrInfo.AddTail(result);

			*ppResult = (PADDRINFOA)result;
		}
	}

	if (!ret && dlg) {
		PADDRINFOA addr = *ppResult;
		while (addr) {
      if (addr->ai_canonname)
        dlg->DnsLookupAlias(name, (LPCTSTR)CA2T(addr->ai_canonname));

			if (context &&
          addr->ai_addrlen >= sizeof(struct sockaddr_in) && 
          addr->ai_family == AF_INET) {
				struct sockaddr_in * ipName = (struct sockaddr_in *)addr->ai_addr;
				dlg->DnsLookupAddress(context, ipName->sin_addr);
			}

			addr = addr->ai_next;
		}

    if (context)
		  dlg->DnsLookupDone(context);
	}

	return ret;
}
예제 #3
0
BOOL CCommClass::GetLocalIP( TCHAR* chIP, TCHAR* chHostName )
{
	BOOL bRet = FALSE;
	WORD wVersionRequested; 
	WSADATA wsaData; 
	char chName[255]; 
	PHOSTENT hostinfo; 
	wVersionRequested =MAKEWORD(2,0); 
	if( WSAStartup( wVersionRequested, &wsaData ) == 0 ) 
	{ 
		if( gethostname(chName,sizeof(chName)) == 0 ) 
		{
			if((hostinfo = gethostbyname(chName)) != NULL ) 
			{
				LPCSTR ip=inet_ntoa(*(struct in_addr*)*hostinfo->h_addr_list); 
				_tcscpy( chIP, CA2T(ip) );
				if( chHostName != NULL )
					_tcscpy( chHostName, CA2T(hostinfo->h_name));
				bRet = TRUE;
			} 
		} 
		WSACleanup(); 
	}
	return bRet;
}
예제 #4
0
// 从XML设置Skin属性
HRESULT CControlBaseFont::OnAttributeSkin(const CStringA& strValue, BOOL bLoading)
{
	if (strValue.IsEmpty()) return E_FAIL;

	CStringA strSkin = DuiSystem::Instance()->GetSkin(strValue);
	if (strSkin.IsEmpty()) return E_FAIL;

	if(strSkin.Find(".") != -1)	// 加载图片文件
	{
		CString strImgFile = DuiSystem::GetSkinPath() + CA2T(strSkin, CP_UTF8);
		if(strSkin.Find(":") != -1)
		{
			strImgFile = CA2T(strSkin, CP_UTF8);
		}
		if(!SetBitmap(strImgFile))
		{
			return E_FAIL;
		}
	}else	// 加载图片资源
	{
		UINT nResourceID = atoi(strSkin);
		if(!SetBitmap(nResourceID, TEXT("PNG")))
		{
			if(!SetBitmap(nResourceID, TEXT("BMP")))
			{
				return E_FAIL;
			}
		}
	}

	return bLoading?S_FALSE:S_OK;
}
예제 #5
0
void CZiMainFrame::handlerAddGroupVerify(AddGroupInfo_t *pAddgroup) {
	Assert(pAddgroup);
	// 显示验证请求框, 交给用户操作. 
	// 还需要显示请求者的信息, 未实现 ... ???
	char              szText[1024] = {0};
	if (pAddgroup->type == GROUP_INFO_VERIFY) {
		sprintf_s(szText, sizeof(szText)/sizeof(szText[0]), 
			"'%s' 请求加入群 <%s>, 验证信息: '%s'", 
			pAddgroup->strSenderName.c_str(),
			pAddgroup->groupinfo.name.c_str(),
			pAddgroup->strVerify.c_str());

		CNotifyWindow::MessageBoxX(m_hWnd, _T("验证消息"), 
			CA2T(szText), _T("同意"), _T("不同意"), 
			Msg_InAddGroupVerify, pAddgroup);
	}
	else { //GROUP_INFO_REPLY	
		//TODO 如果添加者 需要弹框提示
		if (IdNetToLocal(Type_ImcFriend, pAddgroup->nSenderId) == m_itemSelfInfo.nId) {
			sprintf_s(szText, sizeof(szText)/sizeof(szText[0]), 
				"加入群 %s %s", 
				pAddgroup->groupinfo.name.c_str(), (pAddgroup->succ == 0 ? "成功" : "失败"));
			CNotifyWindow::MessageBoxX(m_hWnd, _T("通知"),CA2T(szText), 0);
			if (pAddgroup->succ == 0) {
				//TODO 添加群
				ItemNodeInfo_t item;
				ItemDataNetToLocal(pAddgroup->groupinfo, item);
				AddItem(&item, 0);

				//添加成员
				CNodeList *pNodeParent = GetNodeInfo(item.nId);
				Assert(pNodeParent);
				for (size_t i = 0; i < pAddgroup->groupinfo.members.size(); i++) {
					ItemNodeInfo_t group_member;
					ItemDataNetToLocal(pAddgroup->groupinfo.members[i], group_member, Type_ImcFriendX);
					AddItem(&group_member, pNodeParent);
				}
			}
		}
		else if (IdNetToLocal(Type_ImcFriend, pAddgroup->nAdminId) != m_itemSelfInfo.nId && pAddgroup->succ == 0) {
			CNodeList *pNodeParent = GetNodeInfo(IdNetToLocal(Type_ImcGroup,pAddgroup->groupinfo.group_id));
			if (pNodeParent) {
				ItemNodeInfo_t item;
				ItemDataNetToLocal(pAddgroup->userinfo, item, Type_ImcFriend);
				AddItem(&item, pNodeParent);
			}
		}
		m_pMainMsger->FreeDataEx(Msg_ScAddGroupVerify, pAddgroup);
	}	
}
예제 #6
0
//Called when selection in the key-field changes
void CEntityDialogClassInfo::OnLbnSelchangeListKey()
{
	int sel = m_lbKey.GetCurSel();
	if( sel == LB_ERR )
		return;

	//Get the selected key
	CString selKey;
	m_lbKey.GetText( sel, selKey );

	//Get the selected class
	CString selClass;
	m_cbClass.GetLBText( m_cbClass.GetCurSel(), selClass );

	//Get the entity-stub from the entity register
	CEntityRegisterEntity *pEnt = GetEntityRegister()->GetEntity(selClass);
	if( !pEnt )
		return;

	//Get the value-stub
	m_currentKey = pEnt->Get( selKey );
	if( !m_currentKey )
		return;

	//Set help text
	m_ecHelp.SetWindowText( CA2T(m_currentKey->desc.c_str()) );

	//is an value-edit dialog open? the close!
	if( m_activeDialog )
	{
		m_activeDialog->ShowWindow(SW_HIDE);
		RedrawWindow();
	}

	//Get value-edit dialog for specified value type
	auto it = m_valueTypesMap.find(m_currentKey->type);
	if( it != m_valueTypesMap.end() )
	{
		m_activeDialog = it->second;
		m_activeDialog->ShowWindow(SW_SHOW);
	}
	else
		m_activeDialog = NULL;

	//Get the real value of the entity from the entity.
	std::string value = m_editEnt->GetValue( m_currentKey->name );
	m_ecValueRaw.SetWindowText( CA2T(value.c_str()) );
}
예제 #7
0
LRESULT CB2ESelectDialog::OnInitDialog(HWND hWnd, LPARAM lParam)
{
    //DDX情報アップデート
    DoDataExchange(FALSE);

    //---------------
    // B2Eの情報取得
    //---------------
    //B2Eハンドラ
    CArchiverB2E &ArcB2E=CArchiverDLLManager::GetInstance().GetB2EHandler();
    ASSERT(ArcB2E.IsOK());	//B2Eが使えない時は呼ばないように!
    if(!ArcB2E.IsOK())return FALSE;

    //B2E情報取得
    if(!ArcB2E.EnumCompressB2EScript(m_ScriptInfoArray))m_ScriptInfoArray.clear();

    //使えるB2Eがあれば
    if(!m_ScriptInfoArray.empty()) {
        //---形式
        UINT uIdx=0;
        for(; uIdx<m_ScriptInfoArray.size(); uIdx++) {
            Combo_Format.AddString(CA2T(m_ScriptInfoArray[uIdx].szFormat));
        }
        ::EnableWindow(GetDlgItem(IDC_CHECK_COMPRESS_SFX),m_ScriptInfoArray[0].wAbility&B2EABILITY_SFX);
        Combo_Format.SetCurSel(0);

        //---メソッド
        if(m_ScriptInfoArray[0].MethodArray.empty()) {
            Combo_Method.AddString(_T("Default"));
        }
        else {
            for(uIdx=0; uIdx<m_ScriptInfoArray[0].MethodArray.size(); uIdx++) {
                Combo_Method.AddString(CA2T(m_ScriptInfoArray[0].MethodArray[uIdx]));
            }
        }
        Combo_Method.SetCurSel(m_ScriptInfoArray[0].nDefaultMethod);
    }
    else {
        ::EnableWindow(GetDlgItem(IDC_CHECK_COMPRESS_SFX),false);
        ::EnableWindow(GetDlgItem(IDC_CHECK_SINGLE_COMPRESSION),false);
        Combo_Format.EnableWindow(false);
        Combo_Method.EnableWindow(false);
        ::EnableWindow(GetDlgItem(IDOK),false);
    }

    CenterWindow();
    return TRUE;
}
void WordSchemaSoftDiscoverStrategy::ExtractNoteData(const WrdNote& note, TextTypeEnums textType)
{
	LOG_WS_FUNCTION_SCOPE();
	WrdText text;
	ChUINT4 count = note.getNoteTextLength();
	text.setTextType(textType);
	text.getTextReference().setMinimumCapacity(2 * count);
	text.getTextReference().setStartCP(note.getStartCPOfNoteText());
	text.getTextReference().setCharacterCount(count);
	m_pReader->read(text);

	USES_CONVERSION;
	std::tstring sBuffer;
	if(2 == text.getTextReference().getCharacterSize())
	{
		const wchar_t* wchars = (const wchar_t*)text.getText().getBuffer();
		sBuffer = std::tstring( CW2T( wchars ) );
	}
	else
	{
		const char* chars = (const char*)text.getText().getBuffer();
		sBuffer = std::tstring( CA2T( chars ) );
	}
	if(sBuffer.length() > 0) // OnFootnote called in same scope as CW2T to avoid auto destruction of szBuffer
		m_pVisitor->OnFootnote(sBuffer);
}
예제 #9
0
//Called when selection inside the combobox has changed
void CEntityDialogClassInfo::OnCbnSelchangeCbClass()
{
	m_lbKey.ResetContent();

	//Get current selected class name
	std::string classname;
	CString selection;
	int sel = m_cbClass.GetCurSel();
	if( sel == CB_ERR )
		return;
	m_cbClass.GetLBText( m_cbClass.GetCurSel(), selection );
	classname = CT2A(selection);


	CEntityRegisterEntity *pEnt = GetEntityRegister()->GetEntity(classname);
	if( !pEnt )
		return;

	for( int i = 0; i < pEnt->size(); i++ )
	{
		m_lbKey.AddString( CA2T( pEnt->Get(i)->name.c_str() ) );
	}

	//select first index in key list
	m_lbKey.SetCurSel(0);
	OnLbnSelchangeListKey();
}
예제 #10
0
BOOL CEntityDialogClassInfo::OnInitDialog( void )
{
	if( !CDialogEx::OnInitDialog() )
		return FALSE;

	if( !m_editEnt )
		return FALSE;

	//Fill the class list combob
	std::vector<std::string> entNames;
	GetEntityRegister()->GetEntityNames(entNames);
	
	for( UINT i = 0; i < entNames.size(); i++ )
	{
		if( entNames[i][0] != '@' )
		{
			m_cbClass.AddString( CA2T(entNames[i].c_str()) );
		}
	}

	int index = m_cbClass.FindString(-1, m_editEnt->GetClassnameW().c_str() );
	if( index >= 0 )
		m_cbClass.SetCurSel(index);

	CreateValueTypeDialogs();

	OnCbnSelchangeCbClass();
	
	return TRUE;
}
예제 #11
0
// 加载指定名字的菜单节点
BOOL CDuiMenu::LoadSubMenu(TiXmlElement* pXmlElem, CString strSubItemName)
{
	if(pXmlElem == NULL)
	{
		return FALSE;
	}

	// 递归遍历下层节点,看是否有指定名字的节点
	TiXmlElement* pItemElem = NULL;
	for (pItemElem = pXmlElem->FirstChildElement(); pItemElem != NULL; pItemElem=pItemElem->NextSiblingElement())
	{
		CStringA strNameA = pItemElem->Attribute("name");
		if(strSubItemName == CA2T(strNameA, CP_UTF8))
		{
			// 加载子菜单
			return Load(pItemElem);
		}
		if(LoadSubMenu(pItemElem, strSubItemName))
		{
			// 如果递归加载成功则返回,否则继续向下遍历查找
			return TRUE;
		}
	}
	return FALSE;
}
예제 #12
0
 CString CHTMLayoutCtrl::GetElementType(HELEMENT he)
 {
   htmlayout::dom::element el = he;
   USES_CONVERSION;
   CString s = CA2T(el.get_element_type());
   return s;
 }
예제 #13
0
파일: plugin.cpp 프로젝트: cha63501/Fire-IE
	void CPlugin::SetFirefoxCookie(const vector<SetFirefoxCookieParams>& vCookies, ULONG_PTR ulWindowId)
	{
		CString strEventType = _T("IEBatchSetCookie");
		CString strDetail;
		Json::Value json;
		Json::Value aCookies;
		for (size_t i = 0; i < vCookies.size(); i++)
		{
			const SetFirefoxCookieParams& param = vCookies[i];
			Json::Value cookie;
			cookie["url"] = (LPCSTR)CT2A(param.strURL, CP_UTF8);
			cookie["header"] = (LPCSTR)CT2A(param.strCookie, CP_UTF8);
			aCookies.append(cookie);
		}
		json["cookies"] = aCookies;

		if (ulWindowId)
		{
			char szWindowId[32] = { 0 };
			_ui64toa_s(ulWindowId, szWindowId, 32, 10);
			json["windowId"] = szWindowId;
		}

		strDetail = CA2T(json.toStyledString().c_str(), CP_UTF8);
		FireEvent(strEventType, strDetail);
	}
예제 #14
0
파일: plugin.cpp 프로젝트: cha63501/Fire-IE
	CPlugin::CPlugin(const nsPluginCreateData& data)
		:m_pNPInstance(data.instance),
		m_pNPStream(NULL),
		m_bInitialized(false),
		m_pScriptableObject(NULL),
		m_pIEHostWindow(NULL),
		m_pWindow(NULL),
		m_pContainer(NULL)
	{
		// <html:embed id='fireie-utils-object' type='application/fireie' hidden='true' width='0' height='0'/>
		// argc == 5
		// argn[0] = "id",                   argn[1] = "type",               argn[2] = "hidden", argn[3] = "width", argn[4] = "height"
		// argn[0] = "fireie-utils-object", argn[1] = "application/fireie", argn[2] = "true",   argn[3]="0",       argn[4]="0"

		// Get Plugin ID
		int i = 0;
		for (i=0; i<data.argc; i++)
		{
			if (_stricmp(data.argn[i], "id") == 0)
			{
				break;			
			}
		}
		if (i < data.argc)
		{
			m_strId = CA2T(data.argv[i]);
		}
	}
예제 #15
0
void ActivationContextLoader::Initialise(const CStdString& sManifest)
{
	if (CGeneral::FileExists(sManifest))
	{
		m_sManifest = sManifest;
	}
	else
	{
		CPath path;
		path.Combine(GetModulePath(), sManifest);
		m_sManifest = path;
	}

	try
	{
		// Don't do anything if we're not at least running on xp
		m_bShouldLoadActivationContext = ShouldLoadActivationContext();
		if (m_bShouldLoadActivationContext)
		{
			LoadDll();

			if (!IsActivationContextAlreadyActiveForManifest())
			{
				LoadAC();
			}
		}

	}
	catch (std::exception & e)
	{
		CStdString sError = CA2T(e.what());
		LOG_WS_ERROR(sError); 
	}
}
예제 #16
0
int CTwain::OpenSource(LPCSTR pzSourceName)
{
	if (nState != SOURCE_MANAGER_OPEN) return FALSE;
	BOOL bFound = FALSE;
	// Prevent TWAIN (or some DS?) from clobbering the current dir.
	// Per David Offen 3/7/00
	TCHAR szDir[_MAX_PATH];
	GetCurrentDirectory(_MAX_PATH, szDir);
	// Look for matching DS
	unsigned uMsg = MSG_GETFIRST;
	while (memset(&SourceId, 0, sizeof SourceId) &&
		SM(DG_CONTROL, DAT_IDENTITY, uMsg, &SourceId)) {
			if (_stricmp(SourceId.ProductName, pzSourceName) == 0) {
				// bingo
				bFound = TRUE;
				break;
			}
			uMsg = MSG_GETNEXT;
		} // while
		if (bFound) {
			SM(DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &SourceId);
			if (nState != SOURCE_OPEN && bTrace) ATLTRACE(_T("TWAIN:OPENDS failed.\n"));
		} else if (bTrace) {
			USES_CONVERSION;
			ATLTRACE(_T("CTwain::OpenSource - source named '%s' not found.\n"), CA2T(pzSourceName));
		}
		SetCurrentDirectory(szDir);
		return (nState == SOURCE_OPEN);
} // OpenSource
예제 #17
0
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
void CEntityOutputWnd::UpdateEventComboBox()
{
	CString oldText;
	m_cbEvt.GetWindowText(oldText);

	m_cbEvt.ResetContent();

	for(int id : m_list.GetEditIds()) //iterate over selected outputs
	{
		COutputListWnd::OutputSourceList *sourceList = m_list.GetSourceEnts(id);
		for(const std::pair<CEditorEntity*, CEntityOutput*> &outputPair : *sourceList) //iterate over output source entities
		{
			CEditorEntity *ent = outputPair.first;
			CEntityRegisterEntity *regEnt = GetEntityRegister()->GetEntity(ent->GetClassnameA());
			if(regEnt)
			{
				size_t numOuts = regEnt->GetNumOutputs();
				for(size_t i = 0; i < numOuts; i++) //iterate over the possible outputs of this source entity
				{
					const CEntityRegisterOutput *regOut = regEnt->GetOutput(i);
					CString outName(CA2T(regOut->name.c_str()));
					if( m_cbEvt.FindString(-1, outName) == CB_ERR )
						m_cbEvt.AddString(outName);
				}
			}				
		}
	}

	m_cbEvt.SetWindowText(oldText);
}
예제 #18
0
파일: YYApiMgr.cpp 프로젝트: ilylia/yy
CString CYYApiMgr::GetUserNick()
{
	CString nick;

	if (g_pYYExApi == NULL)
	{
		return nick;
	}

	yy::IUserEx* pUser = g_pYYExApi->GetUser();
	if (pUser == NULL)
	{
		return nick;
	}

	yy::IUserInfo *pUserInfo = NULL;
	pUser->GetCurrnetUserInfo(&pUserInfo);
	if(pUserInfo == NULL)
	{
		return nick;
	}

	char buf[256+1] = {0};
	pUserInfo->GetName(buf, 256);
	nick = CA2T(buf, CP_UTF8);

	return nick;
}
예제 #19
0
bool netbios_name::Register()
{
	m_managed = true;

	UCHAR ret = AddName ();
	LOG("Register NetBIOS name \"%s\" on lana %d num=%d : 0x%02x \"%s\"", GetANSIFullName(), m_lana, netbiosed.name_num, ret, GetNetbiosError( ret ) );
	m_registered = (ret == NRC_GOODRET);
	m_duplicated = (ret == NRC_DUPNAME);
	if ( ret != NRC_GOODRET && ret != NRC_DUPNAME )
	{
		WarningBox (NULL, (DWORD)MAKE_HRESULT (0, FACILITY_NETBIOS, ret),
			_T("%s: %s"), TranslateT ("Cannot register NetBIOS name"), (LPCTSTR)CA2T( GetANSIFullName() ) );
	}

	if (!m_term)
		m_term = CreateEvent (NULL, TRUE, FALSE, NULL);
	else
		ResetEvent (m_term);

	if ( m_term && !m_listener )
		m_listener = (HANDLE)mir_forkthread( ListenerThread, this );

	if ( m_term && !m_dgreceiver &&
		// NOTE: Под Win9x нельзя запускать ожидание датаграмм для имён-дубликатов
		// т.к. потом невозможно выбить управление из функции Netbios() даже если
		// разрегистрировать имя
		!m_duplicated )
	{
		m_dgreceiver = (HANDLE)mir_forkthread( DatagramReceiverThread, this );
	}

	return m_registered;
}
예제 #20
0
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
void ChildProcess::ReadOutputLoop( void )
{
	DWORD dwRead, dwWritten;
	CHAR chBuf[BUFSIZE]; 
	BOOL bSuccess = FALSE;
	//HANDLE hParentStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

	while( true )
	{ 
		DWORD exitCode;
		if( !GetExitCodeProcess( m_hProcess, &exitCode ) )
			break;

		bSuccess = ReadFile( m_childOutRd, chBuf, BUFSIZE, &dwRead, NULL);
		if( !bSuccess || dwRead == 0 ) 
			break;
		chBuf[dwRead] = '\0';

		//bSuccess = WriteFile(hParentStdOut, chBuf, dwRead, &dwWritten, NULL);
		CString str = CA2T( chBuf );
		m_pDlg->AddTextToLog( str );
		if ( !bSuccess ) 
			break; 

		if( exitCode != STILL_ACTIVE )
			break;

		m_pDlg->UpdateWindow();
	}

	CloseHandle( m_hProcess );
}
예제 #21
0
void CVNOCLoginDlg::OnBnClickedOk()
{
    UpdateData(TRUE);
	Global->Logf(LogFile_Net,_T("登陆操作,用户名:%s 密码:%s\n"), m_strUsername, m_strPassword);
	if (m_strUsername.IsEmpty())
	{
		OnOK();
	}

	SHA1 shaer;
	shaer.Reset();

	CStringA pwdBuffer = CT2A(m_strPassword);
	shaer.Input(pwdBuffer,pwdBuffer.GetLength());
	UINT pResult[5];
	shaer.Result(pResult);
	pwdBuffer.Format("%08x%08x%08x%08x%08x"
		,pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]);
	Global->Logf(LogFile_General,_T("SHA1后的密码为:%s\n"),CA2T(pwdBuffer));

	INetCenter *pInet=NULL;
	Global->GetINetCenter(&pInet);
	ATLASSERT(pInet);
	if (pInet)
	{
		MSG_RLI mRli;
		mRli.SetAccountNumber((byte*)(LPCTSTR)m_strUsername,m_strUsername.GetLength()*sizeof(TCHAR));
		mRli.SetPassword((byte*)(LPCSTR)pwdBuffer,pwdBuffer.GetLength()*sizeof(TCHAR));
		pInet->SendServer(mRli);

		_SetVerifyState(TRUE);
		SetTimer(0,5000,NULL);
	}
}
예제 #22
0
void CB2ESelectDialog::OnComboFormat(UINT uNotifyCode, int nID, HWND hWndCtl)
{
    //---形式選択変更
    int nIndex = Combo_Format.GetCurSel();
    if(nIndex == CB_ERR || nIndex<0 || (unsigned)nIndex>=m_ScriptInfoArray.size())return;

    m_bSFX=false;

    //DDX情報アップデート
    DoDataExchange(FALSE);

    //自己解凍対応?
    ::EnableWindow(GetDlgItem(IDC_CHECK_COMPRESS_SFX),m_ScriptInfoArray[nIndex].wAbility&B2EABILITY_SFX);

    //メソッド列挙
    Combo_Method.ResetContent();	//消去
    if(m_ScriptInfoArray[nIndex].MethodArray.empty()) {
        Combo_Method.AddString(_T("Default"));
    }
    else {
        for(UINT uIdx=0; uIdx<m_ScriptInfoArray[nIndex].MethodArray.size(); uIdx++) {
            Combo_Method.AddString(CA2T(m_ScriptInfoArray[nIndex].MethodArray[uIdx]));
        }
    }
    Combo_Method.SetCurSel(m_ScriptInfoArray[nIndex].nDefaultMethod);
}
예제 #23
0
		MscInit::MscInit(IRTDataSvr *rtDatasvr)
		{
			assert(rtDatasvr);

			db::tServerStatus d;
			IServerRecordset *pServerRst = 0;

			rtDatasvr->GetServerTable()->Select(&pServerRst,0,0);
			for( uint32 i = 0; i < pServerRst->GetCount(); ++i )
			{
				db::tServer *server = pServerRst->GetData(i);
				if( server->SvrType == MainServer )
				{
					utility::Strcpy( d.SvrID, server->SvrID );
					break;
				}
			}
			pServerRst->Release();

			// 初始化三层下载组件
			int iRet = ::msc_init(L"Downloader", L"Downloader");
			
			// 写三层模块状态到服务模块状态表中
			d.DNAService = iRet != 0 ? -1 : 1;
			rtDatasvr->GetServerStatusTable()->Ensure(&d, MASK_TSERVERSTATUS_DNASERVICE);

			if( iRet != 0 ) 
			{
				std::ostringstream os;
				os << "msc_init失败, ownergid = " << ::msc_getownerid() << " err: " << iRet;

				Log(LM_ERROR, CA2T(os.str().c_str()));
			}
		}
예제 #24
0
jboolean CFileMappingAdapter::open(JNIEnv *env, jstring jstr,jint size)
{
	
	const char* name = env->GetStringUTFChars(jstr,0);
	bool b1 = m_file.Open(CA2T(name),size,false);
	env->ReleaseStringUTFChars(jstr,name);
	return !!b1; 
}
예제 #25
0
HRESULT CMainFrame::SetupXFileMesh(LPCTSTR pszXFilePath)
{
    /*****************************************************************************************
    * 绘制时应该使用如下方式进行绘制 -- 分别绘制每个子 Material 的 Material 和 Texture
    for( DWORD i = 0 ,i < m_dwNumMaterials,i++ )
    {
        m_pD3dDevice->SetMaterial( &m_pMeshMaterials[i] );
        m_pD3dDevice->SetTexture( 0, m_ppMeshTextures[i] );
        // Draw the mesh subset
        m_pD3dMesh->DrawSubset( i );  //在 D3DXLoadMeshFromX 时,m_pD3dMesh 已经和 m_pD3dDevice 建立起关联了
    }
    *****************************************************************************************/

    HRESULT hr= E_FAIL;
    CComPtr<ID3DXBuffer> pD3DXMtrlBuffer;

    //从指定的XFile(Tiger.x)中加载Mesh
    DX_VERIFY(D3DXLoadMeshFromX( pszXFilePath, D3DXMESH_SYSTEMMEM, 
        m_pD3dDevice, NULL, 
        &pD3DXMtrlBuffer, NULL, &m_dwNumMaterials, 
        &m_pD3dMesh ));

    // We need to extract the material properties and texture names from the 
    // pD3DXMtrlBuffer

    //此处使用了强制类型转换,始终都是 D3DXMATERIAL 类型吗?能够获取到其中的 MeshMaterialList 信息,但其他信息无法获取?
    D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer();

    m_pMeshMaterials = new D3DMATERIAL9[m_dwNumMaterials];
    if( m_pMeshMaterials == NULL )
        return E_OUTOFMEMORY;
    m_ppMeshTextures  = new IDirect3DTexture9*[m_dwNumMaterials];
    if( m_ppMeshTextures == NULL )
        return E_OUTOFMEMORY;

    for( DWORD i=0; i<m_dwNumMaterials; i++ )
    {
        // Copy the material
        m_pMeshMaterials[i] = d3dxMaterials[i].MatD3D;

        // Set the ambient color for the material (D3DX does not do this)
        m_pMeshMaterials[i].Ambient = m_pMeshMaterials[i].Diffuse;

        //如果有子Texture的文件,对应加载?
        m_ppMeshTextures[i] = NULL;
        if( d3dxMaterials[i].pTextureFilename != NULL && 
            strlen(d3dxMaterials[i].pTextureFilename) > 0 )
        {
            // Create the texture
            DX_VERIFY(D3DXCreateTextureFromFile( m_pD3dDevice, 
                CA2T(d3dxMaterials[i].pTextureFilename), 
                &m_ppMeshTextures[i] ));
        }
    }

    //SAFE_RELEASE(pD3DXMtrlBuffer);
    return hr;
}
예제 #26
0
bool CUnicodeFile::Read(std::_tstring & data)
{
	std::string rawData;
	std::wstring rawWideData;

	ULONGLONG size, pos;
	if (m_file.GetSize(size) == S_OK && m_file.GetPosition(pos) == S_OK)
	{
		size -= pos;
		DWORD bytesRead;
		if(m_encoding==ENCODING_UTF_16)
		{
			rawWideData.resize(size/sizeof(wchar_t));
			m_file.Read((LPVOID)rawWideData.c_str(), size, bytesRead);
			ATLASSERT(bytesRead == size);
		}
		else
		{
			rawData.resize(static_cast<std::_tstring::size_type>(size));
			for(int i = 0; i < size; i += BLOCKSIZE)
			{
				unsigned int readSize = rawData.length() - i;
				if (readSize > BLOCKSIZE)
					readSize = BLOCKSIZE;
				m_file.Read(const_cast<char *>(rawData.c_str()) + i, readSize, bytesRead);
				ATLASSERT(bytesRead == readSize);
			}
		}
		switch(m_encoding)
		{
		case ENCODING_UTF_16:
			data = CW2T(rawWideData.c_str());
			break;
		case ENCODING_UTF_8:
			data = CA2T(rawData.c_str(), CP_UTF8);
			break;
		case ENCODING_ANSI:
		default:
			data = CA2T(rawData.c_str());
			break;
		}
		return true;
	}
	return false;
}
void TestOfficeDiscoverStrategy::TestDiscoverCustomProperties()
{   
	USES_CONVERSION;
   MockCustomPropertyVisitor visitor;
   OfficeDiscoverStrategy cut(visitor, CUSTOMPROPERTIES);
   
   cut.DiscoverCustomProperties();
   
   assertEquals(_T("Heinie"), visitor[_T("DutchBeer")]);
   assertEquals(_T("Windhoek"), visitor[_T("NamibBeer")]);
   assertEquals(_T("Castle"), visitor[_T("SouthAfricanBeer")]);
   
   assertMessage(!visitor.CustomPropertyExist((LPCTSTR)CA2T(WordDocumentFormat::c_sHyperLinkBasePropertyName.c_str())), (CStdString(WordDocumentFormat::c_sHyperLinkBasePropertyName) + _T(" isn't a custom property")).c_str());
   assertMessage(!visitor.CustomPropertyExist((LPCTSTR)CA2T(WordDocumentFormat::c_sHyperLinksPropertyName.c_str())),    (CStdString(WordDocumentFormat::c_sHyperLinksPropertyName) + _T(" isn't a custom property")).c_str());

   assertMessage(visitor.IsEventRaised(_T("MockCustomPropertyVisitor::OnCustomPropertiesBegin")), _T("The event [MockCustomPropertyVisitor::OnCustomPropertiesBegin] was not raised."));
   assertMessage(visitor.IsEventRaised(_T("MockCustomPropertyVisitor::OnCustomPropertiesEnd")), _T("The event [MockCustomPropertyVisitor::OnCustomPropertiesEnd] was not raised."));
}
void CFTLNetTester::test_WinSocket()
{
    WORD wVersionRequested = MAKEWORD( 2, 2 );
    WSADATA wsaData = {0};
    int rc = NO_ERROR;
    NET_VERIFY(WSAStartup(wVersionRequested,&wsaData));
    if (NO_ERROR == rc)
    {
        FTLTRACEEX(FTL::tlTrace,
                   TEXT("WSAStartup Success : wVersion=0x%04x, wHighVersion=0x%04x, iMaxSockets=%d, iMaxUdpDg=%d, ")
                   TEXT("szDescription=\"%s\", szSystemStatus=\"%s\", lpVendorInfo=\"%s\"\n"),
                   wsaData.wVersion, wsaData.wHighVersion,wsaData.iMaxSockets, wsaData.iMaxUdpDg,
                   wsaData.szDescription ? CA2T(wsaData.szDescription) : TEXT("No Description"),
                   wsaData.szSystemStatus? CA2T(wsaData.szSystemStatus): TEXT("No SystemStatus"),
                   wsaData.lpVendorInfo ?  CA2T(wsaData.lpVendorInfo)  : TEXT("No VendorInfo"));
        WSACleanup();
    }
}
예제 #29
0
CString GetType(PyObject* pObj)
{
	PyTypeObject* pType = (PyTypeObject*)PyObject_Type(pObj);
	int nLen = 255;
	char buf[255];
	buf[0] = 0;
	strcpy_s(buf,pType->tp_name);
	return CString(CA2T(buf));
}
예제 #30
0
void EnumerateTuple(PyObject* pTuple, CStringArray& astrRet, int argcountlimit = 100)
{
	Py_ssize_t nNumItems = min(PyTuple_GET_SIZE(pTuple),argcountlimit);
	astrRet.SetSize(nNumItems);
	for(int i = 0; i < nNumItems; i++)
	{
		PyObject* pItem = PyTuple_GET_ITEM( pTuple, i );
		astrRet.SetAt(i, CA2T(PyString_AsString(pItem)));
	}
}