]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellParametersProtocol.c
rename a file.
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellParametersProtocol.c
index de2d4d1220daf47d9404e11ac36a30a5df07bf6f..238ccd96811867382f868d07f254d228ab8b5ce9 100644 (file)
@@ -415,6 +415,14 @@ CleanUpShellParametersProtocol (
   return (Status);\r
 }\r
 \r
+/**\r
+  Determin if a file name represents a unicode file.\r
+\r
+  @param[in] FileName     Pointer to the filename to open.\r
+\r
+  @retval EFI_SUCCESS     The file is a unicode file.\r
+  @return An error upon failure.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsUnicodeFile(\r
@@ -528,7 +536,7 @@ UpdateStdInStdOutStdErr(
   ErrAppend       = FALSE;\r
   OutAppend       = FALSE;\r
   CommandLineCopy = NULL;\r
-  FirstLocation   = (CHAR16*)(-1);\r
+  FirstLocation   = NULL;\r
 \r
   if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) {\r
     return (EFI_INVALID_PARAMETER);\r
@@ -551,6 +559,7 @@ UpdateStdInStdOutStdErr(
   CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0);\r
   Status          = EFI_SUCCESS;\r
   Split           = NULL;\r
+  FirstLocation   = CommandLineCopy + StrLen(CommandLineCopy);\r
 \r
   StripQuotes(CommandLineCopy);\r
 \r
@@ -810,7 +819,7 @@ UpdateStdInStdOutStdErr(
     }\r
   }\r
 \r
-  if (FirstLocation != (CHAR16*)(-1) \r
+  if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)\r
     && ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine))\r
     ){\r
     *(NewCommandLine + (UINTN)(FirstLocation - CommandLineCopy)) = CHAR_NULL;\r
@@ -836,6 +845,9 @@ UpdateStdInStdOutStdErr(
       CommandLineWalker[0] = CHAR_NULL;\r
     }\r
 \r
+    //\r
+    // Verify not the same and not duplicating something from a split\r
+    //\r
     if (\r
       //\r
       // Check that no 2 filenames are the same\r