+/**\r
+ Set the size of a file.\r
+\r
+ If FileHandle is NULL then ASSERT().\r
+\r
+ This function changes the file size info from the FileHandle's EFI_FILE_INFO\r
+ data.\r
+\r
+ @param FileHandle File handle whose size is to be changed.\r
+ @param Size New size.\r
+\r
+ @retval EFI_SUCCESS operation was completed sucessfully.\r
+ @retval EFI_DEVICE_ERROR cannot access the file.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandleSetSize (\r
+ IN EFI_FILE_HANDLE FileHandle,\r
+ IN UINT64 Size\r
+ )\r
+{\r
+ EFI_FILE_INFO *FileInfo;\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // ASSERT for FileHandle or Size being NULL\r
+ //\r
+ ASSERT (FileHandle != NULL);\r
+\r
+ //\r
+ // get the FileInfo structure\r
+ //\r
+ FileInfo = FileHandleGetInfo(FileHandle);\r
+ if (FileInfo == NULL) {\r
+ return (EFI_DEVICE_ERROR);\r
+ }\r
+\r
+ //\r
+ // Assign the FileSize pointer to the new value\r
+ //\r
+ FileInfo->FileSize = Size;\r
+\r
+ Status = FileHandleSetInfo(FileHandle, FileInfo);\r
+ //\r
+ // free the FileInfo memory\r
+ //\r
+ FreePool(FileInfo);\r
+\r
+ return (Status);\r
+}\r