/* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */
EFI_STATUS FindDxeCore(IN INTN FvInstance, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
/* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */
EFI_STATUS FindDxeCore(IN INTN FvInstance, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
{
  EFI_STATUS         Status;
  EFI_PEI_FV_HANDLE  VolumeHandle;
  if (FileHandle == NULL) {
    ASSERT (FALSE);
    return EFI_INVALID_PARAMETER;
  }
  *FileHandle = NULL;
  Status = FfsFindNextVolume (FvInstance, &VolumeHandle);
  if (!EFI_ERROR (Status)) {
    Status = FfsFindNextFile (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, VolumeHandle, FileHandle);
    if (*FileHandle) {
      Status = FfsProcessFvFile (*FileHandle);
      ASSERT_EFI_ERROR (Status);
      Status = FfsAnyFvFindFirstFile (EFI_FV_FILETYPE_DXE_CORE, &VolumeHandle, FileHandle);
    }
  }
  return Status;
}