64bit multilevel pointers

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

meekaah

Newbie
Nov 30, 2013
3
122
0
Hi guys,
i'm working on a little stats app for BF4 and i need to get the current active weapon
i have the correct offsets but it doesn't seem to work on 64bits

here is the code i'm currently using:

C++:
            var process = Process.GetProcessesByName("bf4")[0];
            var baseAddress = new IntPtr(0x1423830C8); //bf4 GameContext
            var offsetList = new int[] { 0x60, 0x2A0, 0xDC0, 0x550, 0x7E0, 0x38 };
            var buffer = new byte[4];
            var lpOutStorage = IntPtr.Zero;

            // Read the base pointer..
            var success = ReadProcessMemory(process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage);
            if (success)
            {
                // Loop each offset and read the pointers..
                for (int x = 0; x < offsetList.Length - 1; x++)
                {
                    baseAddress = (IntPtr)BitConverter.ToInt32(buffer, 0) + offsetList[x];
                    if (!ReadProcessMemory(process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage))
                        throw new Exception("error reading memory");
                }

                // Read the last pointer+offset as the main value..
                var valueBuffer = new byte[255];
                baseAddress = (IntPtr)BitConverter.ToInt32(buffer, 0) + offsetList[offsetList.Length - 1];
                if (!ReadProcessMemory(process.Handle, baseAddress, valueBuffer, (uint)valueBuffer.Length, ref lpOutStorage))
                    throw new Exception("error reading memory");
            }
what would need to be changed for it to work with 64bit app?

I've compiled in 64bits of course
If anyone has an idea, i'd be grateful

Thanks
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
ToInt32 <-- that is your problem
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods