Step 3

Writing to a process's memory. 

Well, again if you have any questions, hit me up at or mathmuncherdude (aim).


This step focuses on writing to an address's value, using several notations (double, float, byte, 2 byte, and 4 byte)...this may not interest you because you wish to directly edit the opcodes, but to many...this step is very important!

You'll need 'ProcessMemoryReaderLib.cs' from step 2 so download it and add it to your project. For this step I will be using notepad, again. You will not be able to notice the difference without attaching cheat engine and directly reading its value...but it will be changing. And in this step, I've added pictures.

OK, let's get started...declare myprocesses (step 1) and preader (step 2).

Declare the following variables, in your checkbox or button click:

                int byteswritten;
                int value;
                //double value;
                //float value;
                //byte value;
                //short value;
                //long value;

                string strvalue;
                byte[] memory;

I commented out the ones that I'm not going to use, but you may use any that you want. Now here's the template:

            preader.ReadProcess = myprocess[0];

            int byteswritten; //don't worry about this
            int value; // value to be written to address's memory
            //double value;
            //float value;
            //byte value;
            //short value;
            //long value;

            byte[] valuebyte; //value, will be converted to byte                                         array

            value = 4800;//just an example, could be anything
            valuebyte = BitConverter.GetBytes(value);                               

        //here the int value (4800), gets converted into byte                 array

            preader.WriteProcessMemory((IntPtr)0x1009624, valuebyte, out byteswritten); 

 Here the byte array value (4800), gets written to the address 0x1009624's value.

That's it! Simple, just like I told you! 

Demo Project

On to Step 4!