[AntiCheat] Introduce LibUnlocker
This commit is contained in:
parent
0ac7f39b05
commit
2c3f445f8f
@ -329,40 +329,30 @@ namespace Components
|
||||
|
||||
void AntiCheat::PatchWinAPI()
|
||||
{
|
||||
AntiCheat::UninstallLibHook();
|
||||
LibUnlocker _;
|
||||
|
||||
// Initialize directx
|
||||
Utils::Hook::Call<void()>(0x5078C0)();
|
||||
|
||||
AntiCheat::InstallLibHook();
|
||||
}
|
||||
|
||||
void AntiCheat::SoundInitStub(int a1, int a2, int a3)
|
||||
{
|
||||
AntiCheat::UninstallLibHook();
|
||||
|
||||
LibUnlocker _;
|
||||
Game::SND_Init(a1, a2, a3);
|
||||
|
||||
AntiCheat::InstallLibHook();
|
||||
}
|
||||
|
||||
void AntiCheat::SoundInitDriverStub()
|
||||
{
|
||||
AntiCheat::UninstallLibHook();
|
||||
|
||||
LibUnlocker _;
|
||||
Game::SND_InitDriver();
|
||||
|
||||
AntiCheat::InstallLibHook();
|
||||
}
|
||||
|
||||
void AntiCheat::LostD3DStub()
|
||||
{
|
||||
AntiCheat::UninstallLibHook();
|
||||
LibUnlocker _;
|
||||
|
||||
// Reset directx
|
||||
Utils::Hook::Call<void()>(0x508070)();
|
||||
|
||||
AntiCheat::InstallLibHook();
|
||||
}
|
||||
|
||||
__declspec(naked) void AntiCheat::CinematicStub()
|
||||
|
@ -20,6 +20,19 @@ namespace Components
|
||||
AntiCheat();
|
||||
~AntiCheat();
|
||||
|
||||
class LibUnlocker
|
||||
{
|
||||
public:
|
||||
LibUnlocker()
|
||||
{
|
||||
UninstallLibHook();
|
||||
}
|
||||
~LibUnlocker()
|
||||
{
|
||||
InstallLibHook();
|
||||
}
|
||||
};
|
||||
|
||||
static void CrashClient();
|
||||
|
||||
static void InitLoadLibHook();
|
||||
|
@ -123,11 +123,21 @@ namespace Utils
|
||||
|
||||
void SafeShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd)
|
||||
{
|
||||
__try
|
||||
#ifndef DISABLE_ANTICHEAT
|
||||
Components::AntiCheat::LibUnlocker _;
|
||||
#endif
|
||||
|
||||
[=]()
|
||||
{
|
||||
ShellExecuteA(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
|
||||
}
|
||||
__finally {}
|
||||
__try
|
||||
{
|
||||
ShellExecuteA(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
|
||||
}
|
||||
__finally
|
||||
{}
|
||||
}();
|
||||
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
void OpenUrl(std::string url)
|
||||
|
Loading…
Reference in New Issue
Block a user