Entirely block dll injections
This commit is contained in:
parent
b3fbc045a9
commit
5fffac5bab
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 52f62e3652ce80ab14593331f4277539e7fa29c8
|
||||
Subproject commit 584233bd043a80b2172a598039113d4fe14dc326
|
@ -35,11 +35,12 @@ namespace Components
|
||||
0xDC, 0xC1, 0xDC, 0x05,
|
||||
|
||||
// Uninstall minidump handler
|
||||
0xB8, 0x63, 0xE7, 0x2F, 0x00, // mov eax, 2FE763h
|
||||
0x05, 0xAD, 0xAD, 0x3C, 0x00, // add eax, 3CADADh
|
||||
0x6A, 0x58, // push 88
|
||||
0x8B, 0x80, 0xEA, 0x01, 0x00, 0x00, // mov eax, [eax + 1EAh]
|
||||
0xFF, 0x10, // call dword ptr [eax]
|
||||
// This doesn't work anymore, due to the SetUnhandledExceptionFilter hook, but that's not important
|
||||
//0xB8, 0x63, 0xE7, 0x2F, 0x00, // mov eax, 2FE763h
|
||||
//0x05, 0xAD, 0xAD, 0x3C, 0x00, // add eax, 3CADADh
|
||||
//0x6A, 0x58, // push 88
|
||||
//0x8B, 0x80, 0xEA, 0x01, 0x00, 0x00, // mov eax, [eax + 1EAh]
|
||||
//0xFF, 0x10, // call dword ptr [eax]
|
||||
|
||||
// Crash me.
|
||||
0xB8, 0x4F, 0x91, 0x27, 0x00, // mov eax, 27914Fh
|
||||
@ -62,15 +63,6 @@ namespace Components
|
||||
// Push the fake var onto the stack
|
||||
push ebx
|
||||
|
||||
// Get address to VirtualProtect
|
||||
mov eax, 6567h
|
||||
shl eax, 0Ch
|
||||
or eax, 70000A50h
|
||||
|
||||
// Move the address into ebx
|
||||
push eax
|
||||
pop ebx
|
||||
|
||||
// Save the address to our crash procedure
|
||||
mov eax, offset crashProcedure
|
||||
push eax
|
||||
@ -80,9 +72,10 @@ namespace Components
|
||||
push 40h
|
||||
push 2D5FFFh
|
||||
push 401001h
|
||||
call ebx
|
||||
call VirtualProtect
|
||||
|
||||
// Increment to our crash procedure
|
||||
// Skip variable space
|
||||
add dword ptr [esp], 4h
|
||||
|
||||
// This basically removes the pushed ebx value from the stack, so returning results in a call to the procedure
|
||||
@ -126,12 +119,39 @@ namespace Components
|
||||
AntiCheat::PerformCheck();
|
||||
}
|
||||
|
||||
void AntiCheat::PatchWinAPI()
|
||||
{
|
||||
auto loadLibStub = [] ()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
xor eax, eax
|
||||
retn 4h
|
||||
}
|
||||
};
|
||||
|
||||
auto loadLibExStub = [] ()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
xor eax, eax
|
||||
retn 0Ch
|
||||
}
|
||||
};
|
||||
|
||||
Utils::Hook(LoadLibraryA, loadLibStub, HOOK_JUMP).Install()->Quick();
|
||||
Utils::Hook(LoadLibraryW, loadLibStub, HOOK_JUMP).Install()->Quick();
|
||||
Utils::Hook(LoadLibraryExA, loadLibExStub, HOOK_JUMP).Install()->Quick();
|
||||
Utils::Hook(LoadLibraryExW, loadLibExStub, HOOK_JUMP).Install()->Quick();
|
||||
}
|
||||
|
||||
AntiCheat::AntiCheat()
|
||||
{
|
||||
AntiCheat::EmptyHash();
|
||||
|
||||
Renderer::OnFrame(AntiCheat::Frame);
|
||||
Dedicated::OnFrame(AntiCheat::Frame);
|
||||
|
||||
QuickPatch::OnFrame(AntiCheat::Frame);
|
||||
QuickPatch::Once(AntiCheat::PatchWinAPI);
|
||||
|
||||
#ifdef DEBUG
|
||||
Command::Add("penis", [] (Command::Params)
|
||||
|
@ -16,6 +16,7 @@ namespace Components
|
||||
|
||||
static void Frame();
|
||||
static void PerformCheck();
|
||||
static void PatchWinAPI();
|
||||
|
||||
static void NullSub();
|
||||
};
|
||||
|
@ -375,8 +375,7 @@ namespace Components
|
||||
});
|
||||
|
||||
// Install frame handlers
|
||||
Dedicated::OnFrame(Auth::Frame);
|
||||
Renderer::OnFrame(Auth::Frame);
|
||||
QuickPatch::OnFrame(Auth::Frame);
|
||||
|
||||
// Register dvar
|
||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Components
|
||||
{
|
||||
wink::signal<wink::slot<Dedicated::Callback>> Dedicated::FrameSignal;
|
||||
wink::signal<wink::slot<Dedicated::Callback>> Dedicated::FrameOnceSignal;
|
||||
|
||||
bool Dedicated::IsDedicated()
|
||||
{
|
||||
@ -143,6 +144,11 @@ namespace Components
|
||||
Network::SendCommand(master, "heartbeat", "IW4");
|
||||
}
|
||||
|
||||
void Dedicated::Once(Dedicated::Callback* callback)
|
||||
{
|
||||
Dedicated::FrameOnceSignal.connect(callback);
|
||||
}
|
||||
|
||||
void Dedicated::OnFrame(Dedicated::Callback* callback)
|
||||
{
|
||||
Dedicated::FrameSignal.connect(callback);
|
||||
@ -151,6 +157,8 @@ namespace Components
|
||||
void Dedicated::FrameStub()
|
||||
{
|
||||
Dedicated::FrameSignal();
|
||||
Dedicated::FrameOnceSignal();
|
||||
Dedicated::FrameOnceSignal.clear();
|
||||
Utils::Hook::Call<void()>(0x5A8E80)();
|
||||
}
|
||||
|
||||
@ -245,6 +253,7 @@ namespace Components
|
||||
|
||||
Dedicated::~Dedicated()
|
||||
{
|
||||
Dedicated::FrameOnceSignal.clear();
|
||||
Dedicated::FrameSignal.clear();
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,11 @@ namespace Components
|
||||
static void Heartbeat();
|
||||
|
||||
static void OnFrame(Callback* callback);
|
||||
static void Once(Callback* callback);
|
||||
|
||||
private:
|
||||
static wink::signal<wink::slot<Callback>> FrameSignal;
|
||||
static wink::signal<wink::slot<Callback>> FrameOnceSignal;
|
||||
|
||||
static void MapRotate();
|
||||
static void FrameStub();
|
||||
|
@ -393,14 +393,7 @@ namespace Components
|
||||
{
|
||||
#ifdef ENABLE_EXPERIMENTAL_UDP_DOWNLOAD
|
||||
// Frame handlers
|
||||
if (Dedicated::IsDedicated())
|
||||
{
|
||||
Dedicated::OnFrame(Download::Frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer::OnFrame(Download::Frame);
|
||||
}
|
||||
QuickPatch::OnFrame(Download::Frame);
|
||||
|
||||
// Register client handlers
|
||||
Network::Handle("dlAckRequest", Download::AckRequest);
|
||||
|
@ -133,8 +133,7 @@ namespace Components
|
||||
{
|
||||
Logger::PipeOutput(nullptr);
|
||||
|
||||
Renderer::OnFrame(Logger::Frame); // Client
|
||||
Dedicated::OnFrame(Logger::Frame); // Dedi
|
||||
QuickPatch::OnFrame(Logger::Frame);
|
||||
|
||||
Utils::Hook(Game::Com_PrintMessage, Logger::PrintMessageStub, HOOK_JUMP).Install()->Quick();
|
||||
}
|
||||
|
@ -700,8 +700,7 @@ namespace Components
|
||||
});
|
||||
|
||||
// Install frame handlers
|
||||
Dedicated::OnFrame(Node::FrameHandler);
|
||||
Renderer::OnFrame(Node::FrameHandler);
|
||||
QuickPatch::OnFrame(Node::FrameHandler);
|
||||
}
|
||||
|
||||
Node::~Node()
|
||||
|
@ -21,6 +21,30 @@ namespace Components
|
||||
QuickPatch::ShutdownSignal();
|
||||
}
|
||||
|
||||
void QuickPatch::OnFrame(QuickPatch::Callback* callback)
|
||||
{
|
||||
if (Dedicated::IsDedicated())
|
||||
{
|
||||
Dedicated::OnFrame(callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer::OnFrame(callback);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickPatch::Once(QuickPatch::Callback* callback)
|
||||
{
|
||||
if (Dedicated::IsDedicated())
|
||||
{
|
||||
Dedicated::Once(callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer::Once(callback);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickPatch::UnlockStats()
|
||||
{
|
||||
Command::Execute("setPlayerData prestige 10");
|
||||
|
@ -12,6 +12,9 @@ namespace Components
|
||||
static void UnlockStats();
|
||||
static void OnShutdown(Callback* callback);
|
||||
|
||||
static void OnFrame(Callback* callback);
|
||||
static void Once(Callback* callback);
|
||||
|
||||
private:
|
||||
static wink::signal<wink::slot<Callback>> ShutdownSignal;
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace Components
|
||||
{
|
||||
Utils::Hook Renderer::DrawFrameHook;
|
||||
wink::signal<wink::slot<Renderer::Callback>> Renderer::FrameSignal;
|
||||
wink::signal<wink::slot<Renderer::Callback>> Renderer::FrameOnceSignal;
|
||||
|
||||
void __declspec(naked) Renderer::FrameHook()
|
||||
{
|
||||
@ -17,6 +18,13 @@ namespace Components
|
||||
void Renderer::FrameHandler()
|
||||
{
|
||||
Renderer::FrameSignal();
|
||||
Renderer::FrameOnceSignal();
|
||||
Renderer::FrameOnceSignal.clear();
|
||||
}
|
||||
|
||||
void Renderer::Once(Renderer::Callback* callback)
|
||||
{
|
||||
Renderer::FrameOnceSignal.connect(callback);
|
||||
}
|
||||
|
||||
void Renderer::OnFrame(Renderer::Callback* callback)
|
||||
@ -43,6 +51,7 @@ namespace Components
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
Renderer::DrawFrameHook.Uninstall();
|
||||
Renderer::FrameOnceSignal.clear();
|
||||
Renderer::FrameSignal.clear();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace Components
|
||||
static int Width();
|
||||
static int Height();
|
||||
|
||||
static void Once(Callback* callback);
|
||||
static void OnFrame(Callback* callback);
|
||||
|
||||
private:
|
||||
@ -19,6 +20,7 @@ namespace Components
|
||||
static void FrameHandler();
|
||||
|
||||
static wink::signal<wink::slot<Callback>> FrameSignal;
|
||||
static wink::signal<wink::slot<Callback>> FrameOnceSignal;
|
||||
static Utils::Hook DrawFrameHook;
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,10 @@ namespace Utils
|
||||
{
|
||||
public:
|
||||
Hook() : Place(nullptr), Stub(nullptr), Initialized(false), Installed(false), Original(0), UseJump(false), Protection(0) { ZeroMemory(Hook::Buffer, sizeof(Hook::Buffer)); }
|
||||
|
||||
Hook(void* place, void* stub, bool useJump = true) : Hook() { Hook::Initialize(place, stub, useJump); }
|
||||
Hook(void* place, void(*stub)(), bool useJump = true) : Hook(place, reinterpret_cast<void*>(stub), useJump) {}
|
||||
|
||||
Hook(DWORD place, void* stub, bool useJump = true) : Hook(reinterpret_cast<void*>(place), stub, useJump) {}
|
||||
Hook(DWORD place, DWORD stub, bool useJump = true) : Hook(reinterpret_cast<void*>(place), reinterpret_cast<void*>(stub), useJump) {}
|
||||
Hook(DWORD place, void(*stub)(), bool useJump = true) : Hook(reinterpret_cast<void*>(place), reinterpret_cast<void*>(stub), useJump) {}
|
||||
|
Loading…
Reference in New Issue
Block a user