From 954b4d71fdadfa9b39f5d49668524ac1143fd07c Mon Sep 17 00:00:00 2001 From: Ivailo Spasov Date: Sat, 6 Jul 2013 02:52:53 +0300 Subject: [PATCH] Update l4d2 linux signatures Signed-off-by: Ivailo Spasov --- l4d1_signature_linux.h | 8 ++++---- l4d1_signature_win32.h | 8 +++----- l4d2_signature_linux.h | 34 +++++++++++++++++----------------- l4d2_signature_win32.h | 7 +++---- l4dtoolz_mm.cpp | 15 ++++----------- signature.cpp | 18 +++++++++++++++++- signature.h | 1 + 7 files changed, 49 insertions(+), 42 deletions(-) diff --git a/l4d1_signature_linux.h b/l4d1_signature_linux.h index 76f7dd9..b5c796b 100644 --- a/l4d1_signature_linux.h +++ b/l4d1_signature_linux.h @@ -1,10 +1,9 @@ #ifndef _INCLUDE_L4D1_SIGNATURE_LINUX_ #define _INCLUDE_L4D1_SIGNATURE_LINUX_ -const char* server_dll = "server.so"; -const char* engine_dll = "engine.so"; -const char* matchmaking_dll = "matchmaking_ds.so"; -const char* matchmaking_dll_alt = "matchmaking.so"; +const char* server_dll[] = {"server.so", 0}; +const char* engine_dll[] = {"engine.so", 0}; +const char* matchmaking_dll[] = {"matchmaking_ds.so", "matchmaking.so", 0}; //CBaseServer::GetMaxHumanPlayers(void)const //fuction is in engine.so @@ -42,6 +41,7 @@ const char* players = "\x13\x83\xBB\xC3\xC3\xC3\xC3\x01\x7F\xC3\x8B\x80\x0C\xC3\ const char* players_new = "\x02\x07\x90\x90"; void* players_org = NULL; +const char* players2 = "\x13\x83\xBB\xC3\xC3\xC3\xC3\x01\x7F\xC3\x8B\x80\x0C\xC3\xC3\x00\x89\xC3\xC3\xE8"; const char* players_new2 = "\x03\x1D\x89\xC2\xEB"; void* players_org2 = NULL; diff --git a/l4d1_signature_win32.h b/l4d1_signature_win32.h index 41d2bde..778b0f4 100644 --- a/l4d1_signature_win32.h +++ b/l4d1_signature_win32.h @@ -1,10 +1,9 @@ #ifndef _INCLUDE_L4D1_SIGNATURE_WIN32_ #define _INCLUDE_L4D1_SIGNATURE_WIN32_ -const char* server_dll = "server.dll"; -const char* engine_dll = "engine.dll"; -const char* matchmaking_dll = "matchmaking_ds.dll"; -const char* matchmaking_dll_alt = "matchmaking.dll"; +const char* server_dll[] = {"server.dll", 0}; +const char* engine_dll[] = {"engine.dll", 0}; +const char* matchmaking_dll[] = {"matchmaking_ds.dll", "matchmaking.dll", 0}; const char* friends_lobby = "\x12\x56\x8B\xF1\x8B\x0D\xC3\xC3\xC3\xC3\x85\xC9\x74\xC3\x8B\x01\x8B\x50\x48"; unsigned char friends_lobby_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3}; @@ -33,7 +32,6 @@ const char* players2 = "\x10\x56\x8B\xF1\x8B\x86\xC3\x02\x00\x00\x8B\x4C\x24\x08 const char* players_new2 = "\x02\x0F\x90\x90"; void* players_org2 = NULL; - const char* unreserved = "\x1E\x81\xEC\xC3\xC3\x00\x00\x55\x8B\xAC\xC3\xC3\xC3\x00\x00\x56\x8B\xB4\xC3\xC3\xC3\x00\x00\x57\x8B\xBC\xC3\xC3\xC3\x00\x00"; const char* unreserved_new = "\x01\x00\xC3"; void* unreserved_org = NULL; diff --git a/l4d2_signature_linux.h b/l4d2_signature_linux.h index 2fb0204..4e65072 100644 --- a/l4d2_signature_linux.h +++ b/l4d2_signature_linux.h @@ -1,44 +1,44 @@ #ifndef _INCLUDE_L4D2_SIGNATURE_LINUX_ #define _INCLUDE_L4D2_SIGNATURE_LINUX_ -const char* server_dll = "server.so"; -const char* engine_dll = "engine.so"; -const char* matchmaking_dll = "matchmaking_ds.so"; -const char* matchmaking_dll_alt = "matchmaking.so"; +const char* server_dll[] = {"server_srv.so", "server.so", 0}; +const char* engine_dll[] = {"engine_srv.so", "engine.so", 0}; +const char* matchmaking_dll[] = {"matchmaking_ds_srv.so", "matchmaking_srv.so", "matchmaking_ds.so", "matchmaking.so", 0}; -const char* friends_lobby = "\x18\x55\x89\xE5\x56\x53\x83\xEC\x10\xE8\xC3\xC3\xC3\xC3\x81\xC3\xC3\xC3\xC3\xC3\x8B\xC3\xC3\x8B\x83"; +const char* friends_lobby = "\x19\x55\x89\xE5\x53\x83\xEC\xC3\xA1\xC3\xC3\xC3\xC3\x8B\x5D\x08\x85\xC0\x74\x1D\x8B\x10\x89\x04\x24\xFF"; unsigned char friends_lobby_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3}; void *friends_lobby_org = NULL; -const char* lobby_sux = "\x09\x8B\x86\x7C\x01\x00\x00\x85\xC0\x74"; -const char* lobby_sux_new = "\x02\x08\x90\x90"; +const char* lobby_sux = "\x13\xFF\x50\xC3\x84\xC0\x0F\x84\xC3\xC3\xC3\xC3\x8B\xB3\xC3\x01\x00\x00\x85\xF6"; +const char* lobby_sux_new = "\x06\x0B\xBE\x01\x00\x00\x00\x90"; void *lobby_sux_org = NULL; -const char* max_players = "\x10\xFF\xC3\xC3\x03\xC3\xC3\x29\xC7\x3B\xBE\x7C\x01\x00\x00\x0F\x8F"; -char max_players_new[]= {0x06, 0x08, 0x83, 0xFF, 0x3C, 0x90, 0x90, 0x90}; +const char* max_players = "\x16\x89\xC6\x8B\x03\x89\x1C\x24\xFF\x50\xC3\x29\xC6\x03\x75\xC3\x3B\xB3\xC3\x01\x00\x00\x0F"; +char max_players_new[]= {0x06, 0x08, 0x83, 0xFE, 0x3C, 0x90, 0x90, 0x90}; void *max_players_org = NULL; -const char* server_bplayers ="\x21\x55\x89\xE5\x53\x83\xEC\x14\xE8\xC3\xC3\xC3\xC3\x81\xC3\xC3\xC3\xC3\xC3\x8B\x83\xC3\xC3\xC3\xC3\x8B\x10\xB8\xFF\xFF\xFF\xFF\x85\xD2"; +const char* server_bplayers = "\x1A\xA1\xC3\xC3\xC3\xC3\x55\x89\xE5\x85\xC0\x74\xC3\x8B\x10\x89\x45\x08\x5D\x8B\x82\xC3\x02\x00\x00\xFF\xE0"; unsigned char server_bplayers_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3}; void *server_bplayers_org = NULL; -const char* human_limit = "\x11\x8B\x55\xC3\x8B\x02\x89\x14\xC3\xFF\x90\x24\x02\x00\x00\x39\xF8\x7E"; -const char* human_limit_new = "\x02\x10\x90\x90"; +const char* human_limit = "\x18\x39\x58\x14\x7D\xD7\x8B\x07\x89\x3C\x24\xFF\x90\xC3\xC3\x00\x00\x39\xF0\x7E\xC3\x8B\x45\xC3\x89"; +const char* human_limit_new = "\x02\x12\x90\x90"; void *human_limit_org = NULL; -const char* players = "\x13\x83\xBB\xC3\xC3\xC3\xC3\x01\x7F\xC3\x8B\x80\x0C\xC3\xC3\x00\x89\xC3\xC3\xE8"; +const char* players = "\x13\x83\x3D\xC3\xC3\xC3\x00\x01\x7F\xC3\x8B\x80\xC3\xC3\x00\x00\x89\x04\x24\xE8"; const char* players_new = "\x02\x07\x90\x90"; void *players_org = NULL; -const char* players_new2 = "\x01\x1F\xEB"; +const char* players2 = "\x23\x55\x89\xE5\x53\x83\xEC\xC3\x8B\x5D\x08\x8B\x55\x0C\x8B\x83\xC3\xC3\x00\x00\x39\xD0\x7C\x0B\x8B\x83\xC3\xC3\x00\x00\x39\xC2\x0F\x4D\xC2\x8B"; +const char* players_new2 = "\x01\x15\xEB"; void *players_org2 = NULL; -const char* unreserved = "\x1F\x55\x89\xE5\x57\x56\x53\x81\xEC\x4C\x01\x00\x00\xE8\xC3\xC3\xC3\xC3\x81\xC3\xC3\xC3\xC3\x00\x8B\x75\xC3\x8B\x55\xC3\x8B\x45"; +const char* unreserved = "\x1D\x55\x89\xE5\x81\xEC\xC3\xC3\x00\x00\x89\x5D\xF4\x8B\x5D\x08\x89\x75\xF8\x8B\x55\x10\x89\x7D\xFC\x8B\x75\xC3\x8B\x8B"; const char* unreserved_new = "\x01\x00\xC3"; void *unreserved_org = NULL; -const char* lobby_match = "\x0A\x55\x89\xE5\xB8\x08\x00\x00\x00\x5D\xC3"; -unsigned char lobby_match_new[] = {0x01, 0x04, 0xC3}; +const char* lobby_match = "\x0A\x55\xB8\x08\x00\x00\x00\x89\xE5\x5D\xC3"; +unsigned char lobby_match_new[] = {0x01, 0x02, 0xC3}; void *lobby_match_org = NULL; #endif //_INCLUDE_L4D2_SIGNATURE_LINUX_ diff --git a/l4d2_signature_win32.h b/l4d2_signature_win32.h index 52fa753..a332e42 100644 --- a/l4d2_signature_win32.h +++ b/l4d2_signature_win32.h @@ -1,10 +1,9 @@ #ifndef _INCLUDE_L4D2_SIGNATURE_WIN32_ #define _INCLUDE_L4D2_SIGNATURE_WIN32_ -const char* server_dll = "server.dll"; -const char* engine_dll = "engine.dll"; -const char* matchmaking_dll = "matchmaking_ds.dll"; -const char* matchmaking_dll_alt = "matchmaking.dll"; +const char* server_dll[] = {"server.dll", 0}; +const char* engine_dll[] = {"engine.dll", 0}; +const char* matchmaking_dll[] = {"matchmaking_ds.dll", "matchmaking.dll", 0}; const char* friends_lobby = "\x12\x56\x8B\xF1\x8B\x0D\xC3\xC3\xC3\xC3\x85\xC9\x74\xC3\x8B\x01\x8B\x50\x48"; unsigned char friends_lobby_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3}; diff --git a/l4dtoolz_mm.cpp b/l4dtoolz_mm.cpp index 53c15a8..4be7fc8 100644 --- a/l4dtoolz_mm.cpp +++ b/l4dtoolz_mm.cpp @@ -148,17 +148,14 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool base_addr.addr = NULL; base_addr.len = 0; - find_base(matchmaking_dll, &base_addr); - - if(base_addr.addr == NULL) - find_base(matchmaking_dll_alt, &base_addr); + find_base_from_list(matchmaking_dll, &base_addr); if(!lobby_match_ptr) { lobby_match_ptr = find_signature(lobby_match, &base_addr, 1); get_original_signature(lobby_match_ptr, lobby_match_new, lobby_match_org); } - find_base(engine_dll, &base_addr); + find_base_from_list(engine_dll, &base_addr); if(!max_players_friend_lobby) { max_players_friend_lobby = find_signature(friends_lobby, &base_addr, 0); get_original_signature(max_players_friend_lobby, friends_lobby_new, friends_lobby_org); @@ -185,11 +182,7 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool if(!tmp_player) { tmp_player = find_signature(players, &base_addr, 0); if(tmp_player) { -#ifdef WIN32 tmp_player2 = find_signature(players2, &base_addr, 0); -#else - tmp_player2 = tmp_player; -#endif if(tmp_player2) { get_original_signature(tmp_player, players_new, players_org); write_signature(tmp_player, players_new); @@ -205,7 +198,7 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool get_original_signature(unreserved_ptr, unreserved_new, unreserved_org); } - find_base(server_dll, &base_addr); + find_base_from_list(server_dll, &base_addr); if(!chuman_limit) { chuman_limit = find_signature(human_limit, &base_addr, 0); @@ -274,7 +267,7 @@ const char *l4dtoolz::GetVersion() #ifdef __GIT_VERSION return __GIT_VERSION; #else - return "1.0.0.9g-unknown"; + return "1.0.0.9h-unknown"; #endif } diff --git a/signature.cpp b/signature.cpp index 857c6d4..3c0e101 100644 --- a/signature.cpp +++ b/signature.cpp @@ -160,6 +160,22 @@ int find_base(const char* name, struct base_addr_t *base_addr) } +int find_base_from_list(const char *name[], struct base_addr_t *base_addr) +{ + int ret = 0; + int i = 0; + base_addr->addr = NULL; + base_addr->len = 0; + + if (name == NULL) + return 0; + + while (name[i] != NULL && !(ret = find_base(name[i], base_addr))) + i++; + + return ret; +} + int write_signature(const void* addr, const void* signature) { if(!addr) @@ -188,7 +204,7 @@ int write_signature(const void* addr, const void* signature) #endif return 1; } -#include + int read_signature(const void *addr, void *signature) { unsigned int u_addr_sign; diff --git a/signature.h b/signature.h index ebeb1e1..30323cd 100644 --- a/signature.h +++ b/signature.h @@ -8,6 +8,7 @@ struct base_addr_t{ void *find_signature(const char *mask, struct base_addr_t *base_addr, int pure); int find_base(const char *name, struct base_addr_t *base_addr); +int find_base_from_list(const char *name[], struct base_addr_t *base_addr); int write_signature(const void *addr, const void *signature); int read_signature(const void *addr, void *signature); int get_original_signature(const void *offset, const void *new_sig, void *&org_sig);