When does it crash? When you NOP it in olly or in C++ or both?
Hello. I am trying to get unlimited ammo in MW3. I've found address in ollydbg and all I need to do is NOP it. But for some kind of reason game always crashes when I try to NOP it.
Address itself in OllyDbg is on the image I attached.
Code from injected DLL:
Could someone explain me what I'm doing wrong?
Thanks.
Last edited by exploder2013; 01-03-2014 at 10:24 AM.
When does it crash? When you NOP it in olly or in C++ or both?
▲
It works fine when I NOP it in Olly, but when I inject DLL and press the hot-key, it immediately crashes.
@exploder2013
So you're modifying the code section? Code sections are usually marked EXECUTE_READ , not EXECUTE_READ_WRITE. I think (?).
Does memset() call VirtualProtect() for you? You could call GetLastError() and see if it's something along the lines of "Access Denied" - if so, it's because the mem region is marked read_only. Call VirtualProtect() and set it to EXEC_READ_WRITE (don't forget the EXEC, or it'll crash if the cpu tries to run it as code). Optionall set it back to EXEC_READ when done. Maybe.
First you should figure out exactly which part (admittedly it's not a lot of code) is causing the problem. You say the dll injects correctly, and it only crashes when you press the hot-key? Sounds like the key code is working, and it's failing at the call to NOP(). ? I don't think you're using GetAsyncKeyState() quite correctly (?), but I'm not sure - apparently it's working : ) Since you already have the code checking for the "F2" key, add a call to MessageBox() -- just for testing purposes. If the messagebox displays correctly, then you know 100% the problem is your NOP function.
Last edited by abuckau907; 01-03-2014 at 10:02 PM.
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--
exploder2013 (01-04-2014)
The memory address that I tried to modify was protected. VirtualProtect did the job and now it's working. Thanks.