private static IntPtr open(Process p) { ProcessAccessType access = ProcessAccessType.PROCESS_VM_READ | ProcessAccessType.PROCESS_VM_WRITE | ProcessAccessType.PROCESS_VM_OPERATION; return(OpenProcess((uint)access, 1, (uint)p.Id)); }
public void Open() { ProcessAccessType access = ProcessAccessType.PROCESS_VM_READ | ProcessAccessType.PROCESS_VM_WRITE | ProcessAccessType.PROCESS_VM_OPERATION; m_hProcess = OpenProcess((uint)access, 1, (uint)m_ReadProcess.Id); }
public static IntPtr OpenProcess(int pId) { ProcessAccessType access = ProcessAccessType.PROCESS_VM_READ | ProcessAccessType.PROCESS_VM_WRITE | ProcessAccessType.PROCESS_VM_OPERATION; return(OpenProcess(2035711, 0, (UInt32)pId)); //return OpenProcess((uint)access, 0, (UInt32)pId); }
public static extern IntPtr OpenProcess(ProcessAccessType dwDesiredAccess, int bInheritHandle, uint dwProcessId);
public static extern IntPtr OpenProcess( [MarshalAs(UnmanagedType.U4)] ProcessAccessType access, [MarshalAs(UnmanagedType.Bool)] bool inheritHandler, uint processId);
public static extern HANDLE OpenProcess(ProcessAccessType dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId);
public static extern IntPtr OpenProcess(ProcessAccessType access, bool inheritHandler, uint processId);
private static extern IntPtr OpenProcess(ProcessAccessType dwDesiredAccess, bool bInheritHandle, int dwProcessId);
public static extern HANDLE OpenProcess(ProcessAccessType dwDesiredAccess, int bInheritHandle, uint dwProcessId);
// const int Silence = 0x00E6A85C; static void Main(string[] args) { ProcessAccessType access = ProcessAccessType.PROCESS_QUERY_INFORMATION | ProcessAccessType.PROCESS_VM_READ | ProcessAccessType.PROCESS_VM_WRITE | ProcessAccessType.PROCESS_VM_OPERATION; Process process = Process.GetProcessesByName("revoexe").ToList().FirstOrDefault(); Console.WriteLine("Process: " + process); if (process == null) { Console.WriteLine("Error"); throw new Exception("Error has occured, looks like there no process with this name"); } IntPtr processHandle = OpenProcess((int)access, false, process.Id); //SendMessage(process, 0x000C, 0, "HELLO WORLD"); Console.WriteLine("Process pointer: " + processHandle); const int MaxHpAddress = 0x00E6E838; const int CurHpAddress = 0x00E6E834; const int MaxSpAddress = 0x00E6E840; const int CurSpAddress = 0x00E6E83C; int bytesRead = 0; byte[] bufferCurHp = new byte[4]; byte[] bufferMaxHp = new byte[4]; byte[] bufferCurSp = new byte[4]; byte[] bufferMaxSp = new byte[4]; ReadProcessMemory((int)processHandle, MaxHpAddress, bufferMaxHp, bufferMaxHp.Length, ref bytesRead); ReadProcessMemory((int)processHandle, CurHpAddress, bufferCurHp, bufferCurHp.Length, ref bytesRead); ReadProcessMemory((int)processHandle, MaxSpAddress, bufferMaxSp, bufferMaxSp.Length, ref bytesRead); ReadProcessMemory((int)processHandle, CurSpAddress, bufferCurSp, bufferCurSp.Length, ref bytesRead); int CurHpValue = 0; int MaxHpValue = 0; int MaxSpValue = 0; int CurSpValue = 0; MaxHpValue = BitConverter.ToInt32(bufferMaxHp, 0); CurHpValue = BitConverter.ToInt32(bufferCurHp, 0); CurSpValue = BitConverter.ToInt32(bufferCurSp, 0); MaxSpValue = BitConverter.ToInt32(bufferMaxSp, 0); Console.WriteLine("Cur Hp int: {0}", CurHpValue); Console.WriteLine("Max Hp int: {0}", MaxHpValue); Console.WriteLine("Cur Sp int: {0}", CurSpValue); Console.WriteLine("Max Sp int: {0}", MaxSpValue); while (CurHpValue < MaxHpValue) { Console.WriteLine("Current hp less than maxhp"); Thread.Sleep(2000); } Console.ReadKey(); }