Removed security & anti-cheat measures
This commit is contained in:
@ -25,10 +25,6 @@
|
||||
#include "../EterBase/Debug.h"
|
||||
#include "../EterBase/CRC32.h"
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
#include <ThemidaSDK.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@ -585,10 +581,6 @@ bool CEterPack::Get(CMappedFile& out_file, const char * filename, LPCVOID * data
|
||||
}
|
||||
else if (COMPRESSED_TYPE_HYBRIDCRYPT == index->compressed_type || COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB == index->compressed_type)
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
CLZObject * zObj = new CLZObject;
|
||||
|
||||
if( !m_pCSHybridCryptPolicy->DecryptMemory( std::string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )
|
||||
@ -613,9 +605,6 @@ bool CEterPack::Get(CMappedFile& out_file, const char * filename, LPCVOID * data
|
||||
{
|
||||
*data = zObj->GetBuffer();
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -698,10 +687,6 @@ bool CEterPack::Get2(CMappedFile& out_file, const char * filename, TEterPackInde
|
||||
}
|
||||
else if (COMPRESSED_TYPE_HYBRIDCRYPT == index->compressed_type || COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB == index->compressed_type)
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
CLZObject * zObj = new CLZObject;
|
||||
|
||||
if( !m_pCSHybridCryptPolicy->DecryptMemory( std::string(filename), static_cast<const BYTE*>(*data), index->data_size, *zObj) )
|
||||
@ -727,9 +712,6 @@ bool CEterPack::Get2(CMappedFile& out_file, const char * filename, TEterPackInde
|
||||
{
|
||||
*data = zObj->GetBuffer();
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -810,9 +792,6 @@ bool CEterPack::Extract()
|
||||
}
|
||||
else if (COMPRESSED_TYPE_HYBRIDCRYPT == index->compressed_type || COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB == index->compressed_type)
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
if( !m_pCSHybridCryptPolicy->DecryptMemory( std::string(index->filename), (const BYTE *) data + index->data_position, index->data_size, zObj) )
|
||||
return false;
|
||||
|
||||
@ -834,9 +813,6 @@ bool CEterPack::Extract()
|
||||
writeFile.Write(zObj.GetBuffer(), zObj.GetBufferSize());
|
||||
}
|
||||
zObj.Clear();
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
}
|
||||
else if (COMPRESSED_TYPE_NONE == index->compressed_type)
|
||||
writeFile.Write((const char *) data + index->data_position, index->data_size);
|
||||
@ -891,9 +867,6 @@ bool CEterPack::Put(const char * filename, const char * sourceFilename, BYTE pac
|
||||
|
||||
if( packType == COMPRESSED_TYPE_HYBRIDCRYPT || packType == COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
m_pCSHybridCryptPolicy->GenerateCryptKey( std::string(filename) );
|
||||
|
||||
if( packType == COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB )
|
||||
@ -903,9 +876,6 @@ bool CEterPack::Put(const char * filename, const char * sourceFilename, BYTE pac
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
}
|
||||
|
||||
return Put(filename, pMappedData, iMappedDataSize, packType);
|
||||
@ -994,10 +964,6 @@ bool CEterPack::Put(const char * filename, LPCVOID data, long len, BYTE packType
|
||||
}
|
||||
else if (packType == COMPRESSED_TYPE_HYBRIDCRYPT || packType == COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
if( !m_pCSHybridCryptPolicy->EncryptMemory( std::string(filename), (const BYTE *)data, len, zObj ) )
|
||||
{
|
||||
return false;
|
||||
@ -1005,10 +971,6 @@ bool CEterPack::Put(const char * filename, LPCVOID data, long len, BYTE packType
|
||||
|
||||
data = zObj.GetBuffer();
|
||||
len = zObj.GetBufferSize();
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,15 +115,10 @@ class CEterPack
|
||||
const std::string& GetPathName();
|
||||
const char * GetDBName();
|
||||
|
||||
//THEMIDA
|
||||
bool Get(CMappedFile & mappedFile, const char * filename, LPCVOID * data);
|
||||
//THEMIDA
|
||||
bool Get2(CMappedFile & mappedFile, const char * filename, TEterPackIndex* index, LPCVOID * data);
|
||||
|
||||
|
||||
//THEMIDA
|
||||
bool Put(const char * filename, const char * sourceFilename, BYTE packType, const std::string& strRelateMapName);
|
||||
//THEMIDA
|
||||
bool Put(const char * filename, LPCVOID data, long len, BYTE packType);
|
||||
|
||||
bool Delete(const char * filename);
|
||||
|
@ -12,11 +12,6 @@
|
||||
#define PATH_ABSOLUTE_YMIRWORK1 "d:/ymir work/"
|
||||
#define PATH_ABSOLUTE_YMIRWORK2 "d:\\ymir work\\"
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
#include <ThemidaSDK.h>
|
||||
#endif
|
||||
|
||||
|
||||
CEterPack* CEterPackManager::FindPack(const char* c_szPathName)
|
||||
{
|
||||
std::string strFileName;
|
||||
|
@ -37,13 +37,10 @@ class CEterPackManager : public CSingleton<CEterPackManager>
|
||||
void SetSearchMode(bool bPackFirst);
|
||||
int GetSearchMode();
|
||||
|
||||
//THEMIDA
|
||||
bool Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
|
||||
//THEMIDA
|
||||
bool GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
|
||||
//THEMIDA
|
||||
bool GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
bool isExist(const char * c_szFileName);
|
||||
bool isExistInPack(const char * c_szFileName);
|
||||
@ -58,12 +55,9 @@ class CEterPackManager : public CSingleton<CEterPackManager>
|
||||
const char * GetRootPackFileName();
|
||||
|
||||
//for hybridcrypt
|
||||
//THEMIDA
|
||||
void WriteHybridCryptPackInfo(const char* pFileName);
|
||||
|
||||
//THEMIDA
|
||||
void RetrieveHybridCryptPackKeys( const BYTE* pStream );
|
||||
//THEMIDA
|
||||
void RetrieveHybridCryptPackSDB( const BYTE* pStream );
|
||||
|
||||
// <20><DEB8> <20><><EFBFBD>ε<EFBFBD> <20>ѵ<EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD> <20>͵<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
|
@ -13,9 +13,6 @@ using namespace CryptoPP;
|
||||
|
||||
#define CIPHER_MODE CTR_Mode
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
#include <ThemidaSDK.h>
|
||||
#endif
|
||||
//Cipher
|
||||
//Block Size
|
||||
//Key Length
|
||||
@ -66,10 +63,6 @@ bool EterPackPolicy_CSHybridCrypt::IsContainingCryptKey() const
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::GenerateCryptKey( std::string& rfileName )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
//make lower & extract ext
|
||||
std::string extName = GetFileExt(rfileName);
|
||||
stl_lowers(extName);
|
||||
@ -97,19 +90,11 @@ bool EterPackPolicy_CSHybridCrypt::GenerateCryptKey( std::string& rfileName )
|
||||
}
|
||||
m_mapHybridCryptKey[dwExtHash] = info;
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::GetPerFileCryptKey( std::string& rfileName, eHybridCipherAlgorithm& eAlgorithm, TEncryptKey& key, TEncryptIV& iv )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
std::string fileNamelower = rfileName;
|
||||
stl_lowers(fileNamelower);
|
||||
|
||||
@ -131,8 +116,6 @@ bool EterPackPolicy_CSHybridCrypt::GetPerFileCryptKey( std::string& rfileName, e
|
||||
::memcpy(key.key, cit->second.uEncryptKey.key, sizeof(key) );
|
||||
::memcpy(iv.iv, cit->second.uEncryptIV.iv, sizeof(iv) );
|
||||
|
||||
|
||||
//Themida Warning
|
||||
for( int i = 0; i < (sizeof(key)/sizeof(dwfileNameCrc)); ++i)
|
||||
{
|
||||
*((DWORD*)key.key + i) ^= dwfileNameCrc;
|
||||
@ -141,9 +124,6 @@ bool EterPackPolicy_CSHybridCrypt::GetPerFileCryptKey( std::string& rfileName, e
|
||||
{
|
||||
*((DWORD*)iv.iv + i) ^= dwfileNameCrc;
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -151,10 +131,6 @@ bool EterPackPolicy_CSHybridCrypt::GetPerFileCryptKey( std::string& rfileName, e
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::EncryptMemory( std::string& rfileName, IN const BYTE* pSrcData, IN int iSrcLen, OUT CLZObject& zObj )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
eHybridCipherAlgorithm eAlgorithm;
|
||||
TEncryptKey key;
|
||||
TEncryptIV iv;
|
||||
@ -207,19 +183,11 @@ bool EterPackPolicy_CSHybridCrypt::EncryptMemory( std::string& rfileName, IN con
|
||||
zObj.AllocBuffer(iSrcLen);
|
||||
memcpy(zObj.GetBuffer(), strCipher.c_str(), strCipher.length() );
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::DecryptMemory( std::string& rfilename, IN const BYTE* pEncryptedData, IN int iEncryptedLen, OUT CLZObject& zObj )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
eHybridCipherAlgorithm eAlgorithm;
|
||||
TEncryptKey key;
|
||||
TEncryptIV iv;
|
||||
@ -273,10 +241,6 @@ bool EterPackPolicy_CSHybridCrypt::DecryptMemory( std::string& rfilename, IN con
|
||||
zObj.AllocBuffer(iEncryptedLen);
|
||||
memcpy(zObj.GetBuffer(), strDecipher.c_str(), strDecipher.length() );
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -336,10 +300,6 @@ int EterPackPolicy_CSHybridCrypt::ReadCryptKeyInfoFromStream( IN const BYTE* pSt
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::GenerateSupplementaryDataBlock(std::string& rfilename, const std::string& strMapName, IN const BYTE* pSrcData, IN int iSrcLen, OUT LPBYTE& pDestData, OUT int& iDestLen )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
std::string fileNamelower = rfilename;
|
||||
stl_lowers( fileNamelower );
|
||||
|
||||
@ -385,19 +345,13 @@ bool EterPackPolicy_CSHybridCrypt::GenerateSupplementaryDataBlock(std::string& r
|
||||
|
||||
memcpy( &sdbVector[0], pDestData + iDestLen, iSDBSize );
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EterPackPolicy_CSHybridCrypt::GetSupplementaryDataBlock( std::string& rfilename, OUT LPBYTE& pSDB, OUT int& iSDBSize )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
std::string fileNamelower = rfilename;
|
||||
stl_lowers( fileNamelower );
|
||||
|
||||
@ -421,9 +375,6 @@ bool EterPackPolicy_CSHybridCrypt::GetSupplementaryDataBlock( std::string& rfile
|
||||
}
|
||||
|
||||
pSDB = (BYTE*)&vecSDB[0];
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -468,10 +419,6 @@ void EterPackPolicy_CSHybridCrypt::WriteSupplementaryDataBlockToFile( CFileBase&
|
||||
|
||||
int EterPackPolicy_CSHybridCrypt::ReadSupplementatyDataBlockFromStream( IN const BYTE* pStream )
|
||||
{
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
//DWORD dwFileIdentifier;
|
||||
//std::vector<BYTE> vecSDBStream;
|
||||
|
||||
@ -495,9 +442,5 @@ int EterPackPolicy_CSHybridCrypt::ReadSupplementatyDataBlockFromStream( IN const
|
||||
m_mapSDBMap[dwFileNameHash] = info;
|
||||
}
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return iStreamOffset;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ enum eHybridCipherAlgorithm
|
||||
class CFileBase;
|
||||
class CLZObject;
|
||||
|
||||
//THEMIDA
|
||||
class EterPackPolicy_CSHybridCrypt
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user