+ //\r
+ //get the system volume info to check the free space\r
+ //\r
+ DestVolumeFP = ConvertShellHandleToEfiFileProtocol(DestHandle);\r
+ DestVolumeInfo = NULL;\r
+ DestVolumeInfoSize = 0;\r
+ Status = DestVolumeFP->GetInfo(\r
+ DestVolumeFP,\r
+ &gEfiFileSystemInfoGuid,\r
+ &DestVolumeInfoSize,\r
+ DestVolumeInfo\r
+ );\r
+\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ DestVolumeInfo = AllocateZeroPool(DestVolumeInfoSize);\r
+ Status = DestVolumeFP->GetInfo(\r
+ DestVolumeFP,\r
+ &gEfiFileSystemInfoGuid,\r
+ &DestVolumeInfoSize,\r
+ DestVolumeInfo\r
+ );\r
+ }\r
+\r
+ //\r
+ //check if enough space available on destination drive to complete copy\r
+ //\r
+ if (DestVolumeInfo!= NULL && (DestVolumeInfo->FreeSpace < SourceFileSize)) {\r
+ //\r
+ //not enough space on destination directory to copy file\r
+ //\r
+ SHELL_FREE_NON_NULL(DestVolumeInfo);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle);\r
+ return(SHELL_VOLUME_FULL);\r
+ } else {\r
+ //\r
+ // copy data between files\r
+ //\r
+ Buffer = AllocateZeroPool(ReadSize);\r
+ ASSERT(Buffer != NULL);\r
+ while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {\r
+ Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);\r
+ if (!EFI_ERROR(Status)) {\r
+ Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, Dest);\r
+ break;\r
+ }\r
+ } else {\r
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, Source);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ SHELL_FREE_NON_NULL(DestVolumeInfo);\r
+ }\r
+ \r