- if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||\r
- RemainingDevicePath->SubType != HW_VENDOR_DP ||\r
- DevicePathNodeLength(RemainingDevicePath) != sizeof(WIN_NT_VENDOR_DEVICE_PATH_NODE)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {\r
- if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {\r
- break;\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, go on checking other conditions\r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||\r
+ RemainingDevicePath->SubType != HW_VENDOR_DP ||\r
+ DevicePathNodeLength(RemainingDevicePath) != sizeof(WIN_NT_VENDOR_DEVICE_PATH_NODE)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ \r
+ for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {\r
+ if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if (Index >= NT_PCD_ARRAY_SIZE) {\r
+ return EFI_UNSUPPORTED;\r