/* Find the file handle from the input menu info. */
EFI_STATUS LibGetFileHandleFromMenu(IN MENU_ENTRY *MenuEntry, OUT EFI_FILE_HANDLE *RetFileHandle)
/* Find the file handle from the input menu info. */
EFI_STATUS LibGetFileHandleFromMenu(IN MENU_ENTRY *MenuEntry, OUT EFI_FILE_HANDLE *RetFileHandle)
{
  EFI_FILE_HANDLE  Dir;
  EFI_FILE_HANDLE  NewDir;
  FILE_CONTEXT     *FileContext;
  EFI_STATUS       Status;
  FileContext = (FILE_CONTEXT *)MenuEntry->VariableContext;
  Dir         = FileContext->FileHandle;
  Status = Dir->Open (
                  Dir,
                  &NewDir,
                  FileContext->FileName,
                  EFI_FILE_READ_ONLY,
                  0
                  );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  if (!FileContext->IsRoot) {
    Dir->Close (Dir);
  }
  *RetFileHandle = NewDir;
  return EFI_SUCCESS;
}