Writing to memory address

01/31/2010 15:27 ImmuneOne#1
Hey,

I'm trying to change my name in conquer by memory writing, but it isn't working.

[Only registered and activated users can see links. Click Here To Register...]

Can someone tell me what's wrong about this;
Writing
Code:
                byte[] bytes = Encoding.ASCII.GetBytes(NewName);
                try
                {
                    int ID = System.Diagnostics.Process.GetProcessesByName("Conquer")[0].Id;
                    Console.WriteLine("[InfiniteCOHack] Process ID : " + ID + "");
                    Memory.WriteMem(ID, (IntPtr)Definitions.Adresses.Name, bytes);
                }
Memory address
Code:
            Name = 0x57b604,
Write function
Code:
        public static IntPtr WriteMem(int Proid, IntPtr BaseAddress, byte[] NewVal)
        {
            IntPtr ptr;
            WriteProcessMemory((IntPtr)Proid, BaseAddress, NewVal, (UIntPtr)NewVal.Length, out ptr);
            return ptr;
        }

        [DllImport("kernel32.dll")]
        private static extern bool WriteProcessMemory(IntPtr Process, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);
And I guess 2548 isn't correct either.

Thanks for your time.
01/31/2010 15:51 IAmHawtness#2
You have to pass the process HANDLE to the WriteProcessMemory function, not the process ID. If I remember correctly, the .NET Process class has a way of getting the process handle, but if not you can always use OpenProcess to get the process handle (google it).

I belive the way to get the process handle in .NET is something like (in your case):
Code:
int pHandle = System.Diagnostics.Process.GetProcessesByName("Conquer")[0].[COLOR="Black"][B]Handle[/B][/COLOR];
Also, the way your program is assuming that there's already a running instance of Conquer, that will probably give you some errors if there's no running Conquer.exe.
01/31/2010 16:03 ImmuneOne#3
Quote:
Originally Posted by IAmHawtness View Post
You have to pass the process HANDLE to the WriteProcessMemory function, not the process ID. If I remember correctly, the .NET Process class has a way of getting the process handle, but if not you can always use OpenProcess to get the process handle (google it).

I belive the way to get the process handle in .NET is something like (in your case):
Code:
int pHandle = System.Diagnostics.Process.GetProcessesByName("Conquer")[0].[COLOR="Black"][B]Handle[/B][/COLOR];
Also, the way your program is assuming that there's already a running instance of Conquer, that will probably give you some errors if there's no running Conquer.exe.
Throws; Process ID 1340, and no changes.

Recent changes;

It throws random ID's like if I type; Idiot = 1344 and if I type IDIOT it shows 1348.
I used for OpenProcess the type 0x001F0FFF.
01/31/2010 20:34 Nullable#4
Quote:
Originally Posted by ImmuneOne View Post
Throws; Process ID 1340, and no changes.

Recent changes;

It throws random ID's like if I type; Idiot = 1344 and if I type IDIOT it shows 1348.
I used for OpenProcess the type 0x001F0FFF.
Dude, you probably know that part, just to reassure
Code:
int bytes;
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcId);
int Result = WriteProcessMemory(hHandle, BaseAddr, Buffer, sizeof(Buffer), out bytes);
I don't get the idiot part though, explain? :p
02/19/2010 06:11 redskull010101#5
still need help??