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 


multi level pointer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Sun Dec 29, 2013 1:20 am    Post subject: multi level pointer Reply with quote

Hello i am new to the whole accessing a memory address, but with a few tutorials and the Cheat Engine tutorial i got the idea.

however im trying to read from an address, so after a while of the whole pointer scanning phase, i ended up with something like this

01BFFB668

+4
+E8
+30
+C
+48
on the last offset i changed it to +40 instead and then manually added the +8 later

As i said im new to this so i might be taking the wrong address ? unfortunatly i can not add a picture but this is how it looks
Quote:

Address:
DC0FAE48 = 55668

Description
Pointerscan result

type
4 Bytes
[X] Pointer
48
c
30
e8
4
"Game.exe" + 01BFB668 -> DC10DAC0


Firstly i would like to thank Pingo for the ProcessMemoryReader class

okay then i made a new class, ( to make the code neater ) looking like this below to add the base adress and offsets

i have not written to much yet, i just want to make it work, show me the HP and MP bar

Now the current HP does nto come up and im doing something wrong, is there anyone out there that can see my problem ?
or have i found the base address wrong ?
i dont think the address is wrong, because when i quit the game and go back in, and attack cheat engine again, the HP and MP bar do show up on cheat engine

Cheers
Frequently


Last edited by FrequentlyX on Sat Feb 01, 2014 6:08 am; edited 1 time in total
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Tue Dec 31, 2013 9:26 pm    Post subject: Reply with quote

I have been checking this page almost every hour hoping that someone has replyd with some help....

does anyone atleast know where i could go to get some help if no one here can find out what im doing wrong ?
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 1:28 am    Post subject: Reply with quote

maybe you lasz added offset?

on ct you do +48

on c# you 're doing +40 and later adding 8 and 38

maybe that is giving you miscalculations
like if you're doing in ce +40 +8 witch will lead to unknown pointer

because 0xC + 48 is something else than
0xC + 0X40 (here you have different base) + 0x8 ...
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 12:08 pm    Post subject: Reply with quote

the reason i did that was because i want to point at the address right before the cordinates i want

so if i go +40 instead of +48, i can add the +8 to give me the HP bar, where it is stored

and +38 to give me the MP bar

if i just go +48, instead of +40, how could i get the HP bar ? even when i try to disect the data structure, the HP and MP bar does not show up, it only shows up if i go back to +40, then i have the HP bar at +8 bytes and MP bar at +38 bytes of the original structure


Last edited by FrequentlyX on Wed Jan 01, 2014 12:44 pm; edited 2 times in total
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 12:23 pm    Post subject: Reply with quote

you need to seperate some things in you mind

pointer => pointer/address
pointer + offset => pointer/address

consider this:

pointer1[0x1000] + offset[10] (= 0x1010) => address[0x2000]
pointer2[0x1000] + offset[14] (= 0x1014) => address[0x3000]
pointer3[0x1000] + offset[20] (= 0x1020) => pointerX[0x5000]

now you need hp and mana. both are stored at 0x2010 and 0x2020
so you need to:
pointer1[0x1000] + offset[10] => [address[0x2000] + offset[10]] = [0x2010]
pointer1[0x1000] + offset[10] => [address[0x2000] + offset[20]] = [0x2020]

dissect data is not pointing with offsets
it is adding them to show the data


try it out for yourself,
add in CE as last offset 40 instead of 48 and you will see the address, you own C# application is reading
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 12:43 pm    Post subject: Reply with quote

Yea tried that,
it gives me a value of 0, when added 40 instead of 48, but changing to 48 gives me the correct value for the HP,

and manually going up to 78 gives me the correct value for the MP bar,

but how do i fix this in C# ?
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 12:59 pm    Post subject: Reply with quote

remove the +40 part

and add directly +48 or +78
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 1:51 pm    Post subject: Reply with quote

thank you for your help but it seems like its still not working.

the only thing i can think of that might be the problem is

when i try to manually add the pointer in CE i have to add "Game.exe" + the address,

if i dont add the "Game.exe" it wont work, and i am thinking that my code does not add that specific text to it aswell,

well i changed this :

Code:
                int playerBase = Mem.ReadMultiLevelPointer(MainPlayer.baseAddress, 4, MainPlayer.multiLevel);

                currentHPLBL.Text = "HP Bar : " + Mem.ReadFloat(playerBase + MainPlayer.offsets.healthBar);
                currentMPLBL.Text = "MP Bar : " + Mem.ReadFloat(playerBase + MainPlayer.offsets.manaBar);


into this :

Code:
                int playerBase = Mem.ReadMultiLevelPointer(MyProcess[0].MainModule.BaseAddress.ToInt32() + MainPlayer.baseAddress, 4, MainPlayer.multiLevel);

                currentHPLBL.Text = "HP Bar : " + Mem.ReadFloat(playerBase + MainPlayer.offsets.healthBar);
                currentMPLBL.Text = "MP Bar : " + Mem.ReadFloat(playerBase + MainPlayer.offsets.manaBar);



and now it atleast does not give me a value of 0

but its still not correct....
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 2:48 pm    Post subject: Reply with quote

game.exe is the module base

probably 0x40000

you can find that out in the disassembler in view




about your problem

change this
Code:
        int [] MainPlayerMultiLvl = new int[] { 0x4, 0xE8, 0x30, 0xC, 0x40 };
        PlayerDataAddr MainPlayerOffsets = new PlayerDataAddr(0x8, 0x38);


to this
Code:
        int [] MainPlayerMultiLvl = new int[] { 0x4, 0xE8, 0x30, 0xC };
        PlayerDataAddr MainPlayerOffsets = new PlayerDataAddr(0x48, 0x78);
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 3:24 pm    Post subject: Reply with quote

Oh yeh i already have changed that part


could it be that my address is wrong ??

i did the pointer scan and im left with like 23 values... even closing the game and restarting, makes all the addressses come up witht he right value
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 4:16 pm    Post subject: Reply with quote

are you executing you application with admin rights?

if in debug mode, have you started visual studio as admin?
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 4:43 pm    Post subject: Reply with quote

Yeh i do start visual studio as administrator, otherwise the code would not let me access the processors
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Wed Jan 01, 2014 5:38 pm    Post subject: Reply with quote

can you send me your project solution pls?
where did you get your ProcessMemoryReader Lib ?
Back to top
View user's profile Send private message
FrequentlyX
Newbie cheater
Reputation: 0

Joined: 29 Dec 2013
Posts: 14

PostPosted: Wed Jan 01, 2014 6:22 pm    Post subject: Reply with quote

Yeh sure but how do i send the solution to you ??
do you have skype to make it easier to talk ?

it was made by Pingo, dont know if hes still around or not
Back to top
View user's profile Send private message
UnIoN
Expert Cheater
Reputation: 2

Joined: 17 May 2011
Posts: 146

PostPosted: Thu Jan 02, 2014 3:42 am    Post subject: Reply with quote

how about irc?

http://forum.cheatengine.org/viewtopic.php?t=317146

or use any filehoster you like/prefer


if im online we still can chat on irc





if you like, you can try this i quickly wrote for myself and try if it is reading the correct value for you:
Code:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace CE_Tutorial
{
    public class GameCheats
    {
        private const int PROCESS_WM_READ = 0x0010;
        [DllImport("kernel32.dll")]
        private static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
        [DllImport("kernel32.dll")]
        private static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBufer, int dwSize, ref int lpNumberOfBytesRead);

        private Process _Process;
        private IntPtr _ProcessHandle;
        public string ProcessName { get; set; }

        public GameCheats(string ProcessName)
        {
            this.ProcessName = ProcessName;
            OpenReadAccess();
        }

        public void OpenReadAccess()
        {
            _Process = Process.GetProcessesByName(ProcessName)[0];
            _ProcessHandle = OpenProcess(PROCESS_WM_READ, false, _Process.Id);
        }

        private byte[] Read(int length, int Address, params int[] Offsets)
        {
            int bytesRead = 0;
            byte[] buffer = new byte[4];
            for(int i = 0; i <= Offsets.Length; i++)
            {
                ReadProcessMemory((int)_ProcessHandle, (i == 0) ? Address : Address + Offsets[i - 1], buffer, (i == Offsets.Length) ? length : buffer.Length, ref bytesRead);
                Address = BitConverter.ToInt32(buffer, 0);
            }
            return buffer;
        }

        public Int32 Read_Byte(int Address, params int[] Offsets)
        {
            return BitConverter.ToInt32(this.Read(1, Address, Offsets), 0);
        }
        public Int32 Read_2_Bytes(int Address, params int[] Offsets)
        {
            return BitConverter.ToInt32(this.Read(2, Address, Offsets), 0);
        }

        public Int32 Read_4_Bytes(int Address, params int[] Offsets)
        {
            return BitConverter.ToInt32(this.Read(4, Address, Offsets), 0);
        }

        public Single Read_Float(int Address, params int[] Offsets)
        {
            return BitConverter.ToSingle(this.Read(4, Address, Offsets), 0);
        }
    }
}


usable as follow:
Code:
            GameCheats cheats = new GameCheats("Tutorial-i386");
            float value = cheats.Read_Float(0x00631330, 0x494);

            Console.WriteLine(value.ToString());

            Console.ReadKey();
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 programming 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