Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace mw3_Aug_Class_Hack
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region class things
#region hotkeys class
[DllImport("user32.dll")]
public static extern int GetAsyncKeyState(Keys vKeys);
#endregion
#region Basic Stuff
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress, UInt32 dwSize, uint flNewProtect, out uint lpflOldProtect);
[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
#region Write Functions (Integer & String)
public void WriteDouble(int address, double value)
{
byte[] Buffer = BitConverter.GetBytes(value);
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)address, Buffer, (UInt32)Buffer.Length, out Zero);
}
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);
}
private void WriteFloat(int Address, float Value)
{
byte[] Buffer = BitConverter.GetBytes(Value);
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
}
public float ReadFloat(int address)
{
return BitConverter.ToSingle(ReadBytes(address, 8), 0);
}
public void WriteFloat_Protected(int Address, float Value)
{
uint OldProtection;
VirtualProtectEx(pHandel, (IntPtr)Address, (uint)sizeof(float), 0x40, out OldProtection);
WriteFloat(Address, Value);
VirtualProtectEx(pHandel, (IntPtr)Address, (uint)sizeof(float), OldProtection, out OldProtection);
}
#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);
}
public double ReadDouble(int address)
{
byte[] buffer = new byte[sizeof(double)];
IntPtr Zero = IntPtr.Zero;
ReadProcessMemory(pHandel, (IntPtr)address, buffer, (UInt32)buffer.Length, out Zero);
return BitConverter.ToDouble(buffer, 0);
}
#endregion
#region name faker
class NameFaker
{
[DllImport("kernel32.dll")]
private static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
private static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
private static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
public void WriteString(int Address, string Text)
{
byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
IntPtr Zero = IntPtr.Zero;
Convert.ToByte(10);
WriteProcessMemory(Open_Memory(), (IntPtr)Address, Buffer, (UInt32)25, out Zero);
}
private uint ReadInt(uint Addr)
{
byte[] buffer = new byte[4];
IntPtr R;
ReadProcessMemory(Open_Memory(), (IntPtr)Addr, buffer, 4, out R);
return BitConverter.ToUInt32(buffer, 0);
}
private IntPtr Open_Memory()
{
if (Process.GetProcessesByName("iw5mp").Length != 0)
{
return OpenProcess(0x1F0FFF, true, Process.GetProcessesByName("iw5mp")[0].Id);
}
else return (IntPtr)0x0;
}
private uint BaseAddress(string Module_Name)
{
if (Process.GetProcessesByName("iw5mp").Length != 0)
{
foreach (ProcessModule Mod in Process.GetProcessesByName("iw5mp")[0].Modules)
{
if (Mod.ModuleName == Module_Name)
return (uint)Mod.BaseAddress.ToInt32();
}
return 0;
}
else return 0;
}
public NameFaker(string Name)
{
uint Base = BaseAddress("steam_api.dll") + 0x0001824C;
uint Runner = ReadInt(Base) + 0x0;
Runner = ReadInt(Runner) + 0x4;
Runner = ReadInt(Runner) + 0x8;
Runner = ReadInt(Runner) + 0x10;
Runner = ReadInt(Runner) + 0x7e;
WriteString((int)Runner, Name);
}
}
#endregion
#endregion
protected override void OnFormClosing(FormClosingEventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e)
{
#region Aug Load Shit
comboBox_AugClassSelect.Items.Add("Class 1");
comboBox_AugClassSelect.Items.Add("Class 2");
comboBox_AugClassSelect.Items.Add("Class 3");
comboBox_AugClassSelect.Items.Add("Class 4");
comboBox_AugClassSelect.Items.Add("Class 5");
comboBox_AugClassSelect.Items.Add("Class 6");
comboBox_AugClassSelect.Items.Add("Class 7");
comboBox_AugClassSelect.Items.Add("Class 8");
comboBox_AugClassSelect.Items.Add("Class 9");
comboBox_AugClassSelect.Items.Add("Class 10");
comboBox_AugClassSelect.Items.Add("Class 11");
comboBox_AugClassSelect.Items.Add("Class 12");
comboBox_AugClassSelect.Items.Add("Class 13");
comboBox_AugClassSelect.Items.Add("Class 14");
comboBox_AugClassSelect.Items.Add("Class 15");
comboBox_AtatchmentSelect.Items.Add("Red Dot");
comboBox_AtatchmentSelect.Items.Add("Silencer");
comboBox_AtatchmentSelect.Items.Add("Grip");
comboBox_AtatchmentSelect.Items.Add("Acog");
comboBox_AtatchmentSelect.Items.Add("RapidFire");
comboBox_AtatchmentSelect.Items.Add("ExtendedMags");
comboBox_AtatchmentSelect.Items.Add("Thermal");
#endregion
comboBox1.Items.Add("Class One");
comboBox1.Items.Add("Class Two");
comboBox1.Items.Add("Class Three");
comboBox1.Items.Add("Class Four");
comboBox1.Items.Add("Class Five");
comboBox1.Items.Add("All");
}
private void timer1_Tick(object sender, EventArgs e)
{
if(Process_Handle(Proc_Name))
{
button41.Enabled = true;
button1.Enabled = true;
button1.Text = "Set";
}
else
{
button41.Enabled = false;
button1.Enabled = false;
button1.Text = "Waiting for iw5mp";
}
}
private void button1_Click(object sender, EventArgs e)
{
if(comboBox1.Text == "Class One")
{
if (Process_Handle(Proc_Name))
{
WriteBytes(Class_One, AugClass);
}
}
if (comboBox1.Text == "Class Two")
{
if (Process_Handle(Proc_Name))
{
WriteBytes(Class_Two, AugClass);
}
}
if (comboBox1.Text == "Class Three")
{
if (Process_Handle(Proc_Name))
{
WriteBytes(Class_Three, AugClass);
}
}
if (comboBox1.Text == "Class Four")
{
if (Process_Handle(Proc_Name))
{
WriteBytes(Main_Class + (3 * Class_Size), AugClass);
}
}
if (comboBox1.Text == "Class Five")
{
if (Process_Handle(Proc_Name))
{
WriteBytes(Main_Class + (4 * Class_Size), AugClass);
}
}
if (comboBox1.Text == "All")
{
if (Process_Handle(Proc_Name))
{
for (int i = 0; i != 14; i++ )
WriteBytes(Main_Class + (i * Class_Size), AugClass);
}
}
}
private void button41_Click(object sender, EventArgs e)
{
if (Process_Handle(Proc_Name))
{
#region aug class shit
if (comboBox_AtatchmentSelect.Text == "Red Dot")
{
AugClass[2] = 0x1;
}
if (comboBox_AtatchmentSelect.Text == "Silencer")
{
AugClass[2] = 0x11;
}
if (comboBox_AtatchmentSelect.Text == "Grip")
{
AugClass[2] = 0x3;
}
if (comboBox_AtatchmentSelect.Text == "Acog")
{
AugClass[2] = 0x2;
}
if (comboBox_AtatchmentSelect.Text == "RapidFire")
{
AugClass[2] = 0xA;
}
if (comboBox_AtatchmentSelect.Text == "ExtendedMags")
{
AugClass[2] = 0x9;
}
if (comboBox_AtatchmentSelect.Text == "Thermal")
{
AugClass[2] = 0x5;
}
if (comboBox_AugClassSelect.Text == "Class 1")
{
WriteBytes(Class_One, AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 2")
{
WriteBytes(Class_One + (1 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 3")
{
WriteBytes(Class_One + (1 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 4")
{
WriteBytes(Class_One + (3 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 5")
{
WriteBytes(Class_One + (4 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 6")
{
WriteBytes(Class_One + (5 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 7")
{
WriteBytes(Class_One + (6 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 8")
{
WriteBytes(Class_One + (7 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 9")
{
WriteBytes(Class_One + (8 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 10")
{
WriteBytes(Class_One + (9 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 11")
{
WriteBytes(Class_One + (10 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 12")
{
WriteBytes(Class_One + (11 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 13")
{
WriteBytes(Class_One + (12 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 14")
{
WriteBytes(Class_One + (13 * Class_Size), AugClass);
}
if (comboBox_AugClassSelect.Text == "Class 15")
{
WriteBytes(Class_One + (14 * Class_Size), AugClass);
}
#endregion
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
}
}