/* Function gets the file information from an open file descriptor, and stores it in a buffer allocated from pool. */
VOID* LibFileInfo(IN EFI_FILE_HANDLE FHand, IN EFI_GUID *InfoType)
/* Function gets the file information from an open file descriptor, and stores it in a buffer allocated from pool. */
VOID* LibFileInfo(IN EFI_FILE_HANDLE FHand, IN EFI_GUID *InfoType)
{
  EFI_STATUS     Status;
  EFI_FILE_INFO  *Buffer;
  UINTN          BufferSize;
  Buffer     = NULL;
  BufferSize = 0;
  Status = FHand->GetInfo (
                    FHand,
                    InfoType,
                    &BufferSize,
                    Buffer
                    );
  if (Status == EFI_BUFFER_TOO_SMALL) {
    Buffer = AllocatePool (BufferSize);
    ASSERT (Buffer != NULL);
  }
  Status = FHand->GetInfo (
                    FHand,
                    InfoType,
                    &BufferSize,
                    Buffer
                    );
  return Buffer;
}