コード例 #1
0
ファイル: hxxfile.cpp プロジェクト: muromec/qtopia-ezx
void HXXFile::ExtractFileAndPath(const char* pFullPath, char* pFileName, UINT32 ulFileNameBufLen,
                                 char* pPath, UINT32 ulPathBufLen)
{
#ifdef _MACINTOSH
	UCHAR delim = ':';
#elif defined(_WINDOWS)
	UCHAR delim = '\\';
#else
	UCHAR delim = '/';
#endif
	CHXString strPath = pFullPath;
	CHXString strFile;

	int nEndOfPath = strPath.ReverseFind(delim);

	if (nEndOfPath != -1)
	{
		strFile = strPath.Mid(nEndOfPath+1);

#ifndef _MACINTOSH
		strPath = strPath.Left(nEndOfPath);
#else
		// on the Mac, let's have the : at the end to ensure
		// it's taken as a directory (otherwise a hard drive name,
		// with no colon, becomes a relative path)
		strPath = strPath.Left(nEndOfPath+1);
#endif
	}
	SafeStrCpy(pPath,strPath, ulPathBufLen);
	SafeStrCpy(pFileName,strFile, ulFileNameBufLen);
}
コード例 #2
0
void CVideoCaptureDlg::Linking()
{
	m_pSizeCombo			= (cComboBox*)GetWindowForID( VIDEOCAPTURE_SIZE_COMBO );
	m_pOptCombo				= (cComboBox*)GetWindowForID( VIDEOCAPTURE_OPT_COMBO );
	m_pNoCursor				= (cCheckBox*)GetWindowForID( VIDEOCAPTURE_NO_CURSOR_CHECKBOX );

	m_pSizeCombo->RemoveAll();
	m_pOptCombo->RemoveAll();

	// 해상도 ComboBox 목록 설정
	for( int i=0 ; i<eVideoCaptureSize_Max ; ++i )
	{
		ITEM* pItem = new ITEM;
		ZeroMemory( pItem, sizeof(ITEM) );
		SafeStrCpy( pItem->string, GetTextVideoCaptureSize( (eVideoCaptureSize)i ), MAX_LISTITEM_SIZE );
		pItem->rgb = RGB(255, 255, 255);

		m_pSizeCombo->AddItem( pItem );
	}

	// 화질 ComboBox 목록 설정
	for( int i=0 ; i<eVideoCaptureOpt_Max ; ++i )
	{
		ITEM* pItem = new ITEM;
		ZeroMemory( pItem, sizeof(ITEM) );
		SafeStrCpy( pItem->string, GetTextVideoCaptureOpt( (eVideoCaptureOpt)i ), MAX_LISTITEM_SIZE );
		pItem->rgb = RGB(255, 255, 255);

		m_pOptCombo->AddItem( pItem );
	}

	m_pSizeCombo->SelectComboText( 0 );
	m_pOptCombo->SelectComboText( 0 );
}
コード例 #3
0
//-------------------------------------------------------------------------------------------------
//	NAME		: Throw_Error
//	DESC		: The function to process error message.
//	PROGRAMMER	: Yongs Lee
//	DATE		: August 18, 2008
//-------------------------------------------------------------------------------------------------
void CSiege_RecallBase::Throw_Error(char* szErr, char* szCaption)
{
#ifdef _CLIENT_

	#ifdef _GMTOOL_
		MessageBox( NULL, szErr, szCaption, MB_OK) ;
	#endif //_GMTOOL_

#else

		// Check parameter of this function.
		if(!szErr || !szCaption) return ;

		// Check err string size.
		if(strlen(szErr) <= 1)
		{
	#ifdef _USE_NPCRECALL_ERRBOX_
			MessageBox( NULL, "Invalid err string size!!", __FUNCTION__, MB_OK ) ;
	#else
			char tempStr[257] = {0, } ;

			SafeStrCpy( tempStr, __FUNCTION__, 256 ) ;
			strcat( tempStr, " - " ) ;
			strcat( tempStr, "Invalid err string size!!" ) ;
			WriteLog( tempStr ) ;
	#endif // _USE_NPCRECALL_ERRBOX_
		}


		// Check caption string size.
		if(strlen(szCaption) <= 1)
		{
	#ifdef _USE_NPCRECALL_ERRBOX_
			MessageBox( NULL, "Invalid caption string size!!", __FUNCTION__, MB_OK ) ;
	#else
			char tempStr[257] = {0, } ;

			SafeStrCpy( tempStr, __FUNCTION__, 256 ) ;
			strcat( tempStr, " - " ) ;
			strcat( tempStr, "Invalid caption string size!!" ) ;
			WriteLog( tempStr ) ;
	#endif // _USE_NPCRECALL_ERRBOX_
		}

		// Print a err message.
	#ifdef _USE_NPCRECALL_ERRBOX_
		MessageBox( NULL, szErr, szCaption, MB_OK) ;
	#else
		char tempStr[257] = {0, } ;

		SafeStrCpy(tempStr, szCaption, 256) ;
		strcat(tempStr, " - ") ;
		strcat(tempStr, szErr) ;
		WriteLog(tempStr) ;
	#endif // _USE_NPCRECALL_ERRBOX_

#endif //_CLIENT_
}
コード例 #4
0
void CGuildWarManager::SendToAllUser( DWORD dwFlag, const char* pGuildName1, const char* pGuildName2 )
{
	MSG_NAME2 message;
	message.Category = MP_GUILD_WAR;
	message.Protocol = MP_GUILD_WAR_RESULT_TOALLUSER;
	message.dwObjectID = dwFlag;
	SafeStrCpy( message.str1, pGuildName1, sizeof( message.str1 ) );
	SafeStrCpy( message.str2, pGuildName2, sizeof( message.str2 ) );

	g_Network.Broadcast2AgentServer( (char*)&message, sizeof(message) );
}
コード例 #5
0
ファイル: NoteManager.cpp プロジェクト: xianyinchen/LUNAPlus
void CNoteManager::WriteNoteID(char* Note, DWORD TargetID)
{
	MSG_FRIEND_SEND_NOTE_ID msg;
	msg.Category = MP_NOTE;
	msg.Protocol = MP_NOTE_SENDNOTEID_SYN;
	msg.dwObjectID = HEROID;
	SafeStrCpy(msg.FromName, HERO->GetObjectName(), MAX_NAME_LENGTH+1);
	msg.TargetID = TargetID;
	SafeStrCpy(msg.Note, Note, MAX_NOTE_LENGTH - 1);

	NETWORK->Send(&msg, msg.GetMsgLength());
}
コード例 #6
0
ファイル: NoteManager.cpp プロジェクト: xianyinchen/LUNAPlus
void CNoteManager::WriteNote(char* Note, char* Title, char* ToName)
{
	MSG_FRIEND_SEND_NOTE msg;
	msg.Category = MP_NOTE;
	msg.Protocol = MP_NOTE_SENDNOTE_SYN;
	msg.FromId = HEROID;
	SafeStrCpy(msg.ToName, ToName, MAX_NAME_LENGTH+1);
	SafeStrCpy(msg.FromName, HERO->GetObjectName(), MAX_NAME_LENGTH+1);
	SafeStrCpy(msg.Title, Title, MAX_NOTE_TITLE - 1);
	SafeStrCpy(msg.Note, Note, MAX_NOTE_LENGTH - 1);	
	
	
	NETWORK->Send(&msg, msg.GetMsgLength());
}
コード例 #7
0
void
HSPErrorSink::ConvertErrorToString(const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen)
{
    IHXErrorMessages* pErrMsg = NULL;

    if( !pszBuffer)
        return;
    
    pszBuffer[0]='\0';


    HX_ASSERT(m_pPlayer);
    if( m_pPlayer)
    {
        m_pPlayer->QueryInterface(IID_IHXErrorMessages, (void**)&pErrMsg);
        if( pErrMsg )
        {
            IHXBuffer* pMessage = pErrMsg->GetErrorText(ulHXCode);
            if( pMessage )
            {
                SafeStrCpy( pszBuffer, (const char*)pMessage->GetBuffer(), (int)ulBufLen);
                pMessage->Release();
            }
        }
    }
 
    HX_RELEASE(pErrMsg);
 
    if( strlen(pszBuffer)==0 )
    {
        SafeSprintf( pszBuffer, (int) ulBufLen, "Can't convert error code %p - please find corresponding HXR code in common/include/hxresult.h", ulHXCode );
    }

}
コード例 #8
0
ファイル: cBrowser.cpp プロジェクト: xianyinchen/LUNAPlus
void cBrowser::Navigate( char* pURL )
{
	SafeStrCpy( m_szURL, pURL, 1024 );
	
	if( m_pWebBrowser ) 
	{ 
		LPCONNECTIONPOINTCONTAINER pCPC = NULL;
		LPCONNECTIONPOINT pCP = NULL;

		m_pWebBrowser->QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pCPC);
		pCPC->FindConnectionPoint(__uuidof(SHDocVw::DWebBrowserEventsPtr), &pCP);

		DWORD dwCookie;
		pCP->Advise((LPUNKNOWN)&m_events, &dwCookie);

		pCPC->Release();

//		CComVariant vempty, vUrl(m_szURL);
		CComVariant vempty;

		m_pWebBrowser->Navigate( _bstr_t(m_szURL), &vempty, &vempty, &vempty, &vempty);             

		pCP->Unadvise(dwCookie);
		pCP->Release();
	}
}
コード例 #9
0
ファイル: ConductInfo.cpp プロジェクト: xianyinchen/LUNAPlus
BOOL cConductInfo::InitConductInfo( CMHFile* pFile )
{
	ASSERT(pFile->IsInited());
	ASSERT(pFile->IsEOF() == FALSE);

	while( !pFile->IsEOF() )
	{
		char buf[MAX_PATH] = {0,};
		pFile->GetString( buf );
		if( buf[0] == '/' && buf[1] == '/' )
		{
			pFile->GetLineX( buf, MAX_PATH );
			continue;
		}
		
		m_pConductInfo.ConductIdx = (WORD)atoi( buf );
		break;
	}

	

	SafeStrCpy(
		m_pConductInfo.ConductName,
		pFile->GetString(),
		_countof(m_pConductInfo.ConductName));	
	m_pConductInfo.ConductTootipIdx = pFile->GetWord();
	m_pConductInfo.ConductKind = pFile->GetWord();
	m_pConductInfo.ConductPos = pFile->GetWord();
	m_pConductInfo.HighImage = pFile->GetInt();
	m_pConductInfo.MotionIdx = pFile->GetInt();
	m_pConductInfo.bInvalidOnVehicle = pFile->GetBool();

	return TRUE;
}
コード例 #10
0
void CFilteringTable::RemoveSpace(LPCTSTR textInput, LPTSTR textOutput, size_t size) const
{
	TCHAR buffer[MAX_PATH] = {0};	

	for(PUCHAR inputPointer = PUCHAR(textInput);
		0 < *inputPointer;
		inputPointer = _mbsinc((const PUCHAR)inputPointer))
	{
		LPCTSTR removedSpeicalCharacter = _T("\t\n\r ~`!@#$%^&*()-_=+\\|<,>.?/");

		if(_tcschr(removedSpeicalCharacter, *inputPointer))
		{
			continue;
		}

		_tcsncat(
			buffer,
			LPCTSTR(inputPointer),
			IsDBCSLeadByte(*inputPointer) ? 2 : 1);
	}

	SafeStrCpy(
		textOutput,
		buffer,
		size);
}
コード例 #11
0
void cDialogueList::LoadScript()
{
	CMHFile file;
	file.Init(
		"Data/Script/Npc/Npc_Msg.bin",
		"rb");
	DWORD messageIndex = 0;
	WORD wLineIdx = 0;
	
	while(FALSE == file.IsEOF())
	{
		// 091207 LUJ, 1K 이하로 선언하면 메모리 오류가 발생한다... 그런데 파싱 코드가 겁나게 복잡하다.
		TCHAR buffer[1024] = {0};
		file.GetLine(
			buffer,
			sizeof(buffer) / sizeof(*buffer));
		TCHAR textLine[1024] = {0};
		SafeStrCpy(
			textLine,
			buffer,
			sizeof(textLine) / sizeof(*textLine));

		LPCTSTR seperator = " \t#";
		LPCTSTR token = _tcstok(buffer, seperator);
		LPCTSTR comment = "@";
		LPCTSTR openMark = "{";
		LPCTSTR closeMark = "}";

		if(0 == token)
		{
			continue;
		}
		else if(0 == _tcsnicmp(comment, token, _tcslen(comment)))
		{
			continue;
		}
		else if(0 == _tcsnicmp(openMark, token, _tcslen(openMark)))
		{
			continue;
		}
		else if(0 == _tcsnicmp(closeMark, token, _tcslen(closeMark)))
		{
			continue;
		}
		else if(0 == _tcsicmp("msg", token))
		{
			LPCTSTR textMessageIndex = _tcstok(0, seperator);
			messageIndex = _ttoi(textMessageIndex ? textMessageIndex : "");
			wLineIdx = 0;
			continue;
		}

		// 091216 ShinJS --- Npc_Msg.bin의 Data를 저장(인덱스,라인,메세지)
		NpcMsgDataKey dataKey( messageIndex, wLineIdx );
		m_NpcMsgData.insert( std::make_pair( dataKey, textLine ) );
		++wLineIdx;
	}
}
コード例 #12
0
void CGuildWar::AddPlayer( CPlayer* player )
{
	// 적 길드 목록 전송
	{
		MSG_GUILD_LIST message;
		message.Category	= MP_GUILD_WAR;
		message.Protocol	= MP_GUILD_WAR_PROC;
		message.mSize		= 0;

		m_EnemyGuildTable.SetPositionHead();

		for( const sGFWENEMY* enemy; (enemy = m_EnemyGuildTable.GetData())!=NULL; )
		{
			const CGuild* guild = GUILDMGR->GetGuild( enemy->dwEnemyGuildIdx );

			if( guild )
			{
				MSG_GUILD_LIST::Data& dest	= message.mData[ message.mSize++ ];
				const GUILDINFO&			source	= guild->GetInfo();

				// 올바로 복사되나 꼭 테스트할 것!
				memcpy( &dest, &source, sizeof( source ) );

				// MarkName을 선포금 용도로 사용하고 있다.
				dest.MarkName	= enemy->dwGFWMoney;

				CGuildUnion* alliance = GUILDUNIONMGR->GetUnion( source.UnionIdx );

				if( alliance )
				{
					SafeStrCpy( dest.mUnionName, alliance->GetName(), sizeof( dest.mUnionName ) );
				}
				else
				{
					dest.mUnionName[ 0 ] = 0;
				}
			}
		}

		if( message.mSize )
		{
			player->SendMsg( &message, message.GetSize() );
		}
	}

	// 전적 전송
	{
		MSG_DWORD3 message;
		message.Category	= MP_GUILD_WAR;
		message.Protocol	= MP_GUILD_WAR_RECORD;
		message.dwData1		= m_dwVictoryCount;
		message.dwData2		= m_dwDrawCount;
		message.dwData3		= m_dwLooseCount;

		player->SendMsg( &message, sizeof( message ) );
	}
}
コード例 #13
0
ファイル: core.cpp プロジェクト: ChenzhenqingCC/WinProjects
bool CUpdator::DownLoadFile(const pair<tstring,tstring>& src,const tstring &targ)
{
	bool r = m_loader->DownLoad(src.second,targ+src.first);
	//notify l
	struct dfinfo{
		char src[256];
		char tar[256];
		bool result;
	};
	dfinfo df={0};
	SafeStrCpy(df.src, src.second.c_str());
	SafeStrCpy(df.tar, targ.c_str());
	df.result = r;

	Event loading(E_LOADING,0,(void*)&df,sizeof(df));
	Notify(loading);
	return !r;
}
コード例 #14
0
ファイル: audlinux_oss.cpp プロジェクト: muromec/qtopia-ezx
//Device specific methods to open/close the mixer and audio devices.
HX_RESULT CAudioOutLinux::_OpenAudio()
{
    HX_RESULT retCode = RA_AOE_NOERR;

    //Set the tick count to zero
    m_ulTickCount       = 0;
    m_ulLastTimeStamp   = 0;
    m_ulLastBytesPlayed = 0;
    m_ulPausePosition   = 0;

    //Check the environmental variable to let user overide default device.
    char *pszOverrideName = getenv( "AUDIO" ); /* Flawfinder: ignore */
    char szDevName[MAX_DEV_NAME]; /* Flawfinder: ignore */
    
    // Use defaults if no environment variable is set.
    if ( pszOverrideName && strlen(pszOverrideName)>0 )
    {
        SafeStrCpy( szDevName, pszOverrideName, MAX_DEV_NAME );
    }
    else
    {
        SafeStrCpy( szDevName, "/dev/dsp", MAX_DEV_NAME );
    }
    
    // Open the audio device if it isn't already open
    if ( m_nDevID < 0 )
    {
        m_nDevID = ::open( szDevName, O_WRONLY );
    }
    
    if ( m_nDevID < 0 )
    {
#ifdef _DEBUG        
        fprintf( stderr, "Failed to open audio(%s)!!!!!!! Code is: %d  errno: %d\n",
                 szDevName, m_nDevID, errno );
#endif        
        
        //Error opening device.
        retCode = RA_AOE_BADOPEN;
    }
    
    m_wLastError = retCode;
    return m_wLastError;
}
コード例 #15
0
ファイル: Pet.cpp プロジェクト: xianyinchen/LUNAPlus
void CPet::InitPet( PET_OBJECT_INFO* pPetObjectInfo ) 
{
	mID = pPetObjectInfo->ID;
	SafeStrCpy( mMasterName, pPetObjectInfo->MasterName, MAX_NAME_LENGTH + 1 );
	mKind = pPetObjectInfo->Kind;
	mGrade = pPetObjectInfo->Grade;
	mState = pPetObjectInfo->State;
	mLevel = pPetObjectInfo->Level;
	mHP = pPetObjectInfo->HP;
	mMaxHP = pPetObjectInfo->MAXHP;

	mpPetInfo = PETMGR->GetPetInfo( mKind );
}
コード例 #16
0
ファイル: bsd_dll.cpp プロジェクト: muromec/qtopia-ezx
void* FreeBSDDLLAccess::GetSymbol(const char* symbolName)
{
    void* ret = 0;

    UINT32 bufSize = strlen(symbolName) + 1;
    char* pNewName = new char[bufSize + 1]; //add extra room for "_"

    if (pNewName)
    {
#if defined(_FREEBSD2) || defined(_OPENBSD)
        pNewName[0] = '_';
        SafeStrCpy(&pNewName[1], symbolName, bufSize);
#else
        SafeStrCpy(pNewName, symbolName, bufSize);
#endif  
        ret = dlsym(m_handle, pNewName);

        delete [] pNewName;
    }

    return ret;
}
コード例 #17
0
ファイル: hxdir.cpp プロジェクト: muromec/qtopia-ezx
/* Starts enumeration process. */
CHXDirectory::FSOBJ 
CHXDirectory::FindFirst(const char* szPattern, char* szPath, UINT16 nSize)
{
    FSOBJ RetVal = FSOBJ_NOTVALID;
    char* szMatch = NULL;
    char* szMatchPath = NULL;
    HXBOOL  bDone = FALSE;
    struct stat statbuf;

    // Find the first file that matches the specified pattern
    HX_DELETE(m_pFileFinder); 
    m_pFileFinder = CFindFile::CreateFindFile(m_strPath, 0, szPattern);
    if (!m_pFileFinder)
    {
	return RetVal;	
    }

    szMatch = m_pFileFinder->FindFirst();
    while (szMatch && !bDone)
    {
	szMatchPath = m_pFileFinder->GetCurFilePath();

	if (lstat(szMatchPath, &statbuf) < 0)
	{
	    return RetVal;
	}

	if (S_ISDIR(statbuf.st_mode) != 0 && IsValidFileDirName(szMatch))
	{
	    RetVal = FSOBJ_DIRECTORY;
	    bDone = TRUE;
	}
	else if (IsValidFileDirName(szMatch))
	{
	    RetVal = FSOBJ_FILE;
	    bDone = TRUE;
	}
	else
	{
	    // If we couldn't use this one, find another
	    szMatch = m_pFileFinder->FindNext();
	}

	if (RetVal != FSOBJ_NOTVALID)
	{
	    SafeStrCpy(szPath, szMatchPath, nSize);
	}
    }

    return RetVal;
}
コード例 #18
0
ファイル: mp4adec.cpp プロジェクト: muromec/qtopia-ezx
/****************************************************************************
 *  Method:
 *    CMP4ADecoder::OS_BuildLibName
 */
HXBOOL CMP4ADecoder::OS_BuildLibName(const char* pLibName, 
				   char *pOSLibName, 
				   UINT32 ulBufLen)
{
    HXBOOL bRetVal = FALSE;

    if (pOSLibName && pLibName)
    {
#if defined(HELIX_FEATURE_AUTOUPGRADE)
        // Copy the base file name into the AU String (just
	// in case we need it)
	SafeStrCpy(m_szAUStr, pLibName, MAX_LIBNAME_SIZE);
#endif /* #if defined(HELIX_FEATURE_AUTOUPGRADE) */

	SafeStrCpy(pOSLibName, pLibName, MAX_LIBNAME_SIZE);
	// Now append the filename suffix
	SafeStrCat(pOSLibName, z_dllSuffix, ulBufLen);

	bRetVal = TRUE;
    }

    return bRetVal;
}
コード例 #19
0
ファイル: audlinux_oss.cpp プロジェクト: muromec/qtopia-ezx
HX_RESULT CAudioOutLinux::_OpenMixer()
{
    HX_RESULT retCode = RA_AOE_NOERR;

    if(!m_bMixerPresent)
    {
        //Let user override default device with environ variable.
        char *pszOverrideName = getenv( "MIXER" ); /* Flawfinder: ignore */
        char szDevCtlName[MAX_DEV_NAME]; /* Flawfinder: ignore */
        
        if (pszOverrideName && strlen(pszOverrideName)>0 )
        {
            SafeStrCpy( szDevCtlName , pszOverrideName, MAX_DEV_NAME );
        }
        else
        {
            SafeStrCpy( szDevCtlName , "/dev/mixer", MAX_DEV_NAME );    // default for volume
        }
        
        m_nMixerID = ::open( szDevCtlName, O_RDWR );
        
        if (m_nMixerID > 0)
        {
            m_bMixerPresent = 1;
            _Imp_GetVolume();
        }
        else
        {
            m_nMixerID = NO_FILE_DESCRIPTOR;
            m_bMixerPresent = 0;
        }
    }

    m_wLastError = retCode;
    return m_wLastError;
}
コード例 #20
0
void cDialogueList::AddLine( DWORD dwId, LPCTSTR str, DWORD color, WORD Line, WORD type)
{
	DialogMap& dialogMap = mMessageMap[dwId];
	DIALOGUE& dialog = dialogMap[dialogMap.size()];

	ZeroMemory(
		&dialog,
		sizeof(dialog));
	dialog.dwColor = color;
	dialog.wLine = Line;
	dialog.wType = type;
	SafeStrCpy(
		dialog.str,
		str,
		sizeof(dialog.str) / sizeof(*dialog.str));
}
コード例 #21
0
ファイル: hxresmg.cpp プロジェクト: muromec/qtopia-ezx
STDMETHODIMP
HXExternalResourceManager::Init()
{
    HX_RESULT rc = GetHXXResPlugin();

    if(HXR_OK == rc)
    {
	// get language and res directory preferences/reg entries
	if (HXR_OK == m_pContext->QueryInterface(IID_IHXPreferences,
						(void**)&m_pPrefs) &&
	    HXR_OK == m_pContext->QueryInterface(IID_IHXRegistry, 
						(void**)&m_pRegistry))
	{
	    IHXBuffer* pBuffer = NULL;
	    CHXString strTemp;
	    strTemp.Format("%s.%s",HXREGISTRY_PREFPROPNAME, "LangID");
	    if(HXR_OK == m_pRegistry->GetStrByName(strTemp, pBuffer))
	    {
		const char* pActualLangID = (const char*)pBuffer->GetBuffer();
		m_ulLanguageID = strtol(pActualLangID, NULL, 10);
		HX_RELEASE(pBuffer);
	    }

            const char* pPath = NULL;
            // Get the plugin directory from the Dll Access Paths
            if (GetDLLAccessPath() &&
                (pPath = GetDLLAccessPath()->GetPath(DLLTYPE_PLUGIN)) &&
                *pPath)
            {
                UINT32 ulBufLen = strlen(pPath) + 1 + strlen(EXT_RES_DIR) + 1;
                m_pExternalResDir = new char[ulBufLen];
                SafeStrCpy(m_pExternalResDir, pPath, ulBufLen);
                if (m_pExternalResDir[strlen(m_pExternalResDir)-1] != OS_SEPARATOR_CHAR)
                {
                    SafeStrCat(m_pExternalResDir, OS_SEPARATOR_STRING, ulBufLen);
                }

                SafeStrCat(m_pExternalResDir, EXT_RES_DIR, ulBufLen);
                rc = LoadResourceFiles();
            }

	}
    }

    return rc;
}
コード例 #22
0
ファイル: GMPowerList.cpp プロジェクト: xianyinchen/LUNAPlus
void CGMPowerList::AddGMList( DWORD dwConnectionIdx, int nPower, DWORD dwIndex, char* strID )
{
	GM_INFO* info = new GM_INFO;
	info->dwConnectionIndex		= dwConnectionIdx;
	info->nPower				= nPower;
	info->dwGMIndex				= dwIndex;
	SafeStrCpy( info->szGMID, strID, MAX_NAME_LENGTH+1 );

//국내 Monitor를 위해 임시 코드
	if( nPower == eGM_POWER_MONITOR )
	if( m_bMonitorCheat == TRUE )
	{
		info->nPower = eGM_POWER_MASTER;
	}

	m_listGPL.AddTail( info );	
}
コード例 #23
0
	void CActionEngineEffect::DoAction()
	{
		const DWORD hashCode = GetValue(eProperty_Name);
		const DWORD positionX = GetValue(eProperty_PosX);
		const DWORD positionZ = GetValue(eProperty_PosZ);		
		const DWORD motionIndex = GetValue(eProperty_Value);
		const DWORD angle = GetValue(eProperty_Angle);
		const DWORD isLoop = GetValue(eProperty_Loop);

		MSG_NAME_DWORD5 message;
		ZeroMemory(
			&message,
			sizeof(message));
		message.Category = MP_TRIGGER;
		message.Protocol = MP_TRIGGER_ENGINE_EFFECT_ACK;
		message.dwData1 = positionX;
		message.dwData2 = positionZ;
		message.dwData3 = motionIndex;
		message.dwData4 = angle;
		message.dwData5 = isLoop;
		SafeStrCpy(
			message.Name,
			GetAliasName(hashCode),
			sizeof(message.Name) / sizeof(*message.Name));
		
		for(DWORD objectIndex = GetHeadTarget();
			objectIndex > 0;
			objectIndex = GetNextTarget())
		{
			CObject* const object = g_pUserTable->FindUser(objectIndex);

			if(0 == object)
			{
				continue;
			}
			else if(eObjectKind_Player != object->GetObjectKind())
			{
				continue;
			}
		
			object->SendMsg(
				&message,
				sizeof(message));
		}
	}
コード例 #24
0
ファイル: hxdir.cpp プロジェクト: muromec/qtopia-ezx
/* Continues enumeration process. */
CHXDirectory::FSOBJ 
CHXDirectory::FindNext(char* szPath, UINT16 nSize)
{
    FSOBJ RetVal = FSOBJ_NOTVALID;
    char* szMatch = NULL;
    char* szMatchPath = NULL;
    HXBOOL  bDone = FALSE;
    struct stat statbuf;
    
    szMatch = m_pFileFinder->FindNext();
    while (szMatch && !bDone)
    {
	szMatchPath = m_pFileFinder->GetCurFilePath();
	
	if (lstat(szMatchPath, &statbuf) < 0)
	{
	    return RetVal;
	}

	if (S_ISDIR(statbuf.st_mode) != 0 && IsValidFileDirName(szMatch))
	{
	    RetVal = FSOBJ_DIRECTORY;
	    bDone = TRUE;
	}
	else if (IsValidFileDirName(szMatch))
	{
	    RetVal = FSOBJ_FILE;
	    bDone = TRUE;
	}
	else
	{
	    // If we couldn't use this one, find another
	    szMatch = m_pFileFinder->FindNext();
	}

	if (RetVal != FSOBJ_NOTVALID)
	{
	    SafeStrCpy(szPath, szMatchPath, nSize);
	}
    }

    return RetVal;
}
コード例 #25
0
ファイル: ServerSystem.cpp プロジェクト: xianyinchen/LUNAPlus
void CServerSystem::LoadFireWallIP()
{
	CMHFile file;
	if( !file.Init( "firewallip.txt", "rt", MHFILE_FLAG_DONOTDISPLAY_NOTFOUNDERROR ) )
		return;

	while(FALSE == file.IsEOF())
	{
		if( file.GetInt() == g_nServerSetNum )
		{
			SafeStrCpy( m_strFireWallIP, file.GetString(), 16 );
			if( *m_strFireWallIP != 0 )
				m_bUserFireWall = TRUE;

			break;
		}
	}

	file.Release();	
}
コード例 #26
0
ファイル: core.cpp プロジェクト: ChenzhenqingCC/WinProjects
bool CUpdator::DownLoad()
{
	//get local update path
	tstring targpath = m_config->GetLocalUpdatePath();
	//get update list
	map<tstring,tstring> updatelist = m_pverinfo->GetUpdateList(m_services);
	//notify l
	int usize = updatelist.size();
	Event need_update(E_TOTALFILES,(void*)this,0,usize);
	Notify(need_update);
	//
	bool res =  find_if(updatelist.begin(),updatelist.end(),boost::bind(&CUpdator::DownLoadFile,this,_1,targpath)) == updatelist.end();
	
	struct dinfo{
		char tarPath[256];
		bool result;
	};
	dinfo df={0};
	df.result = res;
	SafeStrCpy(df.tarPath,targpath.c_str());
	Event download_e(E_DOWNLOAD,0,(void*)&df,sizeof(df));
	Notify(download_e);
	return res;
}
コード例 #27
0
ファイル: hxxfile.cpp プロジェクト: muromec/qtopia-ezx
/////////////////////////////////////////////////////////////////////////////
//
//	Method:
//
//		ConvertHexCodesToChars()
//
//	Purpose:
//
//		Converts a string containing %XX hex character codes into.
//		actual characters.  (For instance, "%20" will be changed to
//		" ".)  This is useful for URLs that contain non-alphanumeric
//		characters that have been converted to hex-codes.
//
//	Parameters:
//
//		CHXString& fileName
//		File reference or URL to convert.
//
//	Return:
//
//		HXBOOL - true if successful, false if bad input or out of mem.
//
HXBOOL HXXFile::ConvertHexCodesToChars(CHXString& fileName)
{
	char* 	c 	= NULL;
        char*   cBase   = NULL;
	char* 	pTemp	= NULL;
	char*	pStop	= NULL;
	HXBOOL 	bOk 	= FALSE;
	long 	lVal	= 0;
	int 	nLen 	= 0;
	char	hex[3]; /* Flawfinder: ignore */
	 
	fileName.TrimLeft();
	fileName.TrimRight();

	// for doing string copies
	nLen = fileName.GetLength();
	pTemp = new char[nLen];
	if (!pTemp)
	{
		return FALSE;
	}
		
	cBase = c = fileName.GetBuffer(0);
	if (!c)
	{
		goto cleanup;
	}
	
	// init our temp array used for hex conversions
	memset(hex, 0, sizeof(char) * 3);
	
	// look for the first hex code
	c = strchr(c, '%');
	while (c)
	{
		// make sure we have enough buffer
		if (c[1] && c[2])
		{
			if (isxdigit(c[1]) && isxdigit(c[2]))
			{
				// hex convert two digits
				strncpy(hex, &(c[1]), 2); /* Flawfinder: ignore */
				lVal = strtol(hex, &pStop, 16);
				
				// replace the '%' with the actual char, then
				// shift the array down
				c[0] = (char)(lVal & 0xFF);
				SafeStrCpy(pTemp, &(c[3]), nLen);
				SafeStrCpy(&c[1], pTemp, nLen - (c+1-cBase));
			}
		}
		else
		{
			// out of chars, so quit
			break;
		}
		
		c++;
		c = strchr(c, '%');
	}
	
cleanup:
	fileName.ReleaseBuffer();

	if (pTemp)
	{
		HX_VECTOR_DELETE(pTemp);
	}
	
	return bOk;
}
コード例 #28
0
ファイル: hxdate.cpp プロジェクト: muromec/qtopia-ezx
time_t ParseDate(char *date_string)
{
#ifdef _OPENWAVE
    struct op_tm tm;
    if (op_time_parse_http_date(date_string, &tm))
    {
        return op_timegm(&tm);
    }
    return 0;
#else
    struct  tm time_info;         // Points to static tm structure
    char*   ip = NULL;
    char    mname[256] = {0}; /* Flawfinder: ignore */
    time_t  rv;

    memset(&time_info, 0, sizeof(struct tm));

    // Whatever format we're looking at, it will start with weekday.
    // Skip to first space
    if(!(ip = strchr(date_string,' ')))
    {
        return 0;
    }
    else
    {
	while(IS_SPACE(*ip))
	{
            ++ip;
	}
    }

    /* make sure that the date is less than 256 
     * That will keep mname from ever overflowing 
     */
    if(255 < strlen(ip))
    {
	return 0;
    }

    if(isalpha(*ip)) 
    {
	// ctime
	sscanf(ip, (strstr(ip, "DST") ? "%s %d %d:%d:%d %*s %d"
					: "%s %d %d:%d:%d %d"),
		   mname,
		   &time_info.tm_mday,
		   &time_info.tm_hour,
		   &time_info.tm_min,
		   &time_info.tm_sec,
		   &time_info.tm_year);
	time_info.tm_year -= 1900;
    }
    else if(ip[2] == '-') 
    {
        // RFC 850 (normal HTTP)
        char t[256] = {0}; /* Flawfinder: ignore */
        sscanf(ip,"%s %d:%d:%d", t,
		    &time_info.tm_hour,
		    &time_info.tm_min,
		    &time_info.tm_sec);
        t[2] = '\0';
        time_info.tm_mday = atoi(t);
        t[6] = '\0';
        SafeStrCpy(mname, &t[3], 256);
        time_info.tm_year = atoi(&t[7]);
        // Prevent wraparound from ambiguity
        if(time_info.tm_year < 70)
	{
            time_info.tm_year += 100;
	}
	else if(time_info.tm_year > 1900)
	{
	    time_info.tm_year -= 1900;
	}
    }
    else 
    {
        // RFC 822
        sscanf(ip,"%d %s %d %d:%d:%d",&time_info.tm_mday,
				    mname,
				    &time_info.tm_year,
				    &time_info.tm_hour,
				    &time_info.tm_min,
				    &time_info.tm_sec);

	// since tm_year is years since 1900 and the year we parsed
 	// is absolute, we need to subtract 1900 years from it
	time_info.tm_year -= 1900;
    }
    time_info.tm_mon = MonthNo(mname);

    if(time_info.tm_mon == -1)
    {
	return 0;
    }

    rv = mktime(&time_info);
	
#ifndef NO_TM_ISDST
    if(time_info.tm_isdst)
    {
	rv -= 3600;
    }
#endif /* NO_TM_ISDST */

    if(rv == -1)
    {
        return(0);
    }
    else
    {
	return(rv);
    }
#endif /* _OPENWAVE */
}
コード例 #29
0
ファイル: symbhxdir.cpp プロジェクト: muromec/qtopia-ezx
CHXDirectory::FSOBJ CHXDirectory::FindNextEntry(char*  szPath,
						UINT16 nSize,
						const char* szPattern,
						HXBOOL bReset)
{
    FSOBJ RetVal = FSOBJ_NOTVALID;
    char* szMatch = NULL;
    char* szMatchPath = NULL;
    HXBOOL  bDone = FALSE;
    TUint symbAttValue;
    
    // Find the first file that matches the specified pattern
    if (bReset || szPattern || (!m_pFileFinder))
    {
	HX_DELETE(m_pFileFinder); 
	m_pFileFinder = new CSymbianFindFile(m_strPath,
					     0,
					     szPattern,
					     (IUnknown**) (&m_pSessionManager),
					     TRUE); // Find sub-dirs
	if (!m_pFileFinder)
	{
	    return RetVal;	
	}

	szMatch = m_pFileFinder->FindFirst();
    }
    else
    {
	szMatch = m_pFileFinder->FindNext();
    }

    while (szMatch && !bDone)
    {
	szMatchPath = m_pFileFinder->GetCurFilePath();

	if (!GetFileAttributes(szMatchPath, symbAttValue))
	{
	    return RetVal;
	}

	if (symbAttValue & KEntryAttDir)
	{
	    RetVal = FSOBJ_DIRECTORY;
	    bDone = TRUE;
	}
	else if (!(symbAttValue & KEntryAttVolume))
	{
	    RetVal = FSOBJ_FILE;
	    bDone = TRUE;
	}
	else
	{
	    // If we couldn't use this one, find another
	    szMatch = m_pFileFinder->FindNext();
	}

	if (RetVal != FSOBJ_NOTVALID)
	{
	    SafeStrCpy(szPath, szMatchPath, nSize);
	}
    }

    return RetVal;
}
コード例 #30
0
void CGuildWarManager::Declare( void* pMsg )
{
	MSG_DWORD3* pmsg = (MSG_DWORD3*)pMsg;

	CGuild* pGuild1 = GUILDMGR->GetGuildFromMasterIdx( pmsg->dwData1 );
	CGuild* pGuild2 = GUILDMGR->GetGuildFromMasterIdx( pmsg->dwData2 );

	if( pGuild1 == NULL || pGuild2 == NULL )	return;

	// 주의! 길드전 테스트를 위해 멤버 수를 검사하지 않도록 함
	if( pGuild1->GetMemberNum() < 5 )
	{
		SendDeclareNackMsg( pmsg->dwData1, 2 );
		return;
	}
	else if( pGuild2->GetMemberNum() < 5 )
	{
		SendDeclareNackMsg( pmsg->dwData1, 3 );
		return;
	}
	else if( IsGuildWar( pGuild1->GetInfo().GuildIdx, pGuild2->GetInfo().GuildIdx ) )
	{
		return;
	}	

	// 071009 웅주, 길드1이 연합에 속하나 마스터 길드가 아닌 경우, 클라이언트 검사가 실패했거나 해킹임
	{
		CGuildUnion* guildUnion = GUILDUNIONMGR->GetUnion( pGuild1->GetUnionIndex() );

		if( guildUnion && guildUnion->GetMasterGuild() != pGuild1 )
		{
			return;
		}
	}

	CPlayer* guild1Master	= (CPlayer*)g_pUserTable->FindUser( pmsg->dwData1 );
	CPlayer* guild2Master	= (CPlayer*)g_pUserTable->FindUser( pmsg->dwData2 );

	// 071009 웅주, 길드2가 연합에 속하나 마스터 길드가 아닌 경우 길드1에게 알려준다
	{
		CGuildUnion* guildUnion = GUILDUNIONMGR->GetUnion( pGuild2->GetUnionIndex() );

		if( guildUnion && guildUnion->GetMasterGuild() != pGuild2 )
		{
			CGuild* masterGuild = guildUnion->GetMasterGuild();

			MSG_NAME message;
			message.Category	= MP_GUILD_WAR;
			message.Protocol	= MP_GUILD_WAR_DECLARE_NACK_BY_UNION;			
			SafeStrCpy( message.Name, masterGuild->GetGuildName(), sizeof( message.Name ) );

			guild1Master->SendMsg( &message, sizeof( message ) );
			
			return;
		}
	}

	//int rt = CanGuildWar( pGuild2->GetIdx(), pGuild1->GetIdx() );
	//if( rt != 0 )
	//{
	//	SendDeclareNackMsg( pmsg->dwData1, rt );
	//	return;
	//}	
	
	const DWORD money = pmsg->dwData3;

	if( guild1Master )
	{
		if( money > guild1Master->GetMoney() )
		{
			SendDeclareNackMsg( pmsg->dwData1, 98 );
			return;
		}

		MSG_BYTE message;
		message.Category = MP_GUILD_WAR;
		message.Protocol = MP_GUILD_WAR_WAIT;
		message.bData = MP_GUILD_WAR_DECLARE;		
		guild1Master->SendMsg( &message, sizeof( message ) );
	}

	if( guild2Master )
	{
		MSG_GUILD_LIST message;
		message.Category	= MP_GUILD_WAR;
		message.Protocol	= MP_GUILD_WAR_DECLARE;
		message.mSize		= 1;

		MSG_GUILD_LIST::Data&	dest	= message.mData[ 0 ];
		const GUILDINFO&		source	= pGuild1->GetInfo();

		// 제대로 복사되나 테스트할 것
		memcpy( &dest, &source, sizeof( source ) );

		dest.MarkName = money;

		CGuildUnion* alliance = GUILDUNIONMGR->GetUnion( source.UnionIdx );

		if( alliance )
		{
			SafeStrCpy( dest.mUnionName, alliance->GetName(), sizeof( dest.mUnionName ) );
		}
		else
		{
			dest.mUnionName[ 0 ] = 0;
		}

		guild2Master->SendMsg( &message, message.GetSize() );
	}
}