This code made for DLL injection to a MineSweeper Game.
What it does is: Set Timer from 20 seconds to 100 seconds.
My problem is that it only executes once and it doesn’t work on the 2nd try, please help. I want this code to work every time you reset your game.
Code:
#include <windows.h>
//Define variables
DWORD ThreadID;
int *time = (int*)0x0100579C;
DWORD WINAPI changeTime(LPVOID lParam) {
while(1)
if(*time >= 20) {
*time = 100;
return 0;
}
}
BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD callReason, LPVOID lpReserved) {
if(callReason == DLL_PROCESS_ATTACH) {
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&changeTime, 0, 0, &ThreadID);
}
return 1;
}