This commit is contained in:
momo5502 2016-05-14 15:32:43 +02:00
parent 1842366f56
commit f2cdd84416
8 changed files with 50 additions and 21 deletions

View File

@ -92,6 +92,12 @@ namespace Components
AntiCheat::Hash.clear();
}
BOOL WINAPI TestTest(const char* test)
{
OutputDebugStringA(test);
return FALSE;
}
void AntiCheat::InitLoadLibHook()
{
static uint8_t loadLibStub[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // xor eax, eax; retn 04h
@ -148,27 +154,42 @@ namespace Components
//AntiCheat::LoadLibHook[3].Install();
}
BOOL WINAPI AntiCheat::VirtualProtectStub(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
void AntiCheat::SoundInitStub()
{
AntiCheat::VirtualProtectHook.Uninstall(false);
AntiCheat::LoadLibHook[0].Uninstall();
AntiCheat::LoadLibHook[1].Uninstall();
//AntiCheat::LoadLibHook[2].Uninstall();
//AntiCheat::LoadLibHook[3].Uninstall();
if (flNewProtect == PAGE_WRITECOPY || flNewProtect == PAGE_READWRITE || flNewProtect == PAGE_EXECUTE_READWRITE || flNewProtect == PAGE_WRITECOMBINE)
{
DWORD addr = (DWORD)lpAddress;
DWORD start = 0x401000;
DWORD end = start + 0x2D6000;
Game::SND_InitDriver();
if (addr > start && addr < end)
{
OutputDebugStringA(Utils::VA("Write access to address %X", lpAddress));
}
}
BOOL retVal = VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
AntiCheat::VirtualProtectHook.Install(false);
return retVal;
AntiCheat::LoadLibHook[0].Install();
AntiCheat::LoadLibHook[1].Install();
//AntiCheat::LoadLibHook[2].Install();
//AntiCheat::LoadLibHook[3].Install();
}
// BOOL WINAPI AntiCheat::VirtualProtectStub(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
// {
// AntiCheat::VirtualProtectHook.Uninstall(false);
//
// if (flNewProtect == PAGE_WRITECOPY || flNewProtect == PAGE_READWRITE || flNewProtect == PAGE_EXECUTE_READWRITE || flNewProtect == PAGE_WRITECOMBINE)
// {
// DWORD addr = (DWORD)lpAddress;
// DWORD start = 0x401000;
// DWORD end = start + 0x2D6000;
//
// if (addr > start && addr < end)
// {
// OutputDebugStringA(Utils::VA("Write access to address %X", lpAddress));
// }
// }
//
// BOOL retVal = VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
// AntiCheat::VirtualProtectHook.Install(false);
// return retVal;
// }
AntiCheat::AntiCheat()
{
// This is required for debugging...in release mode :P
@ -183,6 +204,8 @@ namespace Components
AntiCheat::CrashClient();
});
#else
Utils::Hook(0x60BE8E, AntiCheat::SoundInitStub, HOOK_CALL).Install()->Quick();
Utils::Hook(0x418204, AntiCheat::SoundInitStub, HOOK_CALL).Install()->Quick();
Utils::Hook(0x507BD5, AntiCheat::PatchWinAPI, HOOK_CALL).Install()->Quick();
QuickPatch::OnFrame(AntiCheat::Frame);

View File

@ -22,6 +22,7 @@ namespace Components
static void NullSub();
static void SoundInitStub();
static BOOL WINAPI VirtualProtectStub(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
static Utils::Hook LoadLibHook[4];

View File

@ -7,4 +7,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -368,7 +368,7 @@ namespace Components
else
{
info->state = Auth::STATE_INVALID;
Game::SV_KickClientError(client, Utils::VA("Your security level (%d) does not match the server's security level (%d)", userLevel, ourLevel));
Game::SV_KickClientError(client, Utils::VA("Your security level (%d) is lower than the server's security level (%d)", userLevel, ourLevel));
}
}
else

View File

@ -35,13 +35,13 @@ namespace Components
void Command::Add(const char* name, Command::Callback* callback)
{
Command::FunctionMap[Utils::StrToLower(name)] = callback;
Game::Cmd_AddCommand(name, Command::MainCallback, Command::Allocate(), 0);
Command::AddRaw(name, Command::MainCallback);
}
void Command::AddSV(const char* name, Command::Callback* callback)
{
Command::FunctionMapSV[Utils::StrToLower(name)] = callback;
Game::Cmd_AddServerCommand(name, Command::MainCallbackSV, Command::Allocate());
Command::AddRawSV(name, Command::MainCallbackSV);
// If the main command is registered as Cbuf_AddServerText, the command will be redirected to the SV handler
Command::AddRaw(name, Game::Cbuf_AddServerText);

View File

@ -62,7 +62,7 @@ namespace Components
{
//maxclientCount = Dvar::Var("sv_maxclients").Get<int>();
maxclientCount = Game::Party_GetMaxPlayers(*Game::partyIngame);
clientCount = Game::PartyHost_CountMembers((Game::PartyData_s*)0x1081C00);
clientCount = Game::PartyHost_CountMembers(reinterpret_cast<Game::PartyData_s*>(0x1081C00));
}
wclear(Console::InfoWindow);

View File

@ -129,6 +129,8 @@ namespace Game
SL_ConvertToString_t SL_ConvertToString = (SL_ConvertToString_t)0x4EC1D0;
SL_GetString_t SL_GetString = (SL_GetString_t)0x4CDC10;
SND_InitDriver_t SND_InitDriver = (SND_InitDriver_t)0x4F5090;
Steam_JoinLobby_t Steam_JoinLobby = (Steam_JoinLobby_t)0x49CF70;
SV_GameClientNum_Score_t SV_GameClientNum_Score = (SV_GameClientNum_Score_t)0x469AC0;

View File

@ -302,6 +302,9 @@ namespace Game
typedef short(__cdecl * SL_GetString_t)(const char *str, unsigned int user);
extern SL_GetString_t SL_GetString;
typedef void(__cdecl * SND_InitDriver_t)();
extern SND_InitDriver_t SND_InitDriver;
typedef void(__cdecl * Steam_JoinLobby_t)(SteamID, char);
extern Steam_JoinLobby_t Steam_JoinLobby;