iw4x-client/iw4/Main.cpp

30 lines
614 B
C++
Raw Normal View History

2015-12-23 08:45:53 -05:00
#include "STDInclude.hpp"
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
2015-12-23 09:00:01 -05:00
static Utils::Hook EntryPointHook;
2015-12-23 08:45:53 -05:00
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
FreeConsole();
DWORD oldProtect;
VirtualProtect(GetModuleHandle(NULL), 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect);
2015-12-28 08:08:46 -05:00
EntryPointHook.Initialize(0x6BAC0F, [] ()
2015-12-23 08:45:53 -05:00
{
EntryPointHook.Uninstall();
Components::Loader::Initialize();
__asm jmp EntryPointHook.Place
2015-12-23 09:00:01 -05:00
2015-12-28 08:08:46 -05:00
})->Install();
2015-12-23 08:45:53 -05:00
}
else if (ul_reason_for_call == DLL_PROCESS_DETACH)
{
Components::Loader::Uninitialize();
}
return TRUE;
}