iw4x-client/src/Components/Modules/AntiCheat.hpp

83 lines
1.9 KiB
C++
Raw Normal View History

2017-01-20 08:36:52 -05:00
#pragma once
2017-01-19 16:23:59 -05:00
#ifndef DEBUG
// Hide AntiCheat in embeded symbol names
#define AntiCheat SubComponent
#endif
// Uncomment to enable process protection (conflicts with steam!)
#define PROCTECT_PROCESS
2017-01-19 16:23:59 -05:00
namespace Components
{
class AntiCheat : public Component
{
public:
AntiCheat();
~AntiCheat();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
2017-01-20 08:36:52 -05:00
const char* getName() override { return "AntiCheat"; };
2017-01-19 16:23:59 -05:00
#endif
static void CrashClient();
static void InitLoadLibHook();
static void ReadIntegrityCheck();
static void ScanIntegrityCheck();
static void FlagIntegrityCheck();
static unsigned long ProtectProcess();
2017-01-19 16:23:59 -05:00
private:
enum IntergrityFlag
{
NO_FLAG = (0),
INITIALIZATION = (1 << 0),
MEMORY_SCAN = (1 << 1),
SCAN_INTEGRITY_CHECK = (1 << 2),
#ifdef PROCTECT_PROCESS
2017-01-19 16:23:59 -05:00
READ_INTEGRITY_CHECK = (1 << 3),
#endif
2017-01-19 16:23:59 -05:00
MAX_FLAG,
};
static Utils::Time::Interval LastCheck;
static std::string Hash;
static unsigned long Flags;
static void PerformScan();
static void PatchWinAPI();
static void NullSub();
static void AssertCalleeModule(void* callee);
static void UninstallLibHook();
static void InstallLibHook();
#ifdef DEBUG_LOAD_LIBRARY
2017-02-13 12:32:07 -05:00
static HANDLE LoadLibary(std::wstring library, HANDLE file, DWORD flags, void* callee);
2017-01-19 16:23:59 -05:00
static HANDLE WINAPI LoadLibaryAStub(const char* library);
static HANDLE WINAPI LoadLibaryWStub(const wchar_t* library);
2017-02-13 12:32:07 -05:00
static HANDLE WINAPI LoadLibaryExAStub(const char* library, HANDLE file, DWORD flags);
static HANDLE WINAPI LoadLibaryExWStub(const wchar_t* library, HANDLE file, DWORD flags);
2017-01-19 16:23:59 -05:00
#endif
static void LostD3DStub();
static void CinematicStub();
static void SoundInitStub(int a1, int a2, int a3);
static void SoundInitDriverStub();
static void DObjGetWorldTagPosStub();
static void AimTargetGetTagPosStub();
static void AcquireDebugPriviledge(HANDLE hToken);
2017-01-19 16:23:59 -05:00
static Utils::Hook LoadLibHook[4];
};
}