Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Help] Base Address? More then one pointer? D: Fuuuuuuuuck.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Boots
How do I cheat?
Reputation: 0

Joined: 26 Jan 2013
Posts: 1

PostPosted: Sat Jan 26, 2013 5:39 am    Post subject: [Help] Base Address? More then one pointer? D: Fuuuuuuuuck. Reply with quote

Alrighty guys, I've pretty much spent the last 5 hours lurking around on this forum, and you guys know your shit. Sorry if this isn't posted in the right board.

I'm doing this in C# btw.

Basically, all I want to do is show how much HP you have, I thought this would of been simple, but there was no dynamic pointers/addresses. So after I fucked around I found out a thing called 'Multi Level Pointers' or some shit. And now I have all the pointers, but the address it gives me now is a base address?

Code:
"Client.exe"+006B509C


Anyway, here is my code, I just put it all in a timer, as I just wanted it to update the labels quicker...

Would someone please show me an alternative method where I can take into consideration more then one pointer? And what do I do about that fucking base address? :/

Code:

private void ReadProcess_Tick(object sender, EventArgs e)
{
    if (Process.GetProcessesByName("Client").Length > 0)
    {
        status.Text = "Running";
        status.ForeColor = Color.Green;

        p = Process.GetProcessesByName("Client").FirstOrDefault();

        /* CURRENT HEALTH */
        int c_hp = Memory.ReadOffset_Int(p, 0x135509C, 0x4D8); // Address/Pointer
        d_ch.Text = Convert.ToString(c_hp); // Display on label.
    }
    else
    {
        status.Text = "Not Running";
        status.ForeColor = Color.Red;
    }
}





The file I included.

Memory.cs:
Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;

namespace ReadHP
{
    class Memory
    {
        [DllImport("kernel32.dll")]
        public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
        [DllImport("kernel32.dll")]
        public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
        [DllImport("kernel32.dll")]
        public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
        [DllImport("kernel32.dll")]
        public static extern Int32 CloseHandle(IntPtr hProcess);

        public enum ProcessAccessFlags : uint
        {
            All = 0x001F0FFF,
            Terminate = 0x00000001,
            CreateThread = 0x00000002,
            VMOperation = 0x00000008,
            VMRead = 0x00000010,
            VMWrite = 0x00000020,
            DupHandle = 0x00000040,
            SetInformation = 0x00000200,
            QueryInformation = 0x00000400,
            Synchronize = 0x00100000
        }

        public static void WriteMemory_8Byte(Process p, uint address, long v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            var val = new byte[] { (byte)v };
            IntPtr wtf;

            val = BitConverter.GetBytes(v);
            WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
            CloseHandle(hProc);
        }

        public static void WriteMemory_4Byte(Process p, uint address, int v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            var val = new byte[] { (byte)v };
            IntPtr wtf;

            val = BitConverter.GetBytes(v);
            WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
            CloseHandle(hProc);
        }


        public static void WriteMemory_2Byte(Process p, uint address, short v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            var val = new byte[] { (byte)v };
            IntPtr wtf;

            val = BitConverter.GetBytes(v);
            WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
            CloseHandle(hProc);
        }

        public static void WriteMemory_1Byte(Process p, uint address, long v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            var val = new byte[] { (byte)v };
            IntPtr wtf;

            val = new byte[] { (byte)v };
            WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
            CloseHandle(hProc);
        }

        public static void WriteMemory_Float(Process p, uint address, float v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            var val = new byte[] { (byte)v };
            IntPtr wtf;

            val = BitConverter.GetBytes(v);
            WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out wtf);
            CloseHandle(hProc);
        }

        public static void WriteOffset_Float(Process p, uint pointer, uint offset, float v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            var val = new byte[] { (byte)v };
            IntPtr ptrBytesReaded;

            val = BitConverter.GetBytes(v);
            uint adress = (uint)ReadPointer(p, pointer) + offset;
            WriteProcessMemory(hProc, (IntPtr)adress, val, (UInt32)val.LongLength, out ptrBytesReaded);
            CloseHandle(hProc);
        }

        public static void WriteOffset_4Byte(Process p, uint pointer, uint offset, int v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            var val = new byte[] { (byte)v };
            IntPtr ptrBytesReaded;

            val = BitConverter.GetBytes(v);
            uint adress = (uint)ReadPointer(p, pointer) + offset;
            WriteProcessMemory(hProc, (IntPtr)adress, val, (UInt32)val.LongLength, out ptrBytesReaded);
            CloseHandle(hProc);
        }

        public static void WriteOffset_2Byte(Process p, uint pointer, uint offset, short v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            var val = new byte[] { (byte)v };
            IntPtr ptrBytesReaded;

            val = BitConverter.GetBytes(v);
            uint adress = (uint)ReadPointer(p, pointer) + offset;
            WriteProcessMemory(hProc, (IntPtr)adress, val, (UInt32)val.LongLength, out ptrBytesReaded);
            CloseHandle(hProc);
        }

        public static void WriteOffset_8Byte(Process p, uint pointer, uint offset, long v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            var val = new byte[] { (byte)v };
            IntPtr ptrBytesReaded;

            val = BitConverter.GetBytes(v);
            uint adress = (uint)ReadPointer(p, pointer) + offset;
            WriteProcessMemory(hProc, (IntPtr)adress, val, (UInt32)val.LongLength, out ptrBytesReaded);
            CloseHandle(hProc);
        }

        public static void WriteOffset_1Byte(Process p, uint pointer, uint offset, byte v)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            var val = new byte[] { (byte)v };
            IntPtr ptrBytesReaded;

            val = BitConverter.GetBytes(v);
            uint adress = (uint)ReadPointer(p, pointer) + offset;
            WriteProcessMemory(hProc, (IntPtr)adress, val, (UInt32)val.LongLength, out ptrBytesReaded);
            CloseHandle(hProc);
        }

        public static int ReadOffset_Int(Process p, uint pointer, uint offset)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            IntPtr ptrBytesReaded;

            uint adress = (uint)ReadPointer(p, pointer) + offset;
            ReadProcessMemory(hProc, (IntPtr)adress, bytes, 4, out ptrBytesReaded);
            return BitConverter.ToInt32(bytes, 0);
        }

        public static float ReadOffset_Float(Process p, uint pointer, uint offset)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[byte.MaxValue];
            IntPtr ptrBytesReaded;

            uint adress = (uint)ReadPointer(p, pointer) + offset;
            ReadProcessMemory(hProc, (IntPtr)adress, bytes, 4, out ptrBytesReaded);
            float bytefloat = System.BitConverter.ToSingle(bytes, 0);
            return bytefloat;
        }

        public static int ReadPointer(Process p, uint pointer)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] bytes = new byte[24];
            IntPtr ptrBytesReaded;

            ReadProcessMemory(hProc, (IntPtr)pointer, bytes, 4, out ptrBytesReaded);
            return BitConverter.ToInt32(bytes, 0);
        }

        public static byte[] ReadMemory_1Byte(Process p, uint MemoryAddress, uint bytesToRead, out int bytesReaded)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] buffer = new byte[byte.MaxValue];

            IntPtr ptrBytesReaded;
            ReadProcessMemory(hProc, new IntPtr(MemoryAddress), buffer, bytesToRead, out ptrBytesReaded);
            bytesReaded = ptrBytesReaded.ToInt32();

            return buffer;
        }

        public static int ReadMemory_4Byte(Process p, uint MemoryAddress, uint bytesToRead, out int bytesReaded)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] buffer = new byte[byte.MaxValue];

            IntPtr ptrBytesReaded;
            ReadProcessMemory(hProc, new IntPtr(MemoryAddress), buffer, bytesToRead, out ptrBytesReaded);
            bytesReaded = ptrBytesReaded.ToInt32();
            int newbuffer = BitConverter.ToInt32(buffer, 0);
            return newbuffer;
        }

        public static int ReadMemory_Float(Process p, uint MemoryAddress, uint bytesToRead, out int bytesReaded)
        {
            var hProc = OpenProcess(ProcessAccessFlags.All, false, (int)p.Id);
            byte[] buffer = new byte[byte.MaxValue];

            IntPtr ptrBytesReaded;
            ReadProcessMemory(hProc, new IntPtr(MemoryAddress), buffer, bytesToRead, out ptrBytesReaded);
            bytesReaded = ptrBytesReaded.ToInt32();
            double newbuffer = BitConverter.ToDouble(buffer, 0);
            return Convert.ToInt32(newbuffer);
        }

    }
}


- Many thanks, Boots.



bb6037dc649adf2a6052c053f488e84f.png
 Description:
What my Pointers looks like.
 Filesize:  12.38 KB
 Viewed:  5785 Time(s)

bb6037dc649adf2a6052c053f488e84f.png



_________________
...
Back to top
View user's profile Send private message
dreamlane
How do I cheat?
Reputation: 0

Joined: 13 Mar 2013
Posts: 3
Location: United States

PostPosted: Wed Mar 13, 2013 8:20 am    Post subject: Reply with quote

Is Client.exe Path of Exile?

It looks similar to something I am trying to find.
Back to top
View user's profile Send private message AIM Address
larcerkev
Newbie cheater
Reputation: 0

Joined: 17 Aug 2012
Posts: 17

PostPosted: Wed Mar 13, 2013 9:51 am    Post subject: Reply with quote

I've never read pointers in C#, so I'm not sure if I'm right here but... What you might be wanting is:

Code:
public static int ReadPointer(Process p, uint pointer)


And using it like so:

Code:

address = ReadPointer(process, "Client.exe"+006B509C); // Find the base and add the offset.
address = ReadPointer(process, address + secondOffset);
address = ReadPointer(process, address + thirdOffset);
address = ReadPointer(process, address + fourthOffset);
finalAddress = address + fifthOffset;


This might be slightly wrong, someone correct me if I am since I never use C#
Back to top
View user's profile Send private message
foxfire9
Advanced Cheater
Reputation: 0

Joined: 23 Mar 2012
Posts: 57

PostPosted: Wed Mar 13, 2013 9:59 am    Post subject: Reply with quote

Dude, if you found a static address use that instead of hard to find base address. Just a temporary for now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites