CHAR16 **Argv;\r
SHELL_STATUS CommandReturnedStatus;\r
BOOLEAN LastError;\r
+ CHAR16 *Walker;\r
+ CHAR16 *NewCmdLine; \r
+\r
+ NewCmdLine = AllocateCopyPool (StrSize (CmdLine), CmdLine);\r
+ if (NewCmdLine == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {\r
+ if (*Walker == L'^' && *(Walker+1) == L'#') {\r
+ CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));\r
+ }\r
+ }\r
\r
//\r
// get the argc and argv updated for internal commands\r
//\r
- Status = UpdateArgcArgv(ParamProtocol, CmdLine, &Argv, &Argc);\r
+ Status = UpdateArgcArgv(ParamProtocol, NewCmdLine, &Argv, &Argc);\r
if (!EFI_ERROR(Status)) {\r
//\r
// Run the internal command.\r
Status = EFI_SUCCESS;\r
}\r
\r
+ FreePool (NewCmdLine);\r
return (Status);\r
}\r
\r
for (TempWalker = CleanOriginal; TempWalker != NULL && *TempWalker != CHAR_NULL; TempWalker++) {\r
if (*TempWalker == L'^') {\r
if (*(TempWalker + 1) == L'#') {\r
- CopyMem (TempWalker, TempWalker + 1, StrSize (TempWalker) - sizeof (TempWalker[0]));\r
+ TempWalker++;\r
}\r
} else if (*TempWalker == L'#') {\r
*TempWalker = CHAR_NULL;\r
//\r
for (CommandLine3 = CommandLine2 ; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL ; CommandLine3++) {\r
if (*CommandLine3 == L'^') {\r
- if (*(CommandLine3+1) == L'#' || *(CommandLine3+1) == L':') {\r
+ if ( *(CommandLine3+1) == L':') {\r
CopyMem(CommandLine3, CommandLine3+1, StrSize(CommandLine3) - sizeof(CommandLine3[0]));\r
+ } else if (*(CommandLine3+1) == L'#') {\r
+ CommandLine3++;\r
}\r
} else if (*CommandLine3 == L'#') {\r
*CommandLine3 = CHAR_NULL;\r
UINTN *ExitDataSizePtr;\r
CHAR16 *ImagePath;\r
UINTN Index;\r
+ CHAR16 *Walker;\r
+ CHAR16 *NewCmdLine;\r
\r
// ExitDataSize is not OPTIONAL for gBS->BootServices, provide somewhere for\r
// it to be dumped if the caller doesn't want it.\r
InitializeListHead(&OrigEnvs);\r
\r
NewHandle = NULL;\r
+ \r
+ NewCmdLine = AllocateCopyPool (StrSize (CommandLine), CommandLine);\r
+ if (NewCmdLine == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {\r
+ if (*Walker == L'^' && *(Walker+1) == L'#') {\r
+ CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));\r
+ }\r
+ }\r
\r
//\r
// Load the image with:\r
\r
if (!EFI_ERROR(Status)) {\r
ASSERT(LoadedImage->LoadOptionsSize == 0);\r
- if (CommandLine != NULL) {\r
- LoadedImage->LoadOptionsSize = (UINT32)StrSize(CommandLine);\r
- LoadedImage->LoadOptions = (VOID*)CommandLine;\r
+ if (NewCmdLine != NULL) {\r
+ LoadedImage->LoadOptionsSize = (UINT32)StrSize(NewCmdLine);\r
+ LoadedImage->LoadOptions = (VOID*)NewCmdLine;\r
}\r
\r
//\r
ShellParamsProtocol.StdIn = ShellInfoObject.NewShellParametersProtocol->StdIn;\r
ShellParamsProtocol.StdOut = ShellInfoObject.NewShellParametersProtocol->StdOut;\r
ShellParamsProtocol.StdErr = ShellInfoObject.NewShellParametersProtocol->StdErr;\r
- Status = UpdateArgcArgv(&ShellParamsProtocol, CommandLine, NULL, NULL);\r
+ Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, NULL, NULL);\r
ASSERT_EFI_ERROR(Status);\r
//\r
// Replace Argv[0] with the full path of the binary we're executing:\r
ASSERT_EFI_ERROR (CleanupStatus);\r
}\r
\r
+ FreePool (NewCmdLine);\r
+\r
return(Status);\r
}\r
/**\r