Alright, Well I did some research and I think I have to use GetModuleInformation to get the entry point address of the dll. From that I can add the address. But it's still not working, I am so sick of this here is my entire code:
Code:
#include <windows.h>
#include <Psapi.h>
#include <string.h>
#include <stdio.h>
DWORD Cheats = NULL;
DWORD Consistency = NULL;
DWORD Timescale = NULL;
DWORD Wallhack = NULL;
bool Hack = false;
void HackFunction()
{
while(1)
{
POINT pos;
GetCursorPos(&pos);
double mouse_x = pos.x;
double mouse_y = pos.y;
if(GetAsyncKeyState(VK_INSERT)&1)
{
Hack=!Hack;
if(Hack)
{
MessageBoxA(NULL,"Hack turned on.", "Manipulator", NULL);
Cheats = 1;
Consistency = 0;
Timescale = 4;
Wallhack = 2;
}
if(!Hack)
{
MessageBoxA(NULL, "Hack turned off.", "Manipulator", NULL);
Cheats = 0;
Consistency = 1;
Timescale = 1;
Wallhack = 1;
}
}
if(GetAsyncKeyState(VK_LBUTTON) && Hack)
{
SetCursorPos((int)mouse_x,(int)mouse_y+3);
Sleep(23);
}
if(GetAsyncKeyState(VK_HOME))
{
break;
}
Sleep(10);
}
}
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
if( ul_reason_for_call == DLL_PROCESS_ATTACH)
{
while(GetModuleHandle("engine.dll")==NULL)
{
Sleep(1);
}
if(GetModuleHandle("engine.dll")!=NULL)
{
HMODULE ModHandle=NULL;
MODULEINFO info = {0};
while(ModHandle==NULL)
{
ModHandle = GetModuleHandle("engine.dll");
}
GetModuleInformation(GetCurrentProcess(),ModHandle,&info,sizeof(info));
DWORD Cheats = (DWORD)((DWORD)(info.EntryPoint)+0x544810);
DWORD Consistency = (DWORD)((DWORD)(info.EntryPoint)+0x544A50);
DWORD Timescale = (DWORD)((DWORD)(info.EntryPoint)+0x393D94);
DWORD Wallhack = (DWORD)((DWORD)(info.EntryPoint)+0x4C89A8);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&HackFunction, NULL, 0, NULL );
if(GetLastError()==0)
{
MessageBoxA(NULL, "DLL injected and thread created successfully.", "Manipulator", MB_OK);
}
else
if(GetLastError!=0)
{
char lasterr[128];
sprintf(lasterr, "%x", GetLastError());
MessageBox(0, lasterr, "ERROR", 0);
}
}
}
return TRUE;
}
(edit3) Alright, I've finally fixed it enough so that the game no longer crashes, unfortunately it's not changing Cheats or anything...
~lilneo