public void WriteMemory(IntPtr memoryAddress, byte[] buffer, out int bytesWritten) { IntPtr pBytesWritten = IntPtr.Zero; ProcessMemoryReaderAPI.WriteProcessMemory(handle, memoryAddress, buffer, (uint)buffer.Length, out pBytesWritten); bytesWritten = pBytesWritten.ToInt32(); }
public void OpenProcess() { ProcessMemoryReaderAPI.ProcessAccessType access = ProcessMemoryReaderAPI.ProcessAccessType.PROCESS_QUERY_INFORMATION | ProcessMemoryReaderAPI.ProcessAccessType.PROCESS_VM_READ | ProcessMemoryReaderAPI.ProcessAccessType.PROCSSS_VM_WRITE | ProcessMemoryReaderAPI.ProcessAccessType.PROCESS_VM_OPERATION; handle = ProcessMemoryReaderAPI.OpenProcess((uint)access, 1, (uint)ReadProcess.Id); }
public byte[] ReadMemory(IntPtr memoryAddress, uint bytesToRead, out int bytesRead) { byte[] buffer = new byte[bytesToRead]; IntPtr pBytesRead = IntPtr.Zero; ProcessMemoryReaderAPI.ReadProcessMemory(handle, memoryAddress, buffer, bytesToRead, out pBytesRead); bytesRead = pBytesRead.ToInt32(); return(buffer); }
public void CloseHandle() { int returnValueClose = ProcessMemoryReaderAPI.CloseHandle(handle); }