CoD4 SP Trainer

Posts 13 of 3 · Page 1 of 1
CoD4 SP Trainer


1)start CoD4 SP
2)Start the Trainer
3)Have Fun with Ammo Hack..
More Features coming soon..



 
Credits

@Jorndel as always for his Memory class,me for finding all offsets and coding..,unknown user for this tutorial


 
Source code

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System****;
using System.Runtime.InteropServices;
using System.Diagnostics;
using memory_control;


/*
 * CoD4 SP Trainer : by MW2Player
 * Credits : Jorndel,Unknown user (I forgot) for Memory_control.dll Class and me for rest (coding everything and finding offsets)
 * don't leech pl0x
 * */


namespace CoD4_SP_Trainer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        #region Basic Stuff
        [DllImport("kernel32.dll")]
        private static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
        [DllImport("kernel32.dll")]
        private static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
        IntPtr pHandel;
        public bool Process_Handle(string ProcessName)
        {
            try
            {
                Process[] ProcList = Process.GetProcessesByName(ProcessName);
                if (ProcList.Length == 0)
                    return false;
                else
                {
                    pHandel = ProcList[0].Handle;
                    return true;
                }
            }
            catch (Exception ex)
            { Console.Beep(); Console.WriteLine("Process_Handle - " + ex.Message); return false; }
        }
        private byte[] Read(int Address, int Length)
        {
            byte[] Buffer = new byte[Length];
            IntPtr Zero = IntPtr.Zero;
            ReadProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
            return Buffer;
        }
        private void Write(int Address, int Value)
        {
            byte[] Buffer = BitConverter.GetBytes(Value);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }
        #endregion

        //This is the part you want to edit
        #region Write Functions (Integer & String)
        public void WriteInteger(int Address, int Value)
        {
            Write(Address, Value);
        }
        public void WriteString(int Address, string Text)
        {
            byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }
        public void WriteBytes(int Address, byte[] Bytes)
        {
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Bytes, (uint)Bytes.Length, out Zero);
        }
        public void WriteNOP(int Address)
        {
            byte[] Buffer = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 };
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }


        #endregion
        #region Read Functions (Integer & String)
        public int ReadInteger(int Address, int Length = 4)
        {
            return BitConverter.ToInt32(Read(Address, Length), 0);
        }
        public string ReadString(int Address, int Length = 4)
        {
            return new ASCIIEncoding().GetString(Read(Address, Length));
        }
        public byte[] ReadBytes(int Address, int Length)
        {
            return Read(Address, Length);
        }
        #endregion

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Process_Handle("iw3sp"))
            {
                button1.Enabled = true;
                button2.Enabled = true;
                button3.Enabled = true;
                button4.Enabled = true;
                button5.Enabled = true;


                Memorys mem = new Memorys("iw3sp");
                uint Equipment = mem.baseaddress("iw3sp.exe") + 0xA0DD4C;
                uint address0 = (uint)mem.ReadPointer(Equipment);

                uint PrimaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB48;
                uint address1 = (uint)mem.ReadPointer(PrimaryAmmo);

                uint SecondaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB44;
                uint address2 = (uint)mem.ReadPointer(SecondaryAmmo);

                uint PrimaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD44;
                uint address3 = (uint)mem.ReadPointer(PrimaryAmmoBullets);

                uint SecondaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD48;
                uint address4 = (uint)mem.ReadPointer(SecondaryAmmoBullets);

                label3.Text = address0.ToString();
                label4.Text = address3.ToString();
                label5.Text = address4.ToString();
                label6.Text = address1.ToString();
                label7.Text = address2.ToString();

                label8.Text = "CoD4 found..";



            }
            else
            {
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false; //disable all buttons when game is closed.
                button4.Enabled = false;
                button5.Enabled = false;
                label3.Text = "";
                label4.Text = "";
                label5.Text = "";  //flush Labels when game is exited
                label6.Text = "";
                label7.Text = "";

                label8.Text = "Waiting for CoD4";
               

            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Start();
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            Memorys mem = new Memorys("iw3sp");
            uint Equipment = mem.baseaddress("iw3sp.exe") + 0xA0DD4C;
            mem.Write(Equipment, int.Parse(textBox1.Text));
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Memorys mem = new Memorys("iw3sp");
            uint PrimaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD44;
            mem.Write(PrimaryAmmoBullets, int.Parse(textBox2.Text));
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Memorys mem = new Memorys("iw3sp");
            uint SecondaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD48;
            mem.Write(SecondaryAmmoBullets, int.Parse(textBox3.Text));
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Memorys mem = new Memorys("iw3sp");
            uint PrimaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB48;
            mem.Write(PrimaryAmmo,int.Parse(textBox4.Text));
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Memorys mem = new Memorys("iw3sp");
            uint SecondaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB44;
            mem.Write(SecondaryAmmo, int.Parse(textBox5.Text));
        }

       
    }
}
CoD4 SP Trainer_mpgh.net.rar9 KB · 126 downloads Scanning…
/Approved

Report any problems


-Jorndel
added source.
Posts 13 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?