public bool WriteRSA(long address, string newKey) { IntPtr bytesWritten; int result; uint oldProtection = 0; System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); byte[] bytes = enc.GetBytes(newKey); // Make it so we can write to the memory block WinApi.VirtualProtectEx(pHandle, new IntPtr(address), new IntPtr(bytes.Length), WinApi.PAGE_EXECUTE_READWRITE, ref oldProtection); // Write to memory result = WinApi.WriteProcessMemory(pHandle, new IntPtr(address), bytes, (uint)bytes.Length, out bytesWritten); // Put the protection back on the memory block WinApi.VirtualProtectEx(pHandle, new IntPtr(address), new IntPtr(bytes.Length), oldProtection, ref oldProtection); return (result != 0); }