/* This function deletes Device Path package from a package list node. This is a internal function. */
EFI_STATUS RemoveDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
/* This function deletes Device Path package from a package list node. This is a internal function. */
EFI_STATUS RemoveDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
{
  EFI_STATUS              Status;
  UINT8                   *Package;
  EFI_HII_PACKAGE_HEADER  Header;
  Package = PackageList->DevicePathPkg;
  if (Package == NULL) {
    return EFI_SUCCESS;
  }
  Status = InvokeRegisteredFunction (
             Private,
             EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
             (VOID *)Package,
             EFI_HII_PACKAGE_DEVICE_PATH,
             Handle
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  CopyMem (&Header, Package, sizeof (EFI_HII_PACKAGE_HEADER));
  PackageList->PackageListHdr.PackageLength -= Header.Length;
  FreePool (Package);
  PackageList->DevicePathPkg = NULL;
  return EFI_SUCCESS;
}