/* Find and call ReadSection on the first section found of an executable type. */
EFI_STATUS FvFsFindExecutableSection(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol, IN FV_FILESYSTEM_FILE_INFO *FvFileInfo, IN OUT UINTN *BufferSize, IN OUT VOID **Buffer)
/* Find and call ReadSection on the first section found of an executable type. */
EFI_STATUS FvFsFindExecutableSection(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol, IN FV_FILESYSTEM_FILE_INFO *FvFileInfo, IN OUT UINTN *BufferSize, IN OUT VOID **Buffer)
{
  EFI_SECTION_TYPE  SectionType;
  UINT32            AuthenticationStatus;
  EFI_STATUS        Status;
  for (SectionType = EFI_SECTION_PE32; SectionType <= EFI_SECTION_TE; SectionType++) {
    Status = FvProtocol->ReadSection (
                           FvProtocol,
                           &FvFileInfo->NameGuid,
                           SectionType,
                           0,
                           Buffer,
                           BufferSize,
                           &AuthenticationStatus
                           );
    if (Status != EFI_NOT_FOUND) {
      return Status;
    }
  }
  return EFI_NOT_FOUND;
}