Check the return on GetModuleHandle. You need to give your target some time to load dynamically linked libraries. If it fails to get the base of the module, you need to go again until it is finally loaded.
GetModuleHandle will return null if it has encountered an error.
If you got the offset using ollydbg, I think olly shows the base of the DLL with the added RVA. Not the actual base.
Someone correct me, I'm not good with the PE crap..
When a game crashes un expectedly its usually due to one of two reasons:
1. Memory Access:
- u tried to write over mem that was read only
- accessing memory out of bonds
2. Hack prevention program
I think this is ur problem here:
*Cheats = 1;
I think when u try to change the value of the addy the memory at that location may be read only. So u might need to us VirtualProtect API to change the access privileges to this memory location.
He got it with cheat engine, I assume his problem is that engine.dll isn't loaded when he injects.
How does sv_cheats exist if engine.dll isn't loaded...
And Why06, I am injected... I have access to it all, and I can change it if I use the address straight up. Except it changes.
Okay so, I have ensured that GetModuleHandle("engine.dll") is not NULL for when I set the pointers. Now, even when I read from them. I use MessageBox to display *Cheats and it just crashes the game.
~lilneo
Log the address you obtained in a text file or something. Before activating the hack, attach your debugger to the game and get the address manually, compare the one you got and the one you logged.
-Make sure the module is found before you add the offset to the base.
-Make sure the page you're writing to has the proper access rights for writing. If you try writing to it and the pages rights only allow execution or reading, it could cause problems.
The RVA is relative to the base address of a module(where the module was loaded), not it's entry-point.