-\r
-/**\r
- Function creates a device path data structure that identically matches the\r
- device path passed in.\r
-\r
- @param DevPath A pointer to a device path data structure.\r
-\r
- @return The new copy of DevPath is created to identically match the input.\r
- @return Otherwise, NULL is returned.\r
-\r
-**/\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-LibDuplicateDevicePathInstance (\r
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
- )\r
-{\r
- EFI_DEVICE_PATH_PROTOCOL *NewDevPath;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;\r
- EFI_DEVICE_PATH_PROTOCOL *Temp;\r
- UINTN Size;\r
-\r
- //\r
- // get the size of an instance from the input\r
- //\r
- Temp = DevPath;\r
- DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);\r
-\r
- //\r
- // Make a copy\r
- //\r
- NewDevPath = NULL;\r
- if (Size != 0) {\r
- NewDevPath = AllocateZeroPool (Size);\r
- ASSERT (NewDevPath != NULL);\r
- }\r
-\r
- if (NewDevPath != NULL) {\r
- CopyMem (NewDevPath, DevicePathInst, Size);\r
- }\r
-\r
- return NewDevPath;\r
-}\r