Improve return codes and output for ReadKey and WriteKey

Change-Id: I2a59d785a7cb12fb87698907de67d9c8ffa1dfb5