/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */
UINTN EFIAPI UefiDevicePathLibGetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */
UINTN EFIAPI UefiDevicePathLibGetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{
  CONST EFI_DEVICE_PATH_PROTOCOL  *Start;
  if (DevicePath == NULL) {
    return 0;
  }
  if (!IsDevicePathValid (DevicePath, 0)) {
    return 0;
  }
  Start = DevicePath;
  while (!IsDevicePathEnd (DevicePath)) {
    DevicePath = NextDevicePathNode (DevicePath);
  }
  return ((UINTN)DevicePath - (UINTN)Start) + DevicePathNodeLength (DevicePath);
}