C# Address Changing

Posts 1–11 of 11 · Page 1 of 1
C# Address Changing
Code:
namespace Gametrainer
{
    public partial class Form1 : Form
    {
        [DllImport("kernel32.dll")]
        public static extern Int32 CloseHandle(IntPtr hObject);
        [DllImport("kernel32.dll")]
        public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId);
        [DllImport("kernel32.dll")]
        public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, uint[] lpBuffer, UInt32 nSize, IntPtr lpNumberOfBytesWritten);


        IntPtr pHandle;   
        Process[] CA;

        public Form1()
        {
            InitializeComponent();
        }

        private void OpenProcess()
        {
            IntPtr pHandle;

            // to write
            IntPtr Address = (IntPtr)0x0000000;
            uint[] Write = new uint[] { 0xFF };// memory to write

            // open
            Process[] CA = Process.GetProcessesByName("Process Name"); 
/*
Ex:
Engine.exe (Combat Arms)
iw4mp.exe (ModernWarfare 2)
warrock.exe (Warrock)
*/

            pHandle = OpenProcess(0xFFFFFF, 0, (UInt32)CA[0].Id);
            WriteProcessMemory(pHandle, Address, Write, 4, (IntPtr)0);
            
            CloseHandle(pHandle);


        }

        private void button1_Click(object sender, EventArgs e)
        {
            // start timer
        }

        private void waitfor_Tick(object sender, EventArgs e)
        {
            CA = Process.GetProcessesByName("Engine");
            
            if (CA != null)
            {
                pHandle = OpenProcess(0xFFFFFF, 0, (UInt32)CA[0].Id);
                waitfor.Enabled = false;
                //.....
                button1.Enabled = true;
            }
        }

        private void hackone_Tick(object sender, EventArgs e)
        {
            //16D2A57
            // to write
            IntPtr Address = (IntPtr)0x16D2A57;  //Old addy
            uint[] Write = new uint[] { 0xFF };// memory to write  *New addy*
        }
    }
}
Not really gonna explain a lot, If you don't understand it you really shouldn't be trying to do this. Some things are commented.
Enjoy guys.

0xFF = 0x255
Its hex.
will it aso work for warrock im a newbie hacker
Yeah, Just change the process's name.
Dont forget to put in the addies.
What IDE have you used?
I've tried on both 2003 and 2008, neither have the Process namespace o__O
The Process class is in the SYstem.Diagnostics Namespace, so add
using System.Diagnostics;
on top
Quote Originally Posted by B1ackAnge1 View Post
The Process class is in the SYstem.Diagnostics Namespace, so add
using System.Diagnostics;
on top
Tried, doesnt work for me ;S
To use 'DllImport' you need the namespace 'System.Runtime.InteropServices', so add 'using System.Runtime.InteropServices;'
You have used method 'CloseHandle' but you didnt implemented it!
Can you post the 'CloseHandle' method?
For HD
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
And at HD, it was coded in VS2010.
But 2010 messed up on me, So I use 2008 now. It still works.
Issue fixed guys, my C# install was f*cked
Haha. K.
This help anybody?
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us