64bit multilevel pointers

Swift Games Accounts
  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • ► You must register to download attachments!
Nov 30, 2013
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:

            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