class Program
{
private static readonly int PROCESS_WM_READ = 0x0010;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
const string procName = "hl";
static Process process = null;
static IntPtr processHandle;
public static byte[] Read(int handle, int address, int size, ref int bytes)
{
byte[] buffer = new byte[size];
ReadProcessMemory(handle, address, buffer, size, ref bytes);
return buffer;
}
static void Main(string[] args)
{
int bytesRead = 0;
byte[] value = new byte[20];
int address = 0x019EF0D7;
Console.WriteLine("Starting");
process = Process.GetProcessesByName(procName)[0];
processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
while (true)
{
//ReadProcessMemory((int)processHandle, jumpAddresses, jumpValues, jumpValues.Length, ref bytesRead);
value = Read((int)processHandle, address, 20, ref bytesRead);
Console.WriteLine(int.Parse(bytesRead.ToString()) + " " + bytesRead);
Thread.Sleep(100);
}
}
}