/* Read a byte from a SHELL_FILE_HANDLE, buffered with a  */
STATIC EFI_STATUS FileBufferReadByte(IN SHELL_FILE_HANDLE FileHandle, IN OUT FILE_BUFFER *FileBuffer, OUT UINTN *BytesRead, OUT UINT8 *Byte)
/* Read a byte from a SHELL_FILE_HANDLE, buffered with a  */
STATIC EFI_STATUS FileBufferReadByte(IN SHELL_FILE_HANDLE FileHandle, IN OUT FILE_BUFFER *FileBuffer, OUT UINTN *BytesRead, OUT UINT8 *Byte)
{
  UINTN       ReadSize;
  EFI_STATUS  Status;
  if (FileBuffer->Left == 0) {
    ReadSize = FileBuffer->Allocated;
    Status   = gEfiShellProtocol->ReadFile (
                                    FileHandle,
                                    &ReadSize,
                                    FileBuffer->Data
                                    );
    if (EFI_ERROR (Status)) {
      return Status;
    }
    if (ReadSize == 0) {
      *BytesRead = 0;
      return EFI_SUCCESS;
    }
    FileBuffer->Next = 0;
    FileBuffer->Left = ReadSize;
  }
  *BytesRead = 1;
  *Byte      = FileBuffer->Data[FileBuffer->Next];
  FileBuffer->Next++;
  FileBuffer->Left--;
  return EFI_SUCCESS;
}