Skip to content

Inject a temporary DLL (CPlusPlus)

erfg12 edited this page Dec 5, 2017 · 1 revision

If you want to trigger an internal function, but want to remain safe from anti-cheat methods you can inject a temporary DLL that will detach after execution.

#include "windows.h"
#include "Stdafx.h"
#include <string>
using namespace std;

#define MovePlayerNow 0x004B459C;

void EQTFunctions() {
	typedef void(__thiscall* CGCamera__ResetView)();
	CGCamera__ResetView ResetView = (CGCamera__ResetView)MovePlayerNow;
	ResetView();
}

void OnAttach(HMODULE hModule) {
EQTFunctions();
FreeLibraryAndExitThread( hModule, 0 );                               
ExitThread( 0 );
}

BOOL APIENTRY DllMain(HMODULE hModule,
DWORD  ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
	CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)OnAttach, hModule, 0, NULL);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
	break;
}
return TRUE;
}