DWORD MyTutorialThread() // Our thread
{
const DWORD OFFSET1 = 0xCA5CEC;
char* _appName = "League of Legends.exe"; // or "League Of Legend.exe" or whatever module
DWORD _moduleBase = (DWORD)GetModuleHandleA(_appName);
for(;
// unlimited loop
{
if (_moduleBase)
{ // module is currently in target program's memory.
MessageBox(0,L"Module Found.",L"SUCCESS",2);
DWORD _firstAddr = *(DWORD*)(_moduleBase + OFFSET1);
MessageBox(0,L"Crash on line before this?",L"SUCCESS",2);
*(FLOAT*)_firstAddr = 3000;
}
else
{ // module not found in programs's memory.
MessageBox(0,L"Unable to find module.",L"ERROR",2);
}
}
}
hmm. I'm not sure why LoL.exe would crash... maybe _modBase+offset1 isn't valid and it's getting an access fault? I moved the messagebox to show before it tries to read the pointer. When you inject the dll, do you see any of the message boxes? How long before LoL.exe crashes? Is there a crash report / error message?
Another thing to try might be empty all the code out of MyTutorialThread() and see if injecting an empty function still causes the crash. (well, have a msgbox and sleep() so we can visually see it's running)