Keep Searching the internet and can't figure this out, ReadProcessMemory
is returning just fine so its executing. But the output is always empty. Lenght of the array is 0
as well.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace MemEd
{
class Program
{
static void Main(string[] args)
{
Process proc = Process.GetProcessesByName("client")[0];
byte[] buff = new byte[]{};
IntPtr bread;
IntPtr pHandle = OpenProcess(0x0010, false, proc.Id);
bool check = ReadProcessMemory(pHandle, (IntPtr)0x5EFF75B8, buff, 10, out bread);
if (!check)
Console.WriteLine("RPM Fail");
Console.WriteLine(buff.Length); //ALWAYS returns 0, Even the value is a string "xyle"
Console.WriteLine(Encoding.Unicode.GetString(buff));//Always empty, tryed most of Encoding types to check still a blank result.
Console.ReadKey();
}
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out] byte[] lpBuffer,
int dwSize,
out IntPtr lpNumberOfBytesRead);
}
}