summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c65
-rw-r--r--ShellPkg/Include/Library/PathLib.h56
-rw-r--r--ShellPkg/Library/BasePathLib/BasePathLib.c131
-rw-r--r--ShellPkg/Library/BasePathLib/BasePathLib.inf38
-rw-r--r--ShellPkg/ShellPkg.dec2
-rw-r--r--ShellPkg/ShellPkg.dsc2
6 files changed, 42 insertions, 252 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index b0303962f..0c21deb07 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -1633,35 +1633,50 @@ EfiShellExecute(
return (EFI_UNSUPPORTED);
}
- DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
+ if (Environment != NULL) {
+ // If Environment isn't null, load a new image of the shell with its own
+ // environment
+
+ DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
+
+ DEBUG_CODE_BEGIN();
+ Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE);
+ FreePool(Temp);
+ Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE);
+ FreePool(Temp);
+ Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
+ FreePool(Temp);
+ DEBUG_CODE_END();
+
+ Temp = NULL;
+ Size = 0;
+ ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));
+ StrnCatGrow(&Temp, &Size, L"Shell.efi -_exit ", 0);
+ StrnCatGrow(&Temp, &Size, CommandLine, 0);
- DEBUG_CODE_BEGIN();
- Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE);
- FreePool(Temp);
- Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE);
- FreePool(Temp);
- Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
- FreePool(Temp);
- DEBUG_CODE_END();
+ Status = InternalShellExecuteDevicePath(
+ ParentImageHandle,
+ DevPath,
+ Temp,
+ (CONST CHAR16**)Environment,
+ StatusCode);
- Temp = NULL;
- Size = 0;
- ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));
- StrnCatGrow(&Temp, &Size, L"Shell.efi -_exit ", 0);
- StrnCatGrow(&Temp, &Size, CommandLine, 0);
+ //
+ // de-allocate and return
+ //
+ FreePool(DevPath);
+ FreePool(Temp);
+ } else {
+ // If Environment is NULL, we are free to use and mutate the current shell
+ // environment. This is much faster as uses much less memory.
- Status = InternalShellExecuteDevicePath(
- ParentImageHandle,
- DevPath,
- Temp,
- (CONST CHAR16**)Environment,
- StatusCode);
+ if (CommandLine == NULL) {
+ CommandLine = L"";
+ }
- //
- // de-allocate and return
- //
- FreePool(DevPath);
- FreePool(Temp);
+ Status = RunCommand (CommandLine);
+ }
+
return(Status);
}
diff --git a/ShellPkg/Include/Library/PathLib.h b/ShellPkg/Include/Library/PathLib.h
deleted file mode 100644
index ee473523d..000000000
--- a/ShellPkg/Include/Library/PathLib.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- Provides interface to path manipulation functions.
-
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-#ifndef _PATH_LIB_
-#define _PATH_LIB_
-
-#include <Base.h>
-#include <Library/BaseMemoryLib.h>
-
-/**
- Removes the last directory or file entry in a path by changing the last
- L'\' to a CHAR_NULL.
-
- @param[in, out] Path The pointer to the path to modify.
-
- @retval FALSE Nothing was found to remove.
- @retval TRUE A directory or file was removed.
-**/
-BOOLEAN
-EFIAPI
-PathRemoveLastItem(
- IN OUT CHAR16 *Path
- );
-
-/**
- Function to clean up paths.
-
- - Single periods in the path are removed.
- - Double periods in the path are removed along with a single parent directory.
- - Forward slashes L'/' are converted to backward slashes L'\'.
-
- This will be done inline and the existing buffer may be larger than required
- upon completion.
-
- @param[in] Path The pointer to the string containing the path.
-
- @retval NULL An error occured.
- @return Path in all other instances.
-**/
-CHAR16*
-EFIAPI
-PathCleanUpDirectories(
- IN CHAR16 *Path
- );
-
-#endif //_PATH_LIB_
diff --git a/ShellPkg/Library/BasePathLib/BasePathLib.c b/ShellPkg/Library/BasePathLib/BasePathLib.c
deleted file mode 100644
index 301bd3b27..000000000
--- a/ShellPkg/Library/BasePathLib/BasePathLib.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/** @file
- Provides interface to path manipulation functions.
-
- Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-#include <Base.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PathLib.h>
-#include <Library/BaseLib.h>
-#include <Protocol/SimpleTextIn.h>
-
-/**
- Removes the last directory or file entry in a path by changing the last
- L'\' to a CHAR_NULL.
-
- @param[in, out] Path The pointer to the path to modify.
-
- @retval FALSE Nothing was found to remove.
- @retval TRUE A directory or file was removed.
-**/
-BOOLEAN
-EFIAPI
-PathRemoveLastItem(
- IN OUT CHAR16 *Path
- )
-{
- CHAR16 *Walker;
- CHAR16 *LastSlash;
- //
- // get directory name from path... ('chop' off extra)
- //
- for ( Walker = Path, LastSlash = NULL
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
- if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
- LastSlash = Walker+1;
- }
- }
- if (LastSlash != NULL) {
- *LastSlash = CHAR_NULL;
- return (TRUE);
- }
- return (FALSE);
-}
-
-/**
- Function to clean up paths.
-
- - Single periods in the path are removed.
- - Double periods in the path are removed along with a single parent directory.
- - Forward slashes L'/' are converted to backward slashes L'\'.
-
- This will be done inline and the existing buffer may be larger than required
- upon completion.
-
- @param[in] Path The pointer to the string containing the path.
-
- @retval NULL An error occured.
- @return Path in all other instances.
-**/
-CHAR16*
-EFIAPI
-PathCleanUpDirectories(
- IN CHAR16 *Path
- )
-{
- CHAR16 *TempString;
- UINTN TempSize;
- if (Path==NULL) {
- return(NULL);
- }
-
- //
- // Fix up the '/' vs '\'
- //
- for (TempString = Path ; TempString != NULL && *TempString != CHAR_NULL ; TempString++) {
- if (*TempString == L'/') {
- *TempString = L'\\';
- }
- }
-
- //
- // Fix up the ..
- //
- while ((TempString = StrStr(Path, L"\\..\\")) != NULL) {
- *TempString = CHAR_NULL;
- TempString += 4;
- PathRemoveLastItem(Path);
- TempSize = StrSize(TempString);
- CopyMem(Path+StrLen(Path), TempString, TempSize);
- }
- if ((TempString = StrStr(Path, L"\\..")) != NULL && *(TempString + 3) == CHAR_NULL) {
- *TempString = CHAR_NULL;
- PathRemoveLastItem(Path);
- }
-
- //
- // Fix up the .
- //
- while ((TempString = StrStr(Path, L"\\.\\")) != NULL) {
- *TempString = CHAR_NULL;
- TempString += 2;
- TempSize = StrSize(TempString);
- CopyMem(Path+StrLen(Path), TempString, TempSize);
- }
- if ((TempString = StrStr(Path, L"\\.")) != NULL && *(TempString + 2) == CHAR_NULL) {
- *(TempString + 1) = CHAR_NULL;
- }
-
- while ((TempString = StrStr(Path, L"\\\\")) != NULL) {
- *TempString = CHAR_NULL;
- TempString += 1;
- TempSize = StrSize(TempString);
- CopyMem(Path+StrLen(Path), TempString, TempSize);
- }
- if ((TempString = StrStr(Path, L"\\\\")) != NULL && *(TempString + 1) == CHAR_NULL) {
- *(TempString) = CHAR_NULL;
- }
-
- return (Path);
-}
-
diff --git a/ShellPkg/Library/BasePathLib/BasePathLib.inf b/ShellPkg/Library/BasePathLib/BasePathLib.inf
deleted file mode 100644
index a9bd6a8e4..000000000
--- a/ShellPkg/Library/BasePathLib/BasePathLib.inf
+++ /dev/null
@@ -1,38 +0,0 @@
-## @file
-# Provides interface to path manipulation functions.
-#
-# Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = BasePathLib
- FILE_GUID = ED244F93-B97A-4a17-83E0-A03CF2A7F7B4
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PathLib|UEFI_APPLICATION UEFI_DRIVER
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources.common]
- BasePathLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- ShellPkg/ShellPkg.dec
-
-
-[LibraryClasses]
- BaseMemoryLib
- BaseLib \ No newline at end of file
diff --git a/ShellPkg/ShellPkg.dec b/ShellPkg/ShellPkg.dec
index 90eb08ab8..db684c603 100644
--- a/ShellPkg/ShellPkg.dec
+++ b/ShellPkg/ShellPkg.dec
@@ -109,7 +109,7 @@
gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength|50|UINT8|0x00000009
## This determins how many bytes are read out of files at a time for file operations (type, copy, etc...)
- gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|1000|UINT32|0x0000000A
+ gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x100000|UINT32|0x0000000A
[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
## This flag is used to control the protocols produced by the shell
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index 75a50ddd6..54cb7c291 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -48,7 +48,7 @@
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
+ PathLib|MdeModulePkg/Library/BasePathLib/BasePathLib.inf
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
[LibraryClasses.ARM]