Jump to content

Check your Files with Client Source


Recommended Posts

  • Active Member

UserInterface/CheckLatestFiles.cpp

Select all codes and change with this

#include "StdAfx.h"
#if defined(CHECK_LATEST_DATA_FILES)
#include "CheckLatestFiles.h"
#include "resource.h"

static struct SCHECKFILELIST {
	const char*		szFileName;
	DWORD			dwCRC32;
	ULONGLONG		ullSize;
} s_astFileHashList[] = {
	//   filename                   crc(dword)      size(ull)[optional]
	{ "errorlog.txt",				0xf7c257a0,				135 },
	{ "file1.py",					0xf15468a0,				169 },
	{ "file.epk",					0xf7685410,				465 }
	//etc.
};

static bool gs_bQuit = false;
bool CheckLatestFiles_PollEvent( void )
{
	return gs_bQuit;
}

int GetFileSize(char* FileName) {
	HANDLE hFile = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	return GetFileSize(hFile, NULL);
}

inline bool is_file_exist(const std::string& name) {
	struct stat buffer;
	return (stat(name.c_str(), &buffer) == 0);
}

// 데이타 파일 CRC32 값 검사하기 //size control added
bool CheckFileHash( const char* szFileName, DWORD dwCRC32, ULONGLONG ullFileSize = NULL)
{
	char szMessage[256];

	if (!is_file_exist(szFileName)) {
		_snprintf(szMessage, sizeof(szMessage)/sizeof(szMessage[0])-1, ApplicationStringTable_GetStringz(IDS_ERR_CANNOT_READ_FILE, "ERR_CANNOT_READ_FILE"), szFileName);
		ApplicationSetErrorString(szMessage);
		return false;
	}

	else {
		DWORD dwLocalCRC32 = GetFileCRC32(szFileName);
		if (dwCRC32 != dwLocalCRC32) {
			_snprintf(szMessage, sizeof(szMessage)/sizeof(szMessage[0])-1, ApplicationStringTable_GetStringz(IDS_ERR_NOT_LATEST_FILE, "ERR_NOT_LATEST_FILE"), szFileName);
			ApplicationSetErrorString(szMessage);
			return false;
		}
		else {
			int ullLocalSize = GetFileSize(szFileName);
			if ( ullFileSize) {
				if (ullLocalSize != ullFileSize) {
					ApplicationSetErrorString(("%s size not valid", szFileName));
					return false;
				}
			}
		}
	}

	return true;
}

UINT CALLBACK CheckLatestFilesEntry(void * pThis)
{
	::Sleep( 500 );
	for( int i=0; s_astFileHashList[i].szFileName; i++ ) {
		if(s_astFileHashList[i].ullSize) {
			if(!CheckFileHash(s_astFileHashList[i].szFileName, s_astFileHashList[i].dwCRC32, s_astFileHashList[i].ullSize)){
				gs_bQuit = true;
				break;
			}
		}
		else {
			if(!CheckFileHash(s_astFileHashList[i].szFileName, s_astFileHashList[i].dwCRC32)){
				gs_bQuit = true;
				break;
			}
		}
	}
	return true;
}

bool CheckLatestFiles( void )
{
	unsigned int uThreadID = 0;

	HANDLE hThread = (HANDLE) _beginthreadex(NULL, 0, CheckLatestFilesEntry, NULL, 0, &uThreadID);
	::SetThreadPriority(hThread, THREAD_PRIORITY_LOWEST);
	return true;
}
#endif

 

 

Now change or add

	{ "errorlog.txt",				0xf7c257a0,				135 },
	{ "file1.py",					0xf15468a0,				169 },
	{ "file.epk",					0xf7685410,				465 }

This list according to yourself(Size is optional)

 

Now open Locale_inc.h 

#define CHECK_LATEST_DATA_FILES

and add this line

Edited by Koray
  • Love 2
Link to comment
Share on other sites

i used this without changes months ago but it took too much time especially if you forget it or something like that , the size check could be usefull but if not protected then it is kids play to edit it.

 I've been using that since March 2014 with changes..

but for you, you have to change the CRC32 to something else md5 for example ...

 

because: http://lmgtfy.com/?q=peid+crc+fix

with such tools you can fix the crc and bypass the check :)

Edited by metin2team
Link to comment
Share on other sites

Everything you have written there is wrong.

​Prove it

Unlike you who, only copy that is on dev, and seel for money.
I do not sell protections that are already free.

What I mean is that no one should sell what is not his.
I am against you, who are working illegally sell and source.

 

Edited by Ira™
Link to comment
Share on other sites

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.