2019-01-02 07:44:27 +08:00
|
|
|
#include "match.h"
|
2018-12-21 23:10:51 +08:00
|
|
|
#include "main.h"
|
|
|
|
#include "native/pchooks.h"
|
|
|
|
|
2019-02-28 00:33:17 +08:00
|
|
|
extern const char* HIJACK_ERROR;
|
|
|
|
|
2018-12-21 23:10:51 +08:00
|
|
|
namespace Engine
|
|
|
|
{
|
2019-01-31 04:02:23 +08:00
|
|
|
void HookDirectX()
|
|
|
|
{
|
|
|
|
|
|
|
|
for (std::wstring DXVersion : { L"d3dx9", L"d3dx10" })
|
|
|
|
if (HMODULE module = GetModuleHandleW(DXVersion.c_str())) PcHooks::hookD3DXFunctions(module);
|
|
|
|
else for (int i = 0; i < 50; ++i)
|
|
|
|
if (HMODULE module = GetModuleHandleW((DXVersion + L"_" + std::to_wstring(i)).c_str())) PcHooks::hookD3DXFunctions(module);
|
|
|
|
}
|
2018-12-21 23:10:51 +08:00
|
|
|
void Hijack()
|
|
|
|
{
|
|
|
|
static bool hijacked = false;
|
|
|
|
if (hijacked) return;
|
|
|
|
hijacked = true;
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
PcHooks::hookGDIFunctions();
|
|
|
|
PcHooks::hookGDIPlusFunctions();
|
|
|
|
PcHooks::hookOtherPcFunctions();
|
2019-01-31 04:02:23 +08:00
|
|
|
HookDirectX();
|
2018-12-21 23:10:51 +08:00
|
|
|
}
|
2019-01-02 07:44:27 +08:00
|
|
|
__except (EXCEPTION_EXECUTE_HANDLER) { ConsoleOutput(HIJACK_ERROR); }
|
2018-12-21 23:10:51 +08:00
|
|
|
}
|
|
|
|
}
|