Jump to content

Get launcher size


Recommended Posts

  • Active Member

Client:

*Packet.h

typedef struct command_client_version
{
	BYTE header;
	char filename[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion;

typedef struct command_client_version2
{
	BYTE header;
	char filename[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion2;

Change:

typedef struct command_client_version
{
	BYTE header;
	char filename[32+1];
	char filesize[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion;

typedef struct command_client_version2
{
	BYTE header;
	char filename[32+1];
	char filesize[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion2;

 

*PythonNetworkStreamPhaseGame.cpp

Search

bool CPythonNetworkStream::SendClientVersionPacket()

Add it upper

static const char* GetMainFileSize(const char* FileName) {
	std::string sizebuf;
	HANDLE hFile = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	sizebuf = GetFileSize(hFile, NULL);
	return sizebuf.c_str();
}

 

Search /2x/

strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);

Add it under /2x/

strncpy(kVersionPacket.filesize, GetMainFileSize(filename.c_str()), sizeof(kVersionPacket.filename)-1);

 

Server:

*Packet.h

typedef struct command_client_version
{
	BYTE header;
	char filename[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion;

typedef struct command_client_version2
{
	BYTE header;
	char filename[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion2;

Change:

typedef struct command_client_version
{
	BYTE header;
	char filename[32+1];
	char filesize[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion;

typedef struct command_client_version2
{
	BYTE header;
	char filename[32+1];
	char filesize[32+1];
	char timestamp[32+1];
} TPacketCGClientVersion2;

 

*input.cpp

Search:

void CInputProcessor::Version(LPCHARACTER ch, const char* c_pData)
{
	if (!ch)
		return;

	TPacketCGClientVersion * p = (TPacketCGClientVersion *) c_pData;

Add it under

	if (strcmp(p->filesize, "CORRECT_SIZE")){
		ch->ChatPacket(CHAT_TYPE_NOTICE, "Illegal login detected");
		LogManager::instance().HackLog("CLIENT_CONFLICT", ch);
		ch->GetDesc()->SetPhase(PHASE_CLOSE);
		return;
	}

Change CORRECT_SIZE to yourself as string

untested

  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.