/* This routine registers the Section Extraction PPIs that have been registered with the Section Extraction Library. */
EFI_STATUS EFIAPI SectionExtractionPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
/* This routine registers the Section Extraction PPIs that have been registered with the Section Extraction Library. */
EFI_STATUS EFIAPI SectionExtractionPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
{
  EFI_STATUS              Status;
  EFI_GUID                *ExtractHandlerGuidTable;
  UINTN                   ExtractHandlerNumber;
  EFI_PEI_PPI_DESCRIPTOR  *GuidPpi;
  ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable);
  if (ExtractHandlerNumber > 0) {
    GuidPpi = (EFI_PEI_PPI_DESCRIPTOR *)AllocatePool (ExtractHandlerNumber * sizeof (EFI_PEI_PPI_DESCRIPTOR));
    ASSERT (GuidPpi != NULL);
    while (ExtractHandlerNumber-- > 0) {
      GuidPpi->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
      GuidPpi->Ppi   = (VOID *)&mCustomGuidedSectionExtractionPpi;
      GuidPpi->Guid  = &ExtractHandlerGuidTable[ExtractHandlerNumber];
      Status         = PeiServicesInstallPpi (GuidPpi++);
      ASSERT_EFI_ERROR (Status);
    }
  }
  return EFI_SUCCESS;
}