Alright so I'm new to DLLs. I'm trying to make a DLL to inject/attach to a game emulator, and here's my code
Code:
#include <windows.h>
#include <cstdio>
#include <cstdlib>
void cheats();
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
cheats();
break;
case DLL_PROCESS_DETACH:
cheats();
break;
case DLL_THREAD_ATTACH:
cheats();
break;
case DLL_THREAD_DETACH:
cheats();
break;
}
cheats();
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}
void cheats()
{
// the base address is dynamic.. this gets it from the base pointer
int dynamic_base_address = *((int*)0x0059EC80);
// get the hp using the base address and the offset
int* hp = (int*)(dynamic_base_address+0x98);
// set hp & max hp to 257
*hp = 0x01010101;
}
// just in case it calls int main
int main(){
cheats();}
but whether I inject the DLL with an injector, attach it to the process with the compiler, or just run debug with the program set as a host program, nothing happens. Even when I made cheats()
Code:
void cheats() { system("C:\windows\system32\mshearts.exe"); }
nothing happened. I'm using DevC++ (downloading teamSuite).