Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired

    c++ changing memory offset help

    I have the address for no recoil for a game



    Code:
    004807B5
    and the default value is

    Code:
    116
    and i know this because i have tested this in cheat engine

    and i know that the value that enables no recoil is

    Code:
    117
    so how would i go about putting this into a c++ project?

    can any help me please, or leave some links, or code, it would be so great full thanmks

  2. #2
    Tonyx97's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    165
    My Mood
    Aggressive
    Hi I suggest you starting with this memory library made by a person which is very good library. Mainly functions is
    Code:
    mem.Read<variabletype> (address);
    and mem.Write (address, value);
    this both functions are the best for you want, for example to change the recoil in your game is:
    Code:
    mem.Write(0x4807B5, 117);
    But I never used write func, I used only read because is more undetectable, I'm checking everyday my hack in casual of CSGO for 2 weeks and is still undetectable plus I made an algorithm to avoid VAC detection. I hope that library helps you

    PS: "mem" is declared as ProcMem (class)
    Code:
    ProcMem mem;
    Last edited by Tonyx97; 04-10-2015 at 05:07 PM.

  3. #3
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    https://lmgtfy.com/?q=Learn+C%2B%2B+Book

    Careful now, that link is toxic in high doses.
    Read responsibly

  4. #4
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired
    i dont know what you mean by its a good library, you didnt tell me what the libary is so i cant include it?, ive tried
    Code:
    WriteProcessMemory
    i dont know

  5. #5
    Tonyx97's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    165
    My Mood
    Aggressive
    I thought I pasted it. Sorry. Search on google "Memory Class by Nether".

  6. #6
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired
    Quote Originally Posted by Tonyx97 View Post
    I thought I pasted it. Sorry. Search on google "Memory Class by Nether".
    Thank you I'll get back to you and let you know if I get it working

  7. #7
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired
    Here is the code im using to try and test this:
    Code:
    #include <iostream>
    #include <string>
    #include <windows.h>
    #include "ProcMem.h"
    using namespace std;
    
    ProcMem mem;
    int i = 0;
    int main(){
    	ProcMem mem; //Declare Class Object
    	mem.GetProcess("CoDWaWmp.exe");
    	DWORD dwBase = mem.Module("CoDWaWmp.exe"); //Define Process Base (watch for upper/lower case, the module process.exe is different from the process name Process.exe
    	DWORD dwServer = mem.Module("server.dll");
    	/*cout << "Press [F1]" << endl;
    
    	if (dwBase)
    	{
    		cout << "Info: " << dwServer << " " << dwBase << endl;
    
    	}
    	*/
    
    	while (i < 1) //infinite loop!
    	{
    
    		if (GetAsyncKeyState(VK_F1))
    		{
    
    			mem.Write(0x4807B5, 117);
    
    		}
    	}
    
    
    
    }
    I have tried this with a DLL, and injected it, but nothing happens even when i press the key
    i have tried this an a console application but when i press F1 the game crashes, i don't know what is wrong, i have posted a screen shot below, maybe that might help you to help me, i really want this to work, thanks for helping me btw means alot


    Attached Thumbnails Attached Thumbnails
    1.png  


  8. #8
    Tonyx97's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    165
    My Mood
    Aggressive
    1º: Remove the first line of main because you already declared mem.
    2º: The modules are useless in that code and you should remove "int i = 0;" and just use "true" or "1" instead of " i < 0" it's a waste if memory and it helps you to improve
    And the game crashes because you are repeating the write 0.0001 times per second so... Just use after mem.Write "Sleep (1000)" or something like that

  9. #9
    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
    The image you posted (of CE) says the data type in the game is just 1 byte. (?)

    But mem.Write(0x******,117); is probably (do you know?) writing an INT (ie. 4 bytes)

    Check if the library explicitly has a .WriteByte() function, or if it's using generics, try
    Code:
    mem.Write(0x********,(BYTE)117);  //BYTE is defined in Windows.h?...I forget
    mem.Write(0x********,(char)117);  //
    
    mem.Write<BYTE>(0x********,117); //?
    mem.Write<char>(0x********,117); //?
    by default the value '117', even though it would fit into a byte, is treated as int32.

     
    you really should write your own memory library....if it's "too hard", then you don't understand "this stuff" well enough to be doing it. imo.

    edit: what Tony* said is true -- you're going to end up writing to it hundreds of times in a single key press, which shouldn't cause a problem (?), but might, depending on your memory library I guess - either way, it's not 'good'.

    Code:
    bool wasKeyDown = false;
    
    while (1)
    {
      if (GetAsyncKeyState(VK_F1)) // see msdn for return value :|
      { // key is currently down
        wasKeyDown = true;
      }
      else
      {//key isn't currently down, but was it down a  moment ago?! 
        if (wasKeyDown)
        {
          //do the thing
          wasKeyDown = false; // have to reset it..
        }
      }
    }
    ^^this will cause the function to be called only after the key has been pressed and also *released*, which works for your needs, and avoids the call the Sleep. -->As opposed to doing something constantly while the key is pressed down.
    Last edited by abuckau907; 04-11-2015 at 06:48 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.

  10. #10
    Tonyx97's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    165
    My Mood
    Aggressive
    I can share my KeyCode.h for you guys, I made it 2 months ago and it works perfectly for me:
    Code:
    #include <windows.h>
    
    #define LEFT_MOUSE_BUTTON 0x01
    #define RIGHT_MOUSE_BUTTON 0x02
    #define MIDDLE_MOUSE_BUTTON 0x04
    #define A 0x41
    #define B 0x42
    #define C 0x43
    #define D 0x44
    #define E 0x45
    #define F 0x46
    #define G 0x47
    #define H 0x48
    #define I 0x49
    #define J 0x4A
    #define K 0x4B
    #define L 0x4C
    #define M 0x4D
    #define N 0x4E
    #define O 0x4F
    #define P 0x50
    #define Q 0x51
    #define R 0x52
    #define S 0x53
    #define T 0x54
    #define U 0x55
    #define V 0x56
    #define W 0x57
    #define X 0x58
    #define Y 0x59
    #define Z 0x5A
    #define K_0 0x30
    #define K_1 0x31
    #define K_2 0x32
    #define K_3 0x33
    #define K_4 0x34
    #define K_5 0x35
    #define K_6 0x36
    #define K_7 0x37
    #define K_8 0x38
    #define K_9 0x39
    #define BACKSPACE 0x08
    #define TAB 0x09
    #define ENTER 0x0D
    #define CONTROL 0x11
    #define ALT 0x12
    #define CAPSLOCK 0x14
    #define ESCAPE 0x1B
    #define SPACE 0x20
    #define ARROW_LEFT 0x25
    #define ARROW_UP 0x26
    #define ARROW_RIGHT 0x27
    #define ARROW_DOWN 0x28
    #define KDELETE 0x2E
    #define LWIN 0x5B
    #define RWIN 0x5C
    #define NUM_0 0x60
    #define NUM_1 0x61
    #define NUM_2 0x62
    #define NUM_3 0x63
    #define NUM_4 0x64
    #define NUM_5 0x65
    #define NUM_6 0x66
    #define NUM_7 0x67
    #define NUM_8 0x68
    #define NUM_9 0x69
    #define NUM_ADD 0x6B
    #define NUM_SEPARATOR 0x6C
    #define NUM_SUBTRACT 0x6D
    #define NUM_DECIMAL 0x11
    #define NUM_DIVIDE 0x6F
    #define F1 0x70
    #define F2 0x71
    #define F3 0x72
    #define F4 0x73
    #define F5 0x74
    #define F6 0x75
    #define F7 0x76
    #define F8 0x77
    #define F9 0x78
    #define F10 0x79
    #define F11 0x7A
    #define F12 0x7B
    #define LSHIFT 0xA0
    #define RSHIFT 0xA1
    #define LCONTROL 0xA2
    #define RCONTROL 0xA3
    
    bool keyPressed[] =
    {
        false
    };
    
    bool keyUnpressed[][2] =
    {
        {true, false}
    };
    
    bool GetKeyDown (int _key)
    {
        if (GetAsyncKeyState(_key) && !keyPressed[_key])
        {
            keyPressed[_key] = true;
            return keyPressed[_key];
        }
        else if (!GetAsyncKeyState(_key) && keyPressed[_key])
        {
            keyPressed[_key] = false;
            return keyPressed[_key];
        }
        return false;
    }
    
    bool GetKeyUp (int _key)
    {
        if (GetAsyncKeyState(_key) && !keyPressed[_key])
        {
            if (!keyUnpressed[_key][1])
            {
                keyUnpressed[_key][1] = true;
            }
        }
        if (keyUnpressed[_key][1])
        {
            if (GetAsyncKeyState(_key) && keyUnpressed[_key][0])
            {
                keyUnpressed[_key][0] = false;
                return keyUnpressed[_key][0];
            }
            else if (!GetAsyncKeyState(_key) && !keyUnpressed[_key][0])
            {
                keyUnpressed[_key][0] = true;
                return keyUnpressed[_key][0];
            }
        }
        return false;
    }
    
    int GetKey (int _key)
    {
        if (GetAsyncKeyState(_key))
        {
            return GetAsyncKeyState(_key);
        }
        return 0;
    }
    Use GetKeyDown(Key) when you only need to call it 1 time like as want hiimachicken1.
    Use GetKeyUp (Key) when you want to call some function when a key is unpressed.
    Use GetKey (Key) is almost the same as GetAsyncKeyState.
    This library is very useful if you're going to work with a lot of keys
    PS: in the file you can find some useless stuff as the second array because you don't need another dimension for the array. But I don't touch it for now haha.
    Last edited by Tonyx97; 04-12-2015 at 05:28 AM.

  11. #11
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    Quote Originally Posted by Tonyx97 View Post
    I can share my KeyCode.h for you guys, I made it 2 months ago and it works perfectly for me:
    Code:
    #include <windows.h>
    
    #define LEFT_MOUSE_BUTTON 0x01
    #define RIGHT_MOUSE_BUTTON 0x02
    #define MIDDLE_MOUSE_BUTTON 0x04
    #define A 0x41
    #define B 0x42
    #define C 0x43
    #define D 0x44
    #define E 0x45
    #define F 0x46
    #define G 0x47
    #define H 0x48
    #define I 0x49
    #define J 0x4A
    #define K 0x4B
    #define L 0x4C
    #define M 0x4D
    #define N 0x4E
    #define O 0x4F
    #define P 0x50
    #define Q 0x51
    #define R 0x52
    #define S 0x53
    #define T 0x54
    #define U 0x55
    #define V 0x56
    #define W 0x57
    #define X 0x58
    #define Y 0x59
    #define Z 0x5A
    #define K_0 0x30
    #define K_1 0x31
    #define K_2 0x32
    #define K_3 0x33
    #define K_4 0x34
    #define K_5 0x35
    #define K_6 0x36
    #define K_7 0x37
    #define K_8 0x38
    #define K_9 0x39
    #define BACKSPACE 0x08
    #define TAB 0x09
    #define ENTER 0x0D
    #define CONTROL 0x11
    #define ALT 0x12
    #define CAPSLOCK 0x14
    #define ESCAPE 0x1B
    #define SPACE 0x20
    #define ARROW_LEFT 0x25
    #define ARROW_UP 0x26
    #define ARROW_RIGHT 0x27
    #define ARROW_DOWN 0x28
    #define KDELETE 0x2E
    #define LWIN 0x5B
    #define RWIN 0x5C
    #define NUM_0 0x60
    #define NUM_1 0x61
    #define NUM_2 0x62
    #define NUM_3 0x63
    #define NUM_4 0x64
    #define NUM_5 0x65
    #define NUM_6 0x66
    #define NUM_7 0x67
    #define NUM_8 0x68
    #define NUM_9 0x69
    #define NUM_ADD 0x6B
    #define NUM_SEPARATOR 0x6C
    #define NUM_SUBTRACT 0x6D
    #define NUM_DECIMAL 0x11
    #define NUM_DIVIDE 0x6F
    #define F1 0x70
    #define F2 0x71
    #define F3 0x72
    #define F4 0x73
    #define F5 0x74
    #define F6 0x75
    #define F7 0x76
    #define F8 0x77
    #define F9 0x78
    #define F10 0x79
    #define F11 0x7A
    #define F12 0x7B
    #define LSHIFT 0xA0
    #define RSHIFT 0xA1
    #define LCONTROL 0xA2
    #define RCONTROL 0xA3
    
    bool keyPressed[] =
    {
        false
    };
    
    bool keyUnpressed[][2] =
    {
        {true, false}
    };
    
    bool GetKeyDown (int _key)
    {
        if (GetAsyncKeyState(_key) && !keyPressed[_key])
        {
            keyPressed[_key] = true;
            return keyPressed[_key];
        }
        else if (!GetAsyncKeyState(_key) && keyPressed[_key])
        {
            keyPressed[_key] = false;
            return keyPressed[_key];
        }
        return false;
    }
    
    bool GetKeyUp (int _key)
    {
        if (GetAsyncKeyState(_key) && !keyPressed[_key])
        {
            if (!keyUnpressed[_key][1])
            {
                keyUnpressed[_key][1] = true;
            }
        }
        if (keyUnpressed[_key][1])
        {
            if (GetAsyncKeyState(_key) && keyUnpressed[_key][0])
            {
                keyUnpressed[_key][0] = false;
                return keyUnpressed[_key][0];
            }
            else if (!GetAsyncKeyState(_key) && !keyUnpressed[_key][0])
            {
                keyUnpressed[_key][0] = true;
                return keyUnpressed[_key][0];
            }
        }
        return false;
    }
    
    int GetKey (int _key)
    {
        if (GetAsyncKeyState(_key))
        {
            return GetAsyncKeyState(_key);
        }
        return 0;
    }
    Use GetKeyDown(Key) when you only need to call it 1 time like as want hiimachicken1.
    Use GetKeyUp (Key) when you want to call some function when a key is unpressed.
    Use GetKey (Key) is almost the same as GetAsyncKeyState.
    This library is very useful if you're going to work with a lot of keys
    PS: in the file you can find some useless stuff as the second array because you don't need another dimension for the array. But I don't touch it for now haha.
    Why not GetAsyncKeyState( 'A' ) etc? Works with every A-Z, a-z, 0-9 chars.
    Every other one ( TAB etc ) are defined as virtual key in WinUser.h

    https://msdn.microsof*****m/en-us/lib...=vs.85%29.aspx

  12. #12
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired
    Omg it worked thank you so so much i appreciate everyones help i really do

  13. #13
    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
    @Tonyx97
    Code:
    int GetKey (int _key)
    {
        if (GetAsyncKeyState(_key))
        {
            return GetAsyncKeyState(_key);
        }
        return 0;
    }

    should be

    Code:
    int GetKey (int _key)
    {
             return GetAsyncKeyState(_key);
    }
    : |

    it's exactly equivalent - if the first call to getasynckeystate returns 0, you return 0....else you call getasynckeystate again and pass its return value along --> so you're simply returning the return-value of getasynckeystate! Except your version could read a non-zero on the first call, but then get a 0 on the second call to getasynckeystate. Unlikely, but there is no reason for it.


    @hiimachicken1 You should say what exactly the problem was, and what the solution was..not just 'nvm, it works now'.
    Last edited by abuckau907; 04-12-2015 at 07:31 AM.
    '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.

  14. #14
    Tonyx97's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    30
    Reputation
    10
    Thanks
    165
    My Mood
    Aggressive
    Quote Originally Posted by abuckau907 View Post
    @Tonyx97
    Code:
    int GetKey (int _key)
    {
        if (GetAsyncKeyState(_key))
        {
            return GetAsyncKeyState(_key);
        }
        return 0;
    }

    should be

    Code:
    int GetKey (int _key)
    {
             return GetAsyncKeyState(_key);
    }
    : |

    it's exactly equivalent - if the first call to getasynckeystate returns 0, you return 0....else you call getasynckeystate again and pass its return value along --> so you're simply returning the return-value of getasynckeystate! Except your version could read a non-zero on the first call, but then get a 0 on the second call to getasynckeystate. Unlikely, but there is no reason for it.


    @hiimachicken1 You should say what exactly the problem was, and what the solution was..not just 'nvm, it works now'.
    Yes, you're right, I did it long time ago and when I finished the library I didn't spend time on optimizing it but I could. Thanks for the tip anyways

  15. #15
    hiimachicken1's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    19
    Reputation
    18
    Thanks
    171
    My Mood
    Tired
    @abuckau907

    To anyone wanting to know the code, and you can compare it to see how i made it work
    Code:
    #include <iostream>
    #include <vector>
    #include <string>
    #include <fstream>
    #include <windows.h>
    #include "ProcMem.h"
    using namespace std;
    int main(){
    	ProcMem mem; //Declare Class Object
    	mem.GetProcess("CoDWaWmp.exe");
    	DWORD dwBase = mem.Module("CoDWaWmp.exe"); //Define Process Base (watch for upper/lower case, the module process.exe is different from the process name Process.exe
    	DWORD dwServer = mem.Module("server.dll");
    
    
    	bool wasKeyDown = false;
    	if (dwBase){
    
    		cout << "[F1] no-recoil" << endl;
    	}
    	while (1)
    	{
    		Sleep(1000);
    		if (GetAsyncKeyState(VK_F1)) // see msdn for return value :|
    		{ // key is currently down
    			wasKeyDown = true;
    		}
    		else
    		{//key isn't currently down, but was it down a  moment ago?! 
    			if (wasKeyDown)
    			{
    				//do the thing
    				mem.Write(0x4807B5, (BYTE)117);
    				wasKeyDown = false; // have to reset it..
    			}
    		}
    	}
    }

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help Request] how to find memory offset
    By rotawo2 in forum Crossfire Coding Help & Discussion
    Replies: 8
    Last Post: 02-05-2013, 07:28 AM
  2. Not speed memory solution Help
    By wujia in forum Visual Basic Programming
    Replies: 7
    Last Post: 08-19-2010, 12:10 AM
  3. instruction at ---- reference memory at .......... HELP
    By moldavan55 in forum Combat Arms Help
    Replies: 12
    Last Post: 06-08-2010, 03:19 PM
  4. Changing memory adresses
    By bwoo in forum Call of Duty Modern Warfare 2 Help
    Replies: 10
    Last Post: 01-29-2010, 06:51 AM
  5. Time change I just help?
    By beda000 in forum Call of Duty Modern Warfare 2 Help
    Replies: 4
    Last Post: 11-30-2009, 05:25 PM