if (DevicePath != NULL) {\r
DevicePath->Type = NodeType;\r
DevicePath->SubType = NodeSubType;\r
+ SetDevicePathNodeLength (DevicePath, NodeLength);\r
}\r
\r
return DevicePath;\r
UINTN Size;\r
FILEPATH_DEVICE_PATH *FilePath;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL *FileDevicePathNode;\r
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;\r
\r
DevicePath = NULL;\r
\r
Size = StrSize (FileName);\r
- FileDevicePathNode = CreateDeviceNode (\r
- MEDIA_DEVICE_PATH,\r
- MEDIA_FILEPATH_DP,\r
- (UINT16) (Size + SIZE_OF_FILEPATH_DEVICE_PATH)\r
- );\r
- if (FileDevicePathNode != NULL) {\r
- FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePathNode;\r
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);\r
+ if (FileDevicePath != NULL) {\r
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;\r
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;\r
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;\r
CopyMem (&FilePath->PathName, FileName, Size);\r
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);\r
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));\r
+\r
if (Device != NULL) {\r
DevicePath = DevicePathFromHandle (Device);\r
}\r
- DevicePath = AppendDevicePathNode (DevicePath, FileDevicePathNode);\r
- FreePool (FileDevicePathNode);\r
+\r
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);\r
+ FreePool (FileDevicePath);\r
}\r
\r
return DevicePath;\r