fix linux

This commit is contained in:
simplxs 2024-06-29 20:30:32 +08:00
parent 1a682ff12d
commit 260223e70b
No known key found for this signature in database
GPG Key ID: 1A3833A46D84A08C
2 changed files with 50 additions and 39 deletions

View File

@ -2,12 +2,8 @@
Server *server = nullptr;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
void init()
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
{
try
{
std::string ip = "0.0.0.0";
@ -17,7 +13,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
server->Init();
printf("Start Init sign\n");
std::thread([=] { // Cannot use & capture!!!!! will cause crash
std::thread([=] { // Cannot use '&' capture!!!!! will cause crash
for (int i = 0; i < 10; i++)
{
try
@ -42,8 +38,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
{
printf("Init failed: %s\n", e.what());
}
}
#if defined(_WIN_PLATFORM_)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
init();
break;
}
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
@ -58,3 +62,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
}
return TRUE;
}
#elif defined(_MAC_PLATFORM_) || defined(_LINUX_PLATFORM_)
int main()
{
init();
}
#endif

View File

@ -50,12 +50,13 @@ std::map<std::string, uint64_t> addrMap = {
{"6.9.20-17153", 0x1c73dd0}};
#endif
#elif defined(_LINUX_PLATFORM_)
#define CURRENT_VERSION "3.2.7-23361"
#define CURRENT_VERSION "3.2.9-24815"
#if defined(_X64_ARCH_)
std::map<std::string, uint64_t> addrMap = {
{"3.1.2-12912", 0x33C38E0},
{"3.1.2-13107", 0x33C3920},
{"3.2.7-23361", 0x4C93C57}};
{"3.2.7-23361", 0x4C93C57},
{"3.2.9-24815", 0x4E5D3B7}};
#elif defined(_ARM64_ARCH_)
std::map<std::string, uint64_t> addrMap = {
{"3.2.7-23361", 0x351EC98}};