Aller au contenu

C++ - Vérification de l'Intégrité


Messages recommandés

Temps estimé : ~ 5 minutes

 

C'est un check permettant de vérifier l'intégralité de votre dossier du client

 

PythonNetworkStreamPhaseGame.cpp

Au dessus de :

BOOL gs_bEmpireLanuageEnable = TRUE;

Insérez :

Révélation
#ifdef ENABLE_CHECK_PACK_FILE
static std::vector <std::string> vWhiteList =
{
		"bgm",
		"channel.inf",
		"config.exe",
		"d3dx8.dll",
		"d3dx9_26.dll",
		"devil.dll",
		"enbconvertor.ini",
		"ErrorLog.txt",
		"Forsaken.exe",
		"Metin2Test.exe",
		"Protect.dll",
		"granny2.dll",
		"lib",
		"locale.cfg",
		"mark",
		"metin2.cfg",
		"miles",
		"mouse.cfg",
		"MSS32.DLL",
		"pack",
		"magasin",
		"python27.dll",
		"screenshot",
		"SpeedTreeRT.dll",
		"syserr.txt",
		"upload"
};

static std::vector <std::string> vWhiteListPack =
{
"bgm.eix",
"bgm.epk",
"bgm",
"desktop.ini",
"effect.eix",
"effect.epk",
"effect",
"effect2.eix",
"effect2.epk",
"effect2",
"etc.eix",
"etc.epk",
"etc",
"extensiion.bat",
"guild.eix",
"guild.epk",
"guild",
"icon.eix",
"icon.epk",
"icon",
"Index",
"item.eix",
"item.epk",
"item",
"list_korenb.txt",
"locale_de.eix",
"locale_de.epk",
"locale_de",
"maps.eix",
"maps.epk",
"maps",
"maps2.eix",
"maps2.epk",
"maps2",
"monster.eix",
"monster.epk",
"monster",
"npc.eix",
"npc.epk",
"npc",
"pc_assassin.eix",
"pc_assassin.epk",
"pc_assassin",
"pc_common.eix",
"pc_common.epk",
"pc_common",
"pc_shaman.eix",
"pc_shaman.epk",
"pc_shaman",
"pc_sura.eix",
"pc_sura.epk",
"pc_sura",
"pc_warrior.eix",
"pc_warrior.epk",
"pc_warrior",
"property.eix",
"property.epk",
"property",
"root.eix",
"root.epk",
"root",
"season.eix",
"season.epk",
"season",
"sound.eix",
"sound.epk",
"sound",
"terrain.eix",
"terrain.epk",
"terrain",
"textureset.eix",
"textureset.epk",
"textureset",
"tree.eix",
"tree.epk",
"tree",
"update_costume_weapon.eix",
"update_costume_weapon.epk",
"update_costume_weapon",
"update_dragon_skill.eix",
"update_dragon_skill.epk",
"update_dragon_skill",
"update_dungeon_orc.eix",
"update_dungeon_orc.epk",
"update_dungeon_orc",
"update_new_armors.eix",
"update_new_armors.epk",
"update_new_armors",
"update_new_costume.eix",
"update_new_costume.epk",
"update_new_costume",
"update_new_dungeon.eix",
"update_new_dungeon.epk",
"update_new_dungeon",
"update_new_effect.eix",
"update_new_effect.epk",
"update_new_effect",
"update_new_emotion.eix",
"update_new_emotion.epk",
"update_new_emotion",
"update_new_hairs.eix",
"update_new_hairs.epk",
"update_new_hairs",
"update_new_instance",
"update_new_mailbox.eix",
"update_new_mailbox.epk",
"update_new_mailbox",
"update_new_maps.eix",
"update_new_maps.epk",
"update_new_maps",
"update_new_monkey.eix",
"update_new_monkey.epk",
"update_new_monkey",
"update_new_mount",
"update_new_npc.eix",
"update_new_npc.epk",
"update_new_npc",
"update_new_stuff.eix",
"update_new_stuff.epk",
"update_new_stuff",
"update_new_system.eix",
"update_new_system.epk",
"update_new_system",
"update_new_weapon.eix",
"update_new_weapon.epk",
"update_new_weapon",
"update_new_worldboss.eix",
"update_new_worldboss.epk",
"update_new_worldboss",
"zone.eix",
"zone.epk",
"zone",
"zone2.eix",
"zone2.epk",
"zone2",
"zone3.eix",
"zone3.epk",
"zone3",
"zone4.eix",
"zone4.epk",
"zone4",
"zone5.eix",
"zone5.epk",
"zone5",
"zone6.eix",
"zone6.epk",
"zone6"
};

static std::vector <std::string> vWhiteListlib =
{
"abc.pyc",
"base64.pyc",
"bisect.pyc",
"codecs.pyc",
"collections.pyc",
"color",
"copy.pyc",
"copy_reg.pyc",
"encodings",
"fnmatch.pyc",
"freakservers_protect.pyc",
"functools.pyc",
"genericpath.pyc",
"heapq.pyc",
"item_proto_list.py",
"item_proto_list.pyc",
"keyword.pyc",
"linecache.pyc",
"locale.pyc",
"localization",
"ntpath.pyc",
"os.pyc",
"pyexpat.pyd",
"pyexpat_d.pdb",
"pyexpat_d.pyd",
"python22.lib",
"python23.lib",
"re.pyc",
"secur.dll",
"shutil.pyc",
"sistem.py",
"site.pyc",
"socket.pyc",
"SocketServer.pyc",
"sre_compile.pyc",
"sre_constants.pyc",
"sre_parse.pyc",
"stat.pyc",
"string.pyc",
"struct.pyc",
"sysconfig.pyc",
"traceback.pyc",
"types.pyc",
"uiPet.py",
"uiPet.pyc",
"UserDict.pyc",
"warnings.pyc",
"weakref.pyc",
"xml",
"_abcoll.pyc",
"_locale.pyc",
"_socket.pyd",
"_weakrefset.pyc",
"__future__.pyc"
};

static std::string GetRootPath()
{
	char szBuffer[MAX_PATH];
	if (GetModuleFileNameA(NULL, szBuffer, MAX_PATH))
	{
		std::string szPath = std::string(szBuffer);
		size_t nPos = szPath.find_last_of("\\/");
		szPath = szPath.substr(0, nPos);

		DWORD dwAttrib = GetFileAttributesA(szPath.c_str());
		if (szPath.empty() == false && dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
		{
			return szPath;
		}
	}
	return std::string("");
}

static void FileChecks()
{
	std::string szRootPath = GetRootPath();
	if (szRootPath.empty())
	{
		//		printf("Root path not found! Error: %u\n", GetLastError());
		return;
	}
	std::string szSearchPath = szRootPath + "/lib/*.*";

	WIN32_FIND_DATAA w32fd;
	HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
	if (hFind != INVALID_HANDLE_VALUE)
	{
		do {
			std::string szCurrentItem = w32fd.cFileName;
			if (szCurrentItem != "." && szCurrentItem != "..")
			{
				//				printf("\tCurrent %s\n", szCurrentItem.c_str());

				if (std::find(vWhiteListlib.begin(), vWhiteListlib.end(), szCurrentItem) == vWhiteListlib.end()) // not whitelisted item
				{
					//					printf("\tUnknown file: %s\n", szCurrentItem.c_str());

					if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
					{
						std::string szWarn = "Fichier inconnu : " + szCurrentItem + ", Veuillez le supprimer pour continuer.";
						MessageBoxA(0, szWarn.c_str(), 0, 0);

						PostQuitMessage(0);
					}
				}
			}
		} while (FindNextFileA(hFind, &w32fd));
		FindClose(hFind);
	}
}

static void FileCheckPack()
{
	std::string szRootPath = GetRootPath();
	if (szRootPath.empty())
	{
		//		printf("Root path not found! Error: %u\n", GetLastError());
		return;
	}
	std::string szSearchPath = szRootPath + "/pack/*.*";

	WIN32_FIND_DATAA w32fd;
	HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
	if (hFind != INVALID_HANDLE_VALUE)
	{
		do {
			std::string szCurrentItem = w32fd.cFileName;
			if (szCurrentItem != "." && szCurrentItem != "..")
			{
				//				printf("\tCurrent %s\n", szCurrentItem.c_str());

				if (std::find(vWhiteListPack.begin(), vWhiteListPack.end(), szCurrentItem) == vWhiteListPack.end()) // not whitelisted item
				{
					//					printf("\tUnknown file: %s\n", szCurrentItem.c_str());

					if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
					{
						std::string szWarn = "Fichier inconnu : " + szCurrentItem + ", Veuillez le supprimer pour continuer.";
						MessageBoxA(0, szWarn.c_str(), 0, 0);

						PostQuitMessage(0);
					}
				}
			}
		} while (FindNextFileA(hFind, &w32fd));
		FindClose(hFind);
	}
}

static void FileCheckRoutine()
{
	std::string szRootPath = GetRootPath();
	if (szRootPath.empty())
	{
		//		printf("Root path not found! Error: %u\n", GetLastError());
		return;
	}
	//	printf("Root: %s\n", szRootPath.c_str());
	std::string szSearchPath = szRootPath + "/*.*";

	WIN32_FIND_DATAA w32fd;
	HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
	if (hFind != INVALID_HANDLE_VALUE)
	{
		do {
			std::string szCurrentItem = w32fd.cFileName;
			if (szCurrentItem != "." && szCurrentItem != "..")
			{
				//				printf("\tCurrent %s\n", szCurrentItem.c_str());

				if (std::find(vWhiteList.begin(), vWhiteList.end(), szCurrentItem) == vWhiteList.end()) // not whitelisted item
				{
					//					printf("\tUnknown file: %s\n", szCurrentItem.c_str());

					if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
					{
						std::string szWarn = "Fichier inconnu : " + szCurrentItem + ", Veuillez le supprimer pour continuer.";
						MessageBoxA(0, szWarn.c_str(), 0, 0);

						PostQuitMessage(0);
					}
				}
			}
		} while (FindNextFileA(hFind, &w32fd));
		FindClose(hFind);
	}
}
#endif

 

 

En dessous de :

static DWORD s_nextRefreshTime = ELTimer_GetMSec();

Ajoutez

Révélation

#ifdef ENABLE_CHECK_PACK_FILE
    static DWORD s_nextFileCheckTime = ELTimer_GetMSec();
#endif

 

En dessous de  :

    DWORD curTime = ELTimer_GetMSec();
    if (s_nextRefreshTime > curTime)
        return;

Ajoutez:

Révélation
#ifdef ENABLE_CHECK_PACK_FILE
	if (s_nextFileCheckTime <= curTime)
	{
		FileCheckPack();
		FileCheckRoutine();
		FileChecks();
		s_nextFileCheckTime = curTime + 800;
	}
#endif

 

 

  • J'adore 1

Service Payant 

Développeur C++ / Python / Lua

Discord : Mustang#1649

 

 

Lien à poster
  • ASIKOO changed the title to C++ - Vérification de l'Intégrité

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant


×
×
  • Créer...

Information importante

Conditions d’utilisation / Politique de confidentialité / Règles / Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.