Hey fallmoon where have our found these sources codes:
See if you can make anything out of this code
--------------------------------------------------------------------------------
//--begin
void CGameServerShell::ProcessHandshake(HCLIENT hClient, HMESSAGEREAD hMessage)
{
// Get the player
CPlayerObj *pPlayer = GetPlayerFromClientList(hClient);
if (!pPlayer)
{
g_pLTServer->CPrint("Handshake failed for an unknown client!");
// Uh... Who are you again?
g_pLTServer->KickClient(hClient, GAME_DISCON_BADHANDSHAKE);
return;
}
int nHandshakeSub = (int)g_pLTServer->ReadFromMessageByte(hMessage);
switch (nHandshakeSub)
{
case MID_HANDSHAKE_HELLO :
{
// Check the client's version
int nHandshakeVer = (int)g_pLTServer->ReadFromMessageWord(hMessage);
if (nHandshakeVer != GAME_HANDSHAKE_VER)
{
g_pLTServer->CPrint("Handshake failed for '%s'!", pPlayer->GetNetName());
g_pLTServer->CPrint(" '%s' was booted due to an invalid version number (%d not %d)",
pPlayer->GetNetName(), nHandshakeVer, GAME_HANDSHAKE_VER);
// If they got here, they ignored our different version number. Boot 'em!
g_pLTServer->KickClient(hClient, GAME_DISCON_BADHANDSHAKE);
// Jump out of the handshake
return;
}
// Read in the client's sooper-secret key
uint32 nClientKey = (uint32)g_pLTServer->ReadFromMessageDWord(hMessage);
// Write out a password message, encrypted with their key
// Note : A key from them that null encrypts our key doesn't really effect
// anything.. I mean, they DID send the key, and they're the ones that need
// to use our key anyway..
HMESSAGEWRITE hResponse = g_pLTServer->StartMessage(hClient, MID_HANDSHAKE);
g_pLTServer->WriteToMessageByte(hResponse, MID_HANDSHAKE_PASSWORD);
g_pLTServer->WriteToMessageDWord(hResponse, GAME_HANDSHAKE_PASSWORD);
g_pLTServer->EndMessage(hResponse);
}
break;
case MID_HANDSHAKE_LETMEIN :
{
// Get the client's password
uint32 nClientPassword = g_pLTServer->ReadFromMessageDWord(hMessage);
uint32 nXORMask = GAME_HANDSHAKE_MASK;
nClientPassword ^= nXORMask;
if (nClientPassword != GAME_HANDSHAKE_PASSWORD)
{
g_pLTServer->CPrint("Handshake failed for '%s'!", pPlayer->GetNetName());
g_pLTServer->CPrint(" '%s' was booted due to an invalid password",
pPlayer->GetNetName());
// They're a fake!!
g_pLTServer->KickClient(hClient, GAME_DISCON_BADHANDSHAKE);
return;
}
// Read in their weapons file CRC
uint32 nWeaponCRC = g_pWeaponMgr->GetFileCRC();
nWeaponCRC ^= nXORMask;
uint32 nClientCRC = g_pLTServer->ReadFromMessageDWord(hMessage);
if (nWeaponCRC != nClientCRC)
{
g_pLTServer->CPrint("Handshake failed for '%s'!", pPlayer->GetNetName());
g_pLTServer->CPrint(" '%s' was booted due to an invalid weapon file",
pPlayer->GetNetName());
// They're cheating!!
g_pLTServer->KickClient(hClient, GAME_DISCON_BADWEAPONS);
return;
}
// Read in their client file CRC
uint32 nCShellCRC = CRC32::CalcRezFileCRC("cshell.dll");
nCShellCRC ^= nXORMask;
nClientCRC = g_pLTServer->ReadFromMessageDWord(hMessage);
if (nCShellCRC != nClientCRC)
{
g_pLTServer->CPrint("Handshake failed for '%s'!", pPlayer->GetNetName());
g_pLTServer->CPrint(" '%s' was booted due to an invalid client shell",
pPlayer->GetNetName());
// They're cheating!!
g_pLTServer->KickClient(hClient, GAME_DISCON_BADCSHELL);
return;
}
// Tell the client they passed the test...
HMESSAGEWRITE hResponse = g_pLTServer->StartMessage(hClient, MID_HANDSHAKE);
g_pLTServer->WriteToMessageByte(hResponse, MID_HANDSHAKE_DONE);
g_pLTServer->EndMessage(hResponse);
// Unlock the player
pPlayer->FinishHandshake();
// Spawn them in..
RespawnPlayer(pPlayer, hClient);
}
break;
default :
{
g_pLTServer->CPrint("Handshake failed for '%s'!", pPlayer->GetNetName());
g_pLTServer->CPrint(" '%s' was booted due to an invalid handshake message (%d)",
pPlayer->GetNetName(), nHandshakeSub);
// Hmm.. They sent over an invalid handshake message. They're naughty.
g_pLTServer->KickClient(hClient, GAME_DISCON_BADHANDSHAKE);
return;
}
}
}
//--end
Reply