Results 1 to 5 of 5
  1. #1
    exploder2013's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Latvia
    Posts
    29
    Reputation
    10
    Thanks
    0

    NOP'ing address in MW3

    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:
     

    Code:
    #include <windows.h>
    
    void NOP(int Addr, int bytes)
    {
    	memset( (PVOID)Addr, 0x90, bytes);
    }
    
    void Start()
    {
    
    	while( !GetAsyncKeyState( VK_INSERT ))
    	{
    		if( GetAsyncKeyState( VK_F1 ) )
    		{
    			NOP( 0x4D6832, 4 );
    		} else if( GetAsyncKeyState( VK_F2 ) )
    		{
    			
    		}
    	}
    	
    }
    
    INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved) {
    
    	switch(Reason) {
    	case DLL_PROCESS_ATTACH:
    		CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)Start, hDLL, NULL, NULL);
    		break;
    	}
    
    	return TRUE;
    }


    Could someone explain me what I'm doing wrong?

    Thanks.
    Attached Thumbnails Attached Thumbnails
    odbg.png  

    Last edited by exploder2013; 01-03-2014 at 10:24 AM.

  2. #2
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    When does it crash? When you NOP it in olly or in C++ or both?

  3. #3
    exploder2013's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Latvia
    Posts
    29
    Reputation
    10
    Thanks
    0
    It works fine when I NOP it in Olly, but when I inject DLL and press the hot-key, it immediately crashes.

  4. #4
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    @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.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  5. The Following User Says Thank You to abuckau907 For This Useful Post:

    exploder2013 (01-04-2014)

  6. #5
    exploder2013's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Location
    Latvia
    Posts
    29
    Reputation
    10
    Thanks
    0
    The memory address that I tried to modify was protected. VirtualProtect did the job and now it's working. Thanks.

Similar Threads

  1. 1 on 1 Assistance with debugging and finding addresses in mw3
    By sullydude in forum Call of Duty Modern Warfare 3 Help
    Replies: 0
    Last Post: 08-01-2012, 09:43 PM
  2. [Help] Pin pointing the exact instruction for nop-ing recoil
    By Fleepster99 in forum C++/C Programming
    Replies: 0
    Last Post: 12-31-2011, 06:24 PM
  3. [TuT]NOP'ing Memory Hacks
    By RageKnight in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 65
    Last Post: 08-01-2010, 08:45 AM
  4. how to nop the addresses (invis)
    By floris12345! in forum Visual Basic Programming
    Replies: 17
    Last Post: 01-26-2008, 01:43 PM
  5. [HELP] How do I DE-NOP an address?
    By Koekenbakker in forum Visual Basic Programming
    Replies: 8
    Last Post: 12-02-2007, 06:23 AM