This is the ReadProcessMemory function I've got.
Code:
[DllImport("kernel32.dll")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
This is the function to find the address from multi level pointers.
Code:
private int findAddress(int[] offsetArray)
{
byte[] buffer = new byte[4];
int arrayPosition = 0;
IntPtr bytesRead;
//IntPtr processHandle = Memory.pHandle;
int address = findBaseAddress();
foreach (int i in offsetArray)
{
if (arrayPosition != offsetArray.Length - 1)
{
Memory.ReadProcessMemory(procHandle, (IntPtr)address+i, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
arrayPosition++;
}
else
{
address += i;
}
}
string hexValue = address.ToString("X");
return address;
}
Code:
private string HPValue()
{
int pointer = findAddress(new int[] { 0x00B1BC0C, 0x0, 0x190, 0x290 });
byte[] buffer = new byte[4];
IntPtr ptrBytesRead;
Memory.ReadProcessMemory(procHandle, (IntPtr)pointer, buffer, 4, out ptrBytesRead);
return BitConverter.ToInt32(buffer, 0).ToString();
}






to get more details about the error
