/* Read Depex and pre-process the Depex for Before and After. If Section Extraction protocol returns an error via ReadSection defer the reading of the Depex. */
EFI_STATUS SmmGetDepexSectionAndPreProccess(IN EFI_SMM_DRIVER_ENTRY *DriverEntry)
/* Read Depex and pre-process the Depex for Before and After. If Section Extraction protocol returns an error via ReadSection defer the reading of the Depex. */
EFI_STATUS SmmGetDepexSectionAndPreProccess(IN EFI_SMM_DRIVER_ENTRY *DriverEntry)
{
  EFI_STATUS                     Status;
  EFI_SECTION_TYPE               SectionType;
  UINT32                         AuthenticationStatus;
  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;
  Fv = DriverEntry->Fv;
  SectionType = EFI_SECTION_SMM_DEPEX;
  Status      = Fv->ReadSection (
                      DriverEntry->Fv,
                      &DriverEntry->FileName,
                      SectionType,
                      0,
                      &DriverEntry->Depex,
                      (UINTN *)&DriverEntry->DepexSize,
                      &AuthenticationStatus
                      );
  if (EFI_ERROR (Status)) {
    if (Status == EFI_PROTOCOL_ERROR) {
      DriverEntry->DepexProtocolError = TRUE;
    } else {
      DriverEntry->Depex              = NULL;
      DriverEntry->Dependent          = TRUE;
      DriverEntry->DepexProtocolError = FALSE;
    }
  } else {
    SmmPreProcessDepex (DriverEntry);
    DriverEntry->DepexProtocolError = FALSE;
  }
  return Status;
}