/* Given the input file pointer, search for the next matching section in the FFS volume. */
EFI_STATUS EFIAPI FfsFindSection(IN EFI_SECTION_TYPE SectionType, IN EFI_FFS_FILE_HEADER *FfsFileHeader, IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader)
/* Given the input file pointer, search for the next matching section in the FFS volume. */
EFI_STATUS EFIAPI FfsFindSection(IN EFI_SECTION_TYPE SectionType, IN EFI_FFS_FILE_HEADER *FfsFileHeader, IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader)
{
  UINT32                     FileSize;
  EFI_COMMON_SECTION_HEADER  *Section;
  EFI_STATUS                 Status;
  if (IS_FFS_FILE2 (FfsFileHeader)) {
    Section  = (EFI_COMMON_SECTION_HEADER *)((EFI_FFS_FILE_HEADER2 *)FfsFileHeader + 1);
    FileSize = FFS_FILE2_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER2);
  } else {
    Section  = (EFI_COMMON_SECTION_HEADER *)(FfsFileHeader + 1);
    FileSize = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);
  }
  Status = FindFfsSectionInSections (
             Section,
             FileSize,
             SectionType,
             SectionHeader
             );
  return Status;
}