38 Test1 =
StrStr (DestPath, L
":");
39 if ((Test1 ==
NULL) && (Cwd !=
NULL)) {
40 Test1 =
StrStr (Cwd, L
":");
78 CHAR16 *SrcPathBuffer;
79 CHAR16 *CwdPathBuffer;
82 ASSERT (CwdPath !=
NULL);
83 if (SrcPath ==
NULL) {
90 if (SrcPathBuffer ==
NULL) {
95 if (CwdPathBuffer ==
NULL) {
100 gUnicodeCollation->StrUpr (gUnicodeCollation, SrcPathBuffer);
101 gUnicodeCollation->StrUpr (gUnicodeCollation, CwdPathBuffer);
103 if (SrcPathBuffer[
StrLen (SrcPathBuffer) -1] == L
'\\') {
104 SrcPathBuffer[
StrLen (SrcPathBuffer) - 1] = CHAR_NULL;
107 if (CwdPathBuffer[
StrLen (CwdPathBuffer) - 1] == L
'\\') {
108 CwdPathBuffer[
StrLen (CwdPathBuffer) - 1] = CHAR_NULL;
111 if ((
StrCmp (CwdPathBuffer, SrcPathBuffer) == 0) ||
112 ((
StrStr (CwdPathBuffer, SrcPathBuffer) == CwdPathBuffer) &&
113 (CwdPathBuffer[
StrLen (SrcPathBuffer)] == L
'\\'))
155 CHAR16 *DestPathCopy;
156 CHAR16 *DestPathWalker;
158 if ((Cwd !=
NULL) && ((Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY)) {
171 if ( ((Attribute & EFI_FILE_READ_ONLY) != 0)
172 || (FileStatus == EFI_WRITE_PROTECTED)
173 || ((DestAttr & EFI_FILE_READ_ONLY) != 0)
181 if (DestPathCopy ==
NULL) {
185 for (DestPathWalker = DestPathCopy; *DestPathWalker == L
'\\'; DestPathWalker++) {
188 while (DestPathWalker !=
NULL && DestPathWalker[
StrLen (DestPathWalker)-1] == L
'\\') {
189 DestPathWalker[
StrLen (DestPathWalker)-1] = CHAR_NULL;
192 ASSERT (DestPathWalker !=
NULL);
193 ASSERT (SourcePath !=
NULL);
199 ((
StrStr (DestPathWalker, SourcePath) == DestPathWalker) &&
200 (DestPathWalker[
StrLen (SourcePath)] ==
'\\')
234 IN CONST CHAR16 *DestParameter,
235 IN OUT CHAR16 **DestPathPointer,
238 IN OUT UINT64 *DestAttr
250 ASSERT (DestAttr !=
NULL);
252 if (
StrStr (DestParameter, L
"\\") == DestParameter) {
258 if (DestPath ==
NULL) {
269 CurrentSize =
StrSize (DestPath);
270 StrnCatGrow (&DestPath, &CurrentSize, &DestParameter[1], 0);
272 *DestPathPointer = DestPath;
279 ShellOpenFileMetaArg ((CHAR16 *)DestParameter, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList);
292 NewSize +=
StrSize (DestParameter);
294 if (DestPath ==
NULL) {
299 StrCpyS (DestPath, NewSize /
sizeof (CHAR16), Cwd);
300 if ((DestPath[
StrLen (DestPath)-1] != L
'\\') && (DestParameter[0] != L
'\\')) {
301 StrCatS (DestPath, NewSize /
sizeof (CHAR16), L
"\\");
302 }
else if ((DestPath[
StrLen (DestPath)-1] == L
'\\') && (DestParameter[0] == L
'\\')) {
303 ((CHAR16 *)DestPath)[
StrLen (DestPath)-1] = CHAR_NULL;
306 StrCatS (DestPath, NewSize /
sizeof (CHAR16), DestParameter);
308 ASSERT (DestPath ==
NULL);
310 if (DestPath ==
NULL) {
332 if (DestPath ==
NULL) {
349 *DestPathPointer = DestPath;
390 return EFI_ACCESS_DENIED;
392 return EFI_VOLUME_FULL;
394 return EFI_UNSUPPORTED;
414 OUT CHAR16 **FullDestPath,
420 if ((FullDestPath ==
NULL) || (FileName ==
NULL) || (DestPath ==
NULL) || (*DestPath ==
NULL)) {
421 return (EFI_INVALID_PARAMETER);
427 if (*FullDestPath ==
NULL) {
428 return (EFI_OUT_OF_RESOURCES);
431 StrCpyS (*FullDestPath, Size /
sizeof (CHAR16), *DestPath);
432 if (((*FullDestPath)[
StrLen (*FullDestPath)-1] != L
'\\') && (FileName[0] != L
'\\')) {
433 StrCatS (*FullDestPath, Size /
sizeof (CHAR16), L
"\\");
436 StrCatS (*FullDestPath, Size /
sizeof (CHAR16), FileName);
459 CHAR16 *TempLocation;
467 if ((TempLocation =
StrStr (DestPath, L
":")) !=
NULL) {
477 if (NewFileInfo ==
NULL) {
479 Status = EFI_OUT_OF_RESOURCES;
482 if (DestPath[0] != L
'\\') {
494 if (NewFileInfo->
FileName[Length] == L
'\\') {
495 if (Node->FileName[0] == L
'\\') {
499 NewFileInfo->
FileName[Length] = CHAR_NULL;
547 CHAR16 *FullDestPath;
554 CHAR16 *CleanFilePathStr;
556 ASSERT (FileList !=
NULL);
557 ASSERT (DestParameter !=
NULL);
564 CleanFilePathStr =
NULL;
569 if (FullCwd ==
NULL) {
578 if (EFI_ERROR (Status)) {
579 SHELL_FREE_NON_NULL (FullCwd);
580 if (Status == EFI_OUT_OF_RESOURCES) {
587 ASSERT (CleanFilePathStr !=
NULL);
592 ShellStatus =
GetDestinationLocation (CleanFilePathStr, &DestPath, FullCwd, (BOOLEAN)(FileList->Link.ForwardLink == FileList->Link.BackLink), &Attr);
596 SHELL_FREE_NON_NULL (FullCwd);
597 return (ShellStatus);
601 if (DestPath ==
NULL) {
608 if ((HiiOutput ==
NULL) || (HiiResultOk ==
NULL)) {
609 SHELL_FREE_NON_NULL (DestPath);
610 SHELL_FREE_NON_NULL (HiiOutput);
611 SHELL_FREE_NON_NULL (HiiResultOk);
612 SHELL_FREE_NON_NULL (FullCwd);
642 SHELL_FREE_NON_NULL (FullDestPath);
662 if (Response ==
NULL) {
666 if (Response ==
NULL) {
671 case ShellPromptResponseNo:
675 case ShellPromptResponseCancel:
680 SHELL_FREE_NON_NULL (FullCwd);
682 case ShellPromptResponseAll:
685 case ShellPromptResponseYes:
691 SHELL_FREE_NON_NULL (FullCwd);
699 while (FullDestPath ==
NULL && DestPath !=
NULL && DestPath[0] != CHAR_NULL && DestPath[
StrLen (DestPath) - 1] == L
'\\') {
700 DestPath[
StrLen (DestPath) - 1] = CHAR_NULL;
709 if (EFI_ERROR (Status)) {
717 if (EFI_ERROR (Status)) {
719 if (Status == EFI_SECURITY_VIOLATION) {
721 }
else if (Status == EFI_WRITE_PROTECTED) {
723 }
else if (Status == EFI_OUT_OF_RESOURCES) {
725 }
else if (Status == EFI_DEVICE_ERROR) {
727 }
else if (Status == EFI_ACCESS_DENIED) {
735 SHELL_FREE_NON_NULL (FullDestPath);
736 SHELL_FREE_NON_NULL (DestPath);
737 SHELL_FREE_NON_NULL (HiiOutput);
738 SHELL_FREE_NON_NULL (HiiResultOk);
739 SHELL_FREE_NON_NULL (FullCwd);
740 return (ShellStatus);
758 CHAR16 *ProblemParam;
783 if (EFI_ERROR (Status)) {
784 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
831 StrCatS (Cwd, CwdSize /
sizeof (CHAR16), L
"\\");
841 for (ParamCount--, LoopCounter = 1; LoopCounter < ParamCount; LoopCounter++) {
874 if (FileList !=
NULL) {
884 SHELL_FREE_NON_NULL (Response);
890 return (ShellStatus);
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
BOOLEAN EFIAPI IsNodeAtEnd(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
CHAR16 *EFIAPI PathCleanUpDirectories(IN CHAR16 *Path)
BOOLEAN EFIAPI PathRemoveLastItem(IN OUT CHAR16 *Path)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
SHELL_STATUS CopySingleFile(IN CONST CHAR16 *Source, IN CONST CHAR16 *Dest, OUT VOID **Resp, IN BOOLEAN SilentMode, IN CONST CHAR16 *CmdName)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define SIZE_OF_EFI_FILE_INFO
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_SECURITY_VIOLATION
@ SHELL_INVALID_PARAMETER
SHELL_STATUS GetDestinationLocation(IN CONST CHAR16 *DestParameter, IN OUT CHAR16 **DestPathPointer, IN CONST CHAR16 *Cwd, IN CONST BOOLEAN SingleSource, IN OUT UINT64 *DestAttr)
EFI_STATUS MoveWithinFileSystems(IN EFI_SHELL_FILE_INFO *Node, IN CHAR16 *DestPath, OUT VOID **Resp)
SHELL_STATUS ValidateAndMoveFiles(IN EFI_SHELL_FILE_INFO *FileList, OUT VOID **Resp, IN CONST CHAR16 *DestParameter)
BOOLEAN IsBetweenFileSystem(IN CONST CHAR16 *FullName, IN CONST CHAR16 *Cwd, IN CONST CHAR16 *DestPath)
BOOLEAN IsValidMove(IN CONST CHAR16 *SourcePath, IN CONST CHAR16 *Cwd, IN CONST CHAR16 *DestPath, IN CONST UINT64 Attribute, IN CONST UINT64 DestAttr, IN CONST EFI_STATUS FileStatus)
SHELL_STATUS EFIAPI ShellCommandRunMv(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS CreateFullDestPath(IN CONST CHAR16 **DestPath, OUT CHAR16 **FullDestPath, IN CONST CHAR16 *FileName)
EFI_STATUS MoveBetweenFileSystems(IN EFI_SHELL_FILE_INFO *Node, IN CONST CHAR16 *DestPath, OUT VOID **Resp)
BOOLEAN IsSoucePathValid(IN CONST CHAR16 *SrcPath, IN CONST CHAR16 *CwdPath)
SHELL_STATUS CascadeDelete(IN EFI_SHELL_FILE_INFO *Node, IN CONST BOOLEAN Quiet)
CONST CHAR16 *EFIAPI ShellGetCurrentDir(IN CHAR16 *CONST DeviceName OPTIONAL)
EFI_STATUS EFIAPI ShellSetFileInfo(IN SHELL_FILE_HANDLE FileHandle, IN EFI_FILE_INFO *FileInfo)
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
EFI_STATUS EFIAPI ShellDeleteFileByName(IN CONST CHAR16 *FileName)
EFI_STATUS EFIAPI ShellPromptForResponseHii(IN SHELL_PROMPT_REQUEST_TYPE Type, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle, IN OUT VOID **Response)
EFI_STATUS EFIAPI ShellCloseFileMetaArg(IN OUT EFI_SHELL_FILE_INFO **ListHead)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS EFIAPI ShellFileExists(IN CONST CHAR16 *Name)
EFI_STATUS EFIAPI ShellOpenFileMetaArg(IN CHAR16 *Arg, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **ListHead)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellIsDirectory(IN CONST CHAR16 *DirName)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
SHELL_PARAM_ITEM EmptyParamList[]
Helper structure for no parameters (besides -? and -b)
INTN EFIAPI Test(CONST VOID *b1, CONST VOID *b2)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
EFI_STATUS ShellLevel2StripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString)
LIST_ENTRY Link
Linked list members.
EFI_FILE_INFO * Info
Pointer to the FileInfo struct for this file or NULL.
EFI_STATUS Status
Status of opening the file. Valid only if Handle != NULL.
CONST CHAR16 * FullName
Fully qualified filename.
CONST CHAR16 * FileName
name of this file.