TianoCore EDK2 master
Loading...
Searching...
No Matches
ShellProtocol.c File Reference
#include "Shell.h"

Go to the source code of this file.

Data Structures

struct  EFI_SHELL_FILE_INFO_NO_CONST
 

Macros

#define INIT_NAME_BUFFER_SIZE   128
 

Functions

EFI_STATUS EFIAPI EfiShellClose (IN SHELL_FILE_HANDLE FileHandle)
 
BOOLEAN InternalShellProtocolIsBlockIoPresent (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
BOOLEAN InternalShellProtocolIsSimpleFileSystemPresent (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
EFI_STATUS EFIAPI EfiShellSetMap (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST CHAR16 *Mapping)
 
CONST EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromMap (IN CONST CHAR16 *Mapping)
 
CONST CHAR16 *EFIAPI EfiShellGetMapFromDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
 
CHAR16 *EFIAPI EfiShellGetFilePathFromDevicePath (IN CONST EFI_DEVICE_PATH_PROTOCOL *Path)
 
EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromFilePath (IN CONST CHAR16 *Path)
 
EFI_STATUS EFIAPI EfiShellGetDeviceName (IN EFI_HANDLE DeviceHandle, IN EFI_SHELL_DEVICE_NAME_FLAGS Flags, IN CHAR8 *Language, OUT CHAR16 **BestDeviceName)
 
EFI_STATUS EFIAPI EfiShellOpenRootByHandle (IN EFI_HANDLE DeviceHandle, OUT SHELL_FILE_HANDLE *FileHandle)
 
EFI_STATUS EFIAPI EfiShellOpenRoot (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT SHELL_FILE_HANDLE *FileHandle)
 
BOOLEAN EFIAPI EfiShellBatchIsActive (VOID)
 
EFI_STATUS InternalOpenFileDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes OPTIONAL)
 
EFI_STATUS EFIAPI EfiShellCreateFile (IN CONST CHAR16 *FileName, IN UINT64 FileAttribs, OUT SHELL_FILE_HANDLE *FileHandle)
 
EFI_STATUS EFIAPI EfiShellRegisterGuidName (IN CONST EFI_GUID *Guid, IN CONST CHAR16 *GuidName)
 
EFI_STATUS EFIAPI EfiShellOpenFileByName (IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode)
 
EFI_STATUS EFIAPI EfiShellDeleteFileByName (IN CONST CHAR16 *FileName)
 
VOID EFIAPI EfiShellDisablePageBreak (VOID)
 
VOID EFIAPI EfiShellEnablePageBreak (VOID)
 
EFI_STATUS InternalShellExecuteDevicePath (IN CONST EFI_HANDLE *ParentImageHandle, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *CommandLine OPTIONAL, IN CONST CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StartImageStatus OPTIONAL)
 
EFI_STATUS InternalShellExecute (IN CONST CHAR16 *CommandLine OPTIONAL, IN CONST CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StartImageStatus OPTIONAL)
 
STATIC BOOLEAN NestingEnabled (VOID)
 
EFI_STATUS EFIAPI EfiShellExecute (IN EFI_HANDLE *ParentImageHandle, IN CHAR16 *CommandLine OPTIONAL, IN CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StatusCode OPTIONAL)
 
VOID InternalFreeShellFileInfoNode (IN EFI_SHELL_FILE_INFO *FileListNode)
 
EFI_STATUS EFIAPI EfiShellFreeFileList (IN EFI_SHELL_FILE_INFO **FileList)
 
EFI_STATUS EFIAPI EfiShellRemoveDupInFileList (IN EFI_SHELL_FILE_INFO **FileList)
 
EFI_SHELL_FILE_INFOInternalDuplicateShellFileInfo (IN EFI_SHELL_FILE_INFO *Node, IN BOOLEAN Save)
 
EFI_SHELL_FILE_INFOCreateAndPopulateShellFileInfo (IN CONST CHAR16 *BasePath, IN CONST EFI_STATUS Status, IN CONST CHAR16 *FileName, IN CONST SHELL_FILE_HANDLE Handle, IN CONST EFI_FILE_INFO *Info)
 
EFI_STATUS EFIAPI EfiShellFindFilesInDir (IN SHELL_FILE_HANDLE FileDirHandle, OUT EFI_SHELL_FILE_INFO **FileList)
 
EFI_STATUS EFIAPI EfiShellGetGuidFromName (IN CONST CHAR16 *GuidName, OUT EFI_GUID *Guid)
 
EFI_STATUS EFIAPI EfiShellGetGuidName (IN CONST EFI_GUID *Guid, OUT CONST CHAR16 **GuidName)
 
EFI_STATUS ShellSearchHandle (IN CONST CHAR16 *FilePattern, IN EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation, IN SHELL_FILE_HANDLE FileHandle, IN OUT EFI_SHELL_FILE_INFO **FileList, IN CONST EFI_SHELL_FILE_INFO *ParentNode OPTIONAL, IN CONST CHAR16 *MapName)
 
EFI_STATUS EFIAPI EfiShellFindFiles (IN CONST CHAR16 *FilePattern, OUT EFI_SHELL_FILE_INFO **FileList)
 
EFI_STATUS EFIAPI EfiShellOpenFileList (IN CHAR16 *Path, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **FileList)
 
CONST CHAR16 *EFIAPI EfiShellGetEnvEx (IN CONST CHAR16 *Name, OUT UINT32 *Attributes OPTIONAL)
 
CONST CHAR16 *EFIAPI EfiShellGetEnv (IN CONST CHAR16 *Name)
 
EFI_STATUS InternalEfiShellSetEnv (IN CONST CHAR16 *Name, IN CONST CHAR16 *Value, IN BOOLEAN Volatile)
 
EFI_STATUS EFIAPI EfiShellSetEnv (IN CONST CHAR16 *Name, IN CONST CHAR16 *Value, IN BOOLEAN Volatile)
 
CONST CHAR16 *EFIAPI EfiShellGetCurDir (IN CONST CHAR16 *FileSystemMapping OPTIONAL)
 
EFI_STATUS EFIAPI EfiShellSetCurDir (IN CONST CHAR16 *FileSystem OPTIONAL, IN CONST CHAR16 *Dir)
 
EFI_STATUS EFIAPI EfiShellGetHelpText (IN CONST CHAR16 *Command, IN CONST CHAR16 *Sections OPTIONAL, OUT CHAR16 **HelpText)
 
BOOLEAN EFIAPI EfiShellGetPageBreak (VOID)
 
BOOLEAN EFIAPI EfiShellIsRootShell (VOID)
 
CHAR16 * InternalEfiShellGetListAlias (VOID)
 
CHAR16 * ToLower (CHAR16 *Str)
 
CONST CHAR16 *EFIAPI EfiShellGetAlias (IN CONST CHAR16 *Alias, OUT BOOLEAN *Volatile OPTIONAL)
 
EFI_STATUS InternalSetAlias (IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
 
EFI_STATUS EFIAPI EfiShellSetAlias (IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Replace, IN BOOLEAN Volatile)
 
EFI_STATUS CreatePopulateInstallShellProtocol (IN OUT EFI_SHELL_PROTOCOL **NewShell)
 
EFI_STATUS CleanUpShellProtocol (IN OUT EFI_SHELL_PROTOCOL *NewShell)
 
EFI_STATUS CleanUpShellEnvironment (IN OUT EFI_SHELL_PROTOCOL *NewShell)
 
EFI_STATUS EFIAPI NotificationFunction (IN EFI_KEY_DATA *KeyData)
 
EFI_STATUS InernalEfiShellStartMonitor (VOID)
 

Variables

EFI_SHELL_PROTOCOL mShellProtocol
 

Detailed Description

Member functions of EFI_SHELL_PROTOCOL and functions for creation, manipulation, and initialization of EFI_SHELL_PROTOCOL.

(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ShellProtocol.c.

Macro Definition Documentation

◆ INIT_NAME_BUFFER_SIZE

#define INIT_NAME_BUFFER_SIZE   128

Definition at line 14 of file ShellProtocol.c.

Function Documentation

◆ CleanUpShellEnvironment()

EFI_STATUS CleanUpShellEnvironment ( IN OUT EFI_SHELL_PROTOCOL NewShell)

Cleanup the shell environment.

Parameters
[in,out]NewShellThe pointer to the new shell protocol structure.
Return values
EFI_SUCCESSThe operation was successful.

Definition at line 3952 of file ShellProtocol.c.

◆ CleanUpShellProtocol()

EFI_STATUS CleanUpShellProtocol ( IN OUT EFI_SHELL_PROTOCOL NewShell)

Opposite of CreatePopulateInstallShellProtocol.

Free all memory and restore the system to the state it was in before calling CreatePopulateInstallShellProtocol.

Parameters
[in,out]NewShellThe pointer to the new shell protocol structure.
Return values
EFI_SUCCESSThe operation was successful.

Definition at line 3915 of file ShellProtocol.c.

◆ CreateAndPopulateShellFileInfo()

EFI_SHELL_FILE_INFO * CreateAndPopulateShellFileInfo ( IN CONST CHAR16 *  BasePath,
IN CONST EFI_STATUS  Status,
IN CONST CHAR16 *  FileName,
IN CONST SHELL_FILE_HANDLE  Handle,
IN CONST EFI_FILE_INFO Info 
)

Allocates and populates a EFI_SHELL_FILE_INFO structure. if any memory operation failed it will return NULL.

Parameters
[in]BasePaththe Path to prepend onto filename for FullPath
[in]StatusStatus member initial value.
[in]FileNameFileName member initial value.
[in]HandleHandle member initial value.
[in]InfoInfo struct to copy.
Return values
NULLAn error occurred.
Returns
a pointer to the newly allocated structure.

Definition at line 2112 of file ShellProtocol.c.

◆ CreatePopulateInstallShellProtocol()

EFI_STATUS CreatePopulateInstallShellProtocol ( IN OUT EFI_SHELL_PROTOCOL **  NewShell)

Function to create and install on the current handle.

Will overwrite any existing ShellProtocols in the system to be sure that the current shell is in control.

This must be removed via calling CleanUpShellProtocol().

Parameters
[in,out]NewShellThe pointer to the pointer to the structure to install.
Return values
EFI_SUCCESSThe operation was successful.
Returns
An error from LocateHandle, CreateEvent, or other core function.
Todo:
support ShellEnvironment2
Todo:
Todo:
do we need to support ShellEnvironment (not ShellEnvironment2) also?

Definition at line 3766 of file ShellProtocol.c.

◆ EfiShellBatchIsActive()

BOOLEAN EFIAPI EfiShellBatchIsActive ( VOID  )

Returns whether any script files are currently being processed.

Return values
TRUEThere is at least one script file active.
FALSENo script files are active now.

Definition at line 960 of file ShellProtocol.c.

◆ EfiShellClose()

EFI_STATUS EFIAPI EfiShellClose ( IN SHELL_FILE_HANDLE  FileHandle)

Close an open file handle.

This function closes a specified file handle. All "dirty" cached file data is flushed to the device, and the file is closed. In all cases the handle is closed.

Parameters
[in]FileHandleThe file handle to close.
Return values
EFI_SUCCESSThe file handle was closed successfully.

Definition at line 29 of file ShellProtocol.c.

◆ EfiShellCreateFile()

EFI_STATUS EFIAPI EfiShellCreateFile ( IN CONST CHAR16 *  FileName,
IN UINT64  FileAttribs,
OUT SHELL_FILE_HANDLE *  FileHandle 
)

Creates a file or directory by name.

This function creates an empty new file or directory with the specified attributes and returns the new file's handle. If the file already exists and is read-only, then EFI_INVALID_PARAMETER will be returned.

If the file already existed, it is truncated and its attributes updated. If the file is created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.

If the file name begins with >v, then the file handle which is returned refers to the shell environment variable with the specified name. If the shell environment variable already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.

Parameters
FileNamePointer to NULL-terminated file path
FileAttribsThe new file's attributes. the different attributes are described in EFI_FILE_PROTOCOL.Open().
FileHandleOn return, points to the created file handle or directory's handle
Return values
EFI_SUCCESSThe file was opened. FileHandle points to the new file's handle.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value.
EFI_UNSUPPORTEDcould not open the file path
EFI_NOT_FOUNDthe specified file could not be found on the device, or could not file the file system on the device.
EFI_NO_MEDIAthe device has no medium.
EFI_MEDIA_CHANGEDThe device has a different medium in it or the medium is no longer supported.
EFI_DEVICE_ERRORThe device reported an error or can't get the file path according the DirName.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_WRITE_PROTECTEDAn attempt was made to create a file, or open a file for write when the media is write-protected.
EFI_ACCESS_DENIEDThe service denied access to the file.
EFI_OUT_OF_RESOURCESNot enough resources were available to open the file.
EFI_VOLUME_FULLThe volume is full.

Definition at line 1165 of file ShellProtocol.c.

◆ EfiShellDeleteFileByName()

EFI_STATUS EFIAPI EfiShellDeleteFileByName ( IN CONST CHAR16 *  FileName)

Deletes the file specified by the file name.

This function deletes a file.

Parameters
FileNamePoints to the NULL-terminated file name.
Return values
EFI_SUCCESSThe file was closed and deleted, and the handle was closed.
EFI_WARN_DELETE_FAILUREThe handle was closed but the file was not deleted.
See also
EfiShellCreateFile

Definition at line 1407 of file ShellProtocol.c.

◆ EfiShellDisablePageBreak()

VOID EFIAPI EfiShellDisablePageBreak ( VOID  )

Disables the page break output mode.

Definition at line 1440 of file ShellProtocol.c.

◆ EfiShellEnablePageBreak()

VOID EFIAPI EfiShellEnablePageBreak ( VOID  )

Enables the page break output mode.

Definition at line 1452 of file ShellProtocol.c.

◆ EfiShellExecute()

EFI_STATUS EFIAPI EfiShellExecute ( IN EFI_HANDLE ParentImageHandle,
IN CHAR16 *CommandLine  OPTIONAL,
IN CHAR16 **Environment  OPTIONAL,
OUT EFI_STATUS *StatusCode  OPTIONAL 
)

Execute the command line.

This function creates a nested instance of the shell and executes the specified command (CommandLine) with the specified environment (Environment). Upon return, the status code returned by the specified command is placed in StatusCode.

If Environment is NULL, then the current environment is used and all changes made by the commands executed will be reflected in the current environment. If the Environment is non-NULL, then the changes made will be discarded.

The CommandLine is executed from the current working directory on the current device.

Parameters
ParentImageHandleA handle of the image that is executing the specified command line.
CommandLinePoints to the NULL-terminated UCS-2 encoded string containing the command line. If NULL then the command- line will be empty.
EnvironmentPoints to a NULL-terminated array of environment variables with the format 'x=y', where x is the environment variable name and y is the value. If this is NULL, then the current shell environment is used.
StatusCodePoints to the status code returned by the CommandLine.
Return values
EFI_SUCCESSThe command executed successfully. The status code returned by the command is pointed to by StatusCode.
EFI_INVALID_PARAMETERThe parameters are invalid.
EFI_OUT_OF_RESOURCESOut of resources.
EFI_UNSUPPORTEDNested shell invocations are not allowed.
EFI_UNSUPPORTEDThe support level required for this function is not present.
See also
InternalShellExecuteDevicePath

Definition at line 1818 of file ShellProtocol.c.

◆ EfiShellFindFiles()

EFI_STATUS EFIAPI EfiShellFindFiles ( IN CONST CHAR16 *  FilePattern,
OUT EFI_SHELL_FILE_INFO **  FileList 
)

Find files that match a specified pattern.

This function searches for all files and directories that match the specified FilePattern. The FilePattern can contain wild-card characters. The resulting file information is placed in the file list FileList.

Wildcards are processed according to the rules specified in UEFI Shell 2.0 spec section 3.7.1.

The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo field is set to NULL.

if *FileList is not NULL then it must be a pre-existing and properly initialized list.

Parameters
FilePatternPoints to a NULL-terminated shell file path, including wildcards.
FileListOn return, points to the start of a file list containing the names of all matching files or else points to NULL if no matching files were found. only on a EFI_SUCCESS return will; this be non-NULL.
Return values
EFI_SUCCESSFiles found. FileList is a valid list.
EFI_NOT_FOUNDNo files found.
EFI_NO_MEDIAThe device has no media
EFI_DEVICE_ERRORThe device reported an error
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted

Definition at line 2638 of file ShellProtocol.c.

◆ EfiShellFindFilesInDir()

EFI_STATUS EFIAPI EfiShellFindFilesInDir ( IN SHELL_FILE_HANDLE  FileDirHandle,
OUT EFI_SHELL_FILE_INFO **  FileList 
)

Find all files in a specified directory.

Parameters
FileDirHandleHandle of the directory to search.
FileListOn return, points to the list of files in the directory or NULL if there are no files in the directory.
Return values
EFI_SUCCESSFile information was returned successfully.
EFI_VOLUME_CORRUPTEDThe file system structures have been corrupted.
EFI_DEVICE_ERRORThe device reported an error.
EFI_NO_MEDIAThe device media is not present.
EFI_INVALID_PARAMETERThe FileDirHandle was not a directory.
Returns
An error from FileHandleGetFileName().

Definition at line 2205 of file ShellProtocol.c.

◆ EfiShellFreeFileList()

EFI_STATUS EFIAPI EfiShellFreeFileList ( IN EFI_SHELL_FILE_INFO **  FileList)

Frees the file list.

This function cleans up the file list and any related data structures. It has no impact on the files themselves.

Parameters
FileListThe file list to free. Type EFI_SHELL_FILE_INFO is defined in OpenFileList()
Return values
EFI_SUCCESSFree the file list successfully.
EFI_INVALID_PARAMETERFileList was NULL or *FileList was NULL;

Definition at line 1938 of file ShellProtocol.c.

◆ EfiShellGetAlias()

CONST CHAR16 *EFIAPI EfiShellGetAlias ( IN CONST CHAR16 *  Alias,
OUT BOOLEAN *Volatile  OPTIONAL 
)

This function returns the command associated with a alias or a list of all alias'.

Parameters
[in]AliasPoints to the NULL-terminated shell alias. If this parameter is NULL, then all aliases will be returned in ReturnedData.
[out]Volatileupon return of a single command if TRUE indicates this is stored in a volatile fashion. FALSE otherwise.
Returns
If Alias is not NULL, it will return a pointer to the NULL-terminated command for that alias. If Alias is NULL, ReturnedData points to a ';' delimited list of alias (e.g. ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.
Return values
NULLan error occurred
NULLAlias was not a valid Alias

Definition at line 3520 of file ShellProtocol.c.

◆ EfiShellGetCurDir()

CONST CHAR16 *EFIAPI EfiShellGetCurDir ( IN CONST CHAR16 *FileSystemMapping  OPTIONAL)

Returns the current directory on the specified device.

If FileSystemMapping is NULL, it returns the current working directory. If the FileSystemMapping is not NULL, it returns the current directory associated with the FileSystemMapping. In both cases, the returned name includes the file system mapping (i.e. fs0:\current-dir).

Note that the current directory string should exclude the tailing backslash character.

Parameters
FileSystemMappingA pointer to the file system mapping. If NULL, then the current working directory is returned.
Return values
!=NULLThe current directory.
NULLCurrent directory does not exist.

Definition at line 3083 of file ShellProtocol.c.

◆ EfiShellGetDeviceName()

EFI_STATUS EFIAPI EfiShellGetDeviceName ( IN EFI_HANDLE  DeviceHandle,
IN EFI_SHELL_DEVICE_NAME_FLAGS  Flags,
IN CHAR8 *  Language,
OUT CHAR16 **  BestDeviceName 
)

Gets the name of the device specified by the device handle.

This function gets the user-readable name of the device specified by the device handle. If no user-readable name could be generated, then *BestDeviceName will be NULL and EFI_NOT_FOUND will be returned.

If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on DeviceHandle.

If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle. If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.

Parameters
DeviceHandleThe handle of the device.
FlagsDetermines the possible sources of component names. Valid bits are: EFI_DEVICE_NAME_USE_COMPONENT_NAME EFI_DEVICE_NAME_USE_DEVICE_PATH
LanguageA pointer to the language specified for the device name, in the same format as described in the UEFI specification, Appendix M
BestDeviceNameOn return, points to the callee-allocated NULL- terminated name of the device. If no device name could be found, points to NULL. The name must be freed by the caller...
Return values
EFI_SUCCESSGet the name successfully.
EFI_NOT_FOUNDFail to get the device name.
EFI_INVALID_PARAMETERFlags did not have a valid bit set.
EFI_INVALID_PARAMETERBestDeviceName was NULL
EFI_INVALID_PARAMETERDeviceHandle was NULL

Definition at line 651 of file ShellProtocol.c.

◆ EfiShellGetDevicePathFromFilePath()

EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromFilePath ( IN CONST CHAR16 *  Path)

Converts a file system style name to a device path.

This function converts a file system style name to a device path, by replacing any mapping references to the associated device path.

Parameters
[in]PathThe pointer to the path.
Returns
The pointer of the file path. The file path is callee allocated and should be freed by the caller.
Return values
NULLThe path could not be found.
NULLThere was not enough available memory.
Todo:
BlockIo?

Definition at line 502 of file ShellProtocol.c.

◆ EfiShellGetDevicePathFromMap()

CONST EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromMap ( IN CONST CHAR16 *  Mapping)

Gets the device path from the mapping.

This function gets the device path associated with a mapping.

Parameters
MappingA pointer to the mapping
Return values
!=NULLPointer to the device path that corresponds to the device mapping. The returned pointer does not need to be freed.
NULLThere is no device path associated with the specified mapping.

Definition at line 204 of file ShellProtocol.c.

◆ EfiShellGetEnv()

CONST CHAR16 *EFIAPI EfiShellGetEnv ( IN CONST CHAR16 *  Name)

Gets either a single or list of environment variables.

If name is not NULL then this function returns the current value of the specified environment variable.

If Name is NULL, then a list of all environment variable names is returned. Each is a NULL terminated string with a double NULL terminating the list.

Parameters
NameA pointer to the environment variable name. If Name is NULL, then the function will return all of the defined shell environment variables. In the case where multiple environment variables are being returned, each variable will be terminated by a NULL, and the list will be terminated by a double NULL.
Return values
!=NULLA pointer to the returned string. The returned pointer does not need to be freed by the caller.
NULLThe environment variable doesn't exist or there are no environment variables.

Definition at line 2961 of file ShellProtocol.c.

◆ EfiShellGetEnvEx()

CONST CHAR16 *EFIAPI EfiShellGetEnvEx ( IN CONST CHAR16 *  Name,
OUT UINT32 *Attributes  OPTIONAL 
)

Gets the environment variable and Attributes, or list of environment variables. Can be used instead of GetEnv().

This function returns the current value of the specified environment variable and the Attributes. If no variable name was specified, then all of the known variables will be returned.

Parameters
[in]NameA pointer to the environment variable name. If Name is NULL, then the function will return all of the defined shell environment variables. In the case where multiple environment variables are being returned, each variable will be terminated by a NULL, and the list will be terminated by a double NULL.
[out]AttributesIf not NULL, a pointer to the returned attributes bitmask for the environment variable. In the case where Name is NULL, and multiple environment variables are being returned, Attributes is undefined.
Return values
NULLThe environment variable doesn't exist.
Returns
A non-NULL value points to the variable's value. The returned pointer does not need to be freed by the caller.

Definition at line 2835 of file ShellProtocol.c.

◆ EfiShellGetFilePathFromDevicePath()

CHAR16 *EFIAPI EfiShellGetFilePathFromDevicePath ( IN CONST EFI_DEVICE_PATH_PROTOCOL Path)

Converts a device path to a file system-style path.

This function converts a device path to a file system path by replacing part, or all, of the device path with the file-system mapping. If there are more than one application file system mappings, the one that most closely matches Path will be used.

Parameters
PathThe pointer to the device path
Return values
NULLthe device path could not be found.
Returns
all The pointer of the NULL-terminated file path. The path is callee-allocated and should be freed by the caller.
Todo:
BlockIo?
Todo:
BlockIo?

Definition at line 379 of file ShellProtocol.c.

◆ EfiShellGetGuidFromName()

EFI_STATUS EFIAPI EfiShellGetGuidFromName ( IN CONST CHAR16 *  GuidName,
OUT EFI_GUID Guid 
)

Get the GUID value from a human readable name.

If GuidName is a known GUID name, then update Guid to have the correct value for that GUID.

This function is only available when the major and minor versions in the EfiShellProtocol are greater than or equal to 2 and 1, respectively.

Parameters
[in]GuidNameA pointer to the localized name for the GUID being queried.
[out]GuidA pointer to the GUID structure to be filled in.
Return values
EFI_SUCCESSThe operation was successful.
EFI_INVALID_PARAMETERGuid was NULL.
EFI_INVALID_PARAMETERGuidName was NULL.
EFI_NOT_FOUNDGuidName is not a known GUID Name.

Definition at line 2323 of file ShellProtocol.c.

◆ EfiShellGetGuidName()

EFI_STATUS EFIAPI EfiShellGetGuidName ( IN CONST EFI_GUID Guid,
OUT CONST CHAR16 **  GuidName 
)

Get the human readable name for a GUID from the value.

If Guid is assigned a name, then update *GuidName to point to the name. The callee should not modify the value.

This function is only available when the major and minor versions in the EfiShellProtocol are greater than or equal to 2 and 1, respectively.

Parameters
[in]GuidA pointer to the GUID being queried.
[out]GuidNameA pointer to a pointer the localized to name for the GUID being requested
Return values
EFI_SUCCESSThe operation was successful.
EFI_INVALID_PARAMETERGuid was NULL.
EFI_INVALID_PARAMETERGuidName was NULL.
EFI_NOT_FOUNDGuid is not assigned a name.

Definition at line 2363 of file ShellProtocol.c.

◆ EfiShellGetHelpText()

EFI_STATUS EFIAPI EfiShellGetHelpText ( IN CONST CHAR16 *  Command,
IN CONST CHAR16 *Sections  OPTIONAL,
OUT CHAR16 **  HelpText 
)

Return help information about a specific command.

This function returns the help information for the specified command. The help text can be internal to the shell or can be from a UEFI Shell manual page.

If Sections is specified, then each section name listed will be compared in a casesensitive manner, to the section names described in Appendix B. If the section exists, it will be appended to the returned help text. If the section does not exist, no information will be returned. If Sections is NULL, then all help text information available will be returned.

Parameters
CommandPoints to the NULL-terminated UEFI Shell command name.
SectionsPoints to the NULL-terminated comma-delimited section names to return. If NULL, then all sections will be returned.
HelpTextOn return, points to a callee-allocated buffer containing all specified help text.
Return values
EFI_SUCCESSThe help text was returned.
EFI_OUT_OF_RESOURCESThe necessary buffer could not be allocated to hold the returned help text.
EFI_INVALID_PARAMETERHelpText is NULL
EFI_NOT_FOUNDThere is no help text available for Command.

Definition at line 3326 of file ShellProtocol.c.

◆ EfiShellGetMapFromDevicePath()

CONST CHAR16 *EFIAPI EfiShellGetMapFromDevicePath ( IN OUT EFI_DEVICE_PATH_PROTOCOL **  DevicePath)

Gets the mapping(s) that most closely matches the device path.

This function gets the mapping which corresponds to the device path *DevicePath. If there is no exact match, then the mapping which most closely matches *DevicePath is returned, and *DevicePath is updated to point to the remaining portion of the device path. If there is an exact match, the mapping is returned and *DevicePath points to the end-of-device-path node.

If there are multiple map names they will be semi-colon separated in the NULL-terminated string.

Parameters
DevicePathOn entry, points to a device path pointer. On exit, updates the pointer to point to the portion of the device path after the mapping.
Return values
NULLNo mapping was found.
Returns
!=NULL Pointer to NULL-terminated mapping. The buffer is callee allocated and should be freed by the caller.

Definition at line 253 of file ShellProtocol.c.

◆ EfiShellGetPageBreak()

BOOLEAN EFIAPI EfiShellGetPageBreak ( VOID  )

Gets the enable status of the page break output mode.

User can use this function to determine current page break mode.

Return values
TRUEThe page break output mode is enabled.
FALSEThe page break output mode is disabled.

Definition at line 3381 of file ShellProtocol.c.

◆ EfiShellIsRootShell()

BOOLEAN EFIAPI EfiShellIsRootShell ( VOID  )

Judges whether the active shell is the root shell.

This function makes the user to know that whether the active Shell is the root shell.

Return values
TRUEThe active Shell is the root Shell.
FALSEThe active Shell is NOT the root Shell.

Definition at line 3398 of file ShellProtocol.c.

◆ EfiShellOpenFileByName()

EFI_STATUS EFIAPI EfiShellOpenFileByName ( IN CONST CHAR16 *  FileName,
OUT SHELL_FILE_HANDLE *  FileHandle,
IN UINT64  OpenMode 
)

Opens a file or a directory by file name.

This function opens the specified file in the specified OpenMode and returns a file handle. If the file name begins with >v, then the file handle which is returned refers to the shell environment variable with the specified name. If the shell environment variable exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER is returned.

If the file name is >i, then the file handle which is returned refers to the standard input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER is returned.

If the file name is >o, then the file handle which is returned refers to the standard output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is returned.

If the file name is >e, then the file handle which is returned refers to the standard error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is returned.

If the file name is NUL, then the file handle that is returned refers to the standard NUL file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is returned.

If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the FileHandle is NULL.

Parameters
FileNamePoints to the NULL-terminated UCS-2 encoded file name.
FileHandleOn return, points to the file handle.
OpenModeFile open mode. Either EFI_FILE_MODE_READ or EFI_FILE_MODE_WRITE from section 12.4 of the UEFI Specification.
Return values
EFI_SUCCESSThe file was opened. FileHandle has the opened file's handle.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value. FileHandle is NULL.
EFI_UNSUPPORTEDCould not open the file path. FileHandle is NULL.
EFI_NOT_FOUNDThe specified file could not be found on the device or the file system could not be found on the device. FileHandle is NULL.
EFI_NO_MEDIAThe device has no medium. FileHandle is NULL.
EFI_MEDIA_CHANGEDThe device has a different medium in it or the medium is no longer supported. FileHandle is NULL.
EFI_DEVICE_ERRORThe device reported an error or can't get the file path according the FileName. FileHandle is NULL.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted. FileHandle is NULL.
EFI_WRITE_PROTECTEDAn attempt was made to create a file, or open a file for write when the media is write-protected. FileHandle is NULL.
EFI_ACCESS_DENIEDThe service denied access to the file. FileHandle is NULL.
EFI_OUT_OF_RESOURCESNot enough resources were available to open the file. FileHandle is NULL.
EFI_VOLUME_FULLThe volume is full. FileHandle is NULL.

Definition at line 1288 of file ShellProtocol.c.

◆ EfiShellOpenFileList()

EFI_STATUS EFIAPI EfiShellOpenFileList ( IN CHAR16 *  Path,
IN UINT64  OpenMode,
IN OUT EFI_SHELL_FILE_INFO **  FileList 
)

Opens the files that match the path specified.

This function opens all of the files specified by Path. Wildcards are processed according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.

Parameters
PathA pointer to the path string.
OpenModeSpecifies the mode used to open each file, EFI_FILE_MODE_READ or EFI_FILE_MODE_WRITE.
FileListPoints to the start of a list of files opened.
Return values
EFI_SUCCESSCreate the file list successfully.
Returns
Others Can't create the file list.

Definition at line 2725 of file ShellProtocol.c.

◆ EfiShellOpenRoot()

EFI_STATUS EFIAPI EfiShellOpenRoot ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
OUT SHELL_FILE_HANDLE *  FileHandle 
)

Opens the root directory of a device.

This function opens the root directory of a device and returns a file handle to it.

Parameters
DevicePathPoints to the device path corresponding to the device where the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.
FileHandleOn exit, points to the file handle corresponding to the root directory on the device.
Return values
EFI_SUCCESSRoot opened successfully.
EFI_NOT_FOUNDEFI_SIMPLE_FILE_SYSTEM could not be found or the root directory could not be opened.
EFI_VOLUME_CORRUPTEDThe data structures in the volume were corrupted.
EFI_DEVICE_ERRORThe device had an error
EFI_INVALID_PARAMETERFileHandle is NULL.
Todo:
BlockIo?

Definition at line 923 of file ShellProtocol.c.

◆ EfiShellOpenRootByHandle()

EFI_STATUS EFIAPI EfiShellOpenRootByHandle ( IN EFI_HANDLE  DeviceHandle,
OUT SHELL_FILE_HANDLE *  FileHandle 
)

Opens the root directory of a device on a handle

This function opens the root directory of a device and returns a file handle to it.

Parameters
DeviceHandleThe handle of the device that contains the volume.
FileHandleOn exit, points to the file handle corresponding to the root directory on the device.
Return values
EFI_SUCCESSRoot opened successfully.
EFI_NOT_FOUNDEFI_SIMPLE_FILE_SYSTEM could not be found or the root directory could not be opened.
EFI_VOLUME_CORRUPTEDThe data structures in the volume were corrupted.
EFI_DEVICE_ERRORThe device had an error.
OthersError status returned from EFI_SIMPLE_FILE_SYSTEM_PROTOCOL->OpenVolume().

Definition at line 855 of file ShellProtocol.c.

◆ EfiShellRegisterGuidName()

EFI_STATUS EFIAPI EfiShellRegisterGuidName ( IN CONST EFI_GUID Guid,
IN CONST CHAR16 *  GuidName 
)

Register a GUID and a localized human readable name for it.

If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID names must be used whenever a shell command outputs GUID information.

This function is only available when the major and minor versions in the EfiShellProtocol are greater than or equal to 2 and 1, respectively.

Parameters
[in]GuidA pointer to the GUID being registered.
[in]GuidNameA pointer to the localized name for the GUID being registered.
Return values
EFI_SUCCESSThe operation was successful.
EFI_INVALID_PARAMETERGuid was NULL.
EFI_INVALID_PARAMETERGuidName was NULL.
EFI_ACCESS_DENIEDGuid already is assigned a name.

Definition at line 1226 of file ShellProtocol.c.

◆ EfiShellRemoveDupInFileList()

EFI_STATUS EFIAPI EfiShellRemoveDupInFileList ( IN EFI_SHELL_FILE_INFO **  FileList)

Deletes the duplicate file names files in the given file list.

This function deletes the reduplicate files in the given file list.

Parameters
FileListA pointer to the first entry in the file list.
Return values
EFI_SUCCESSAlways success.
EFI_INVALID_PARAMETERFileList was NULL or *FileList was NULL;

Definition at line 1974 of file ShellProtocol.c.

◆ EfiShellSetAlias()

EFI_STATUS EFIAPI EfiShellSetAlias ( IN CONST CHAR16 *  Command,
IN CONST CHAR16 *  Alias,
IN BOOLEAN  Replace,
IN BOOLEAN  Volatile 
)

Changes a shell command alias.

This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias.

Parameters
[in]CommandPoints to the NULL-terminated shell command or existing alias.
[in]AliasPoints to the NULL-terminated alias for the shell command. If this is NULL, and Command refers to an alias, that alias will be deleted.
[in]ReplaceIf TRUE and the alias already exists, then the existing alias will be replaced. If FALSE and the alias already exists, then the existing alias is unchanged and EFI_ACCESS_DENIED is returned.
[in]Volatileif TRUE the Alias being set will be stored in a volatile fashion. if FALSE the Alias being set will be stored in a non-volatile fashion.
Return values
EFI_SUCCESSAlias created or deleted successfully.
EFI_NOT_FOUNDthe Alias intended to be deleted was not found
EFI_ACCESS_DENIEDThe alias is a built-in alias or already existed and Replace was set to FALSE.
EFI_INVALID_PARAMETERCommand is null or the empty string.

Definition at line 3671 of file ShellProtocol.c.

◆ EfiShellSetCurDir()

EFI_STATUS EFIAPI EfiShellSetCurDir ( IN CONST CHAR16 *FileSystem  OPTIONAL,
IN CONST CHAR16 *  Dir 
)

Changes the current directory on the specified device.

If the FileSystem is NULL, and the directory Dir does not contain a file system's mapped name, this function changes the current working directory.

If the FileSystem is NULL and the directory Dir contains a mapped name, then the current file system and the current directory on that file system are changed.

If FileSystem is NULL, and Dir is not NULL, then this changes the current working file system.

If FileSystem is not NULL and Dir is not NULL, then this function changes the current directory on the specified file system.

If the current working directory or the current working file system is changed then the cwd% environment variable will be updated

Note that the current directory string should exclude the tailing backslash character.

Parameters
FileSystemA pointer to the file system's mapped name. If NULL, then the current working directory is changed.
DirPoints to the NULL-terminated directory on the device specified by FileSystem.
Return values
EFI_SUCCESSThe operation was successful
EFI_NOT_FOUNDThe file system could not be found

Definition at line 3143 of file ShellProtocol.c.

◆ EfiShellSetEnv()

EFI_STATUS EFIAPI EfiShellSetEnv ( IN CONST CHAR16 *  Name,
IN CONST CHAR16 *  Value,
IN BOOLEAN  Volatile 
)

Sets the environment variable.

This function changes the current value of the specified environment variable. If the environment variable exists and the Value is an empty string, then the environment variable is deleted. If the environment variable exists and the Value is not an empty string, then the value of the environment variable is changed. If the environment variable does not exist and the Value is an empty string, there is no action. If the environment variable does not exist and the Value is a non-empty string, then the environment variable is created and assigned the specified value.

For a description of volatile and non-volatile environment variables, see UEFI Shell 2.0 specification section 3.6.1.

Parameters
NamePoints to the NULL-terminated environment variable name.
ValuePoints to the NULL-terminated environment variable value. If the value is an empty string then the environment variable is deleted.
VolatileIndicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
Return values
EFI_SUCCESSThe environment variable was successfully updated.

Definition at line 3036 of file ShellProtocol.c.

◆ EfiShellSetMap()

EFI_STATUS EFIAPI EfiShellSetMap ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath  OPTIONAL,
IN CONST CHAR16 *  Mapping 
)

This function creates a mapping for a device path.

If both DevicePath and Mapping are NULL, this will reset the mapping to default values.

Parameters
DevicePathPoints to the device path. If this is NULL and Mapping points to a valid mapping, then the mapping will be deleted.
MappingPoints to the NULL-terminated mapping for the device path. Must end with a ':'
Return values
EFI_SUCCESSMapping created or deleted successfully.
EFI_NO_MAPPINGThere is no handle that corresponds exactly to DevicePath. See the boot service function LocateDevicePath().
EFI_ACCESS_DENIEDThe mapping is a built-in alias.
EFI_INVALID_PARAMETERMapping was NULL
EFI_INVALID_PARAMETERMapping did not end with a ':'
EFI_INVALID_PARAMETERDevicePath was not pointing at a device that had a SIMPLE_FILE_SYSTEM_PROTOCOL installed.
EFI_NOT_FOUNDThere was no mapping found to delete
EFI_OUT_OF_RESOURCESMemory allocation failed
Todo:
add BlockIo to this test...

Definition at line 118 of file ShellProtocol.c.

◆ InernalEfiShellStartMonitor()

EFI_STATUS InernalEfiShellStartMonitor ( VOID  )

Function to start monitoring for CTRL-C using SimpleTextInputEx. This feature's enabled state was not known when the shell initially launched.

Return values
EFI_SUCCESSThe feature is enabled.
EFI_OUT_OF_RESOURCESThere is not enough memory available.

Definition at line 4028 of file ShellProtocol.c.

◆ InternalDuplicateShellFileInfo()

EFI_SHELL_FILE_INFO * InternalDuplicateShellFileInfo ( IN EFI_SHELL_FILE_INFO Node,
IN BOOLEAN  Save 
)

Allocates and duplicates a EFI_SHELL_FILE_INFO node.

Parameters
[in]NodeThe node to copy from.
[in]SaveTRUE to set Node->Handle to NULL, FALSE otherwise.
Return values
NULLa memory allocation error occurred
Returns
!= NULL a pointer to the new node

Definition at line 2057 of file ShellProtocol.c.

◆ InternalEfiShellGetListAlias()

CHAR16 * InternalEfiShellGetListAlias ( VOID  )

function to return a semi-colon delimited list of all alias' in the current shell

up to caller to free the memory.

Return values
NULLNo alias' were found
NULLAn error occurred getting alias'
Returns
!NULL a list of all alias'

Definition at line 3415 of file ShellProtocol.c.

◆ InternalEfiShellSetEnv()

EFI_STATUS InternalEfiShellSetEnv ( IN CONST CHAR16 *  Name,
IN CONST CHAR16 *  Value,
IN BOOLEAN  Volatile 
)

Internal variable setting function. Allows for setting of the read only variables.

Parameters
NamePoints to the NULL-terminated environment variable name.
ValuePoints to the NULL-terminated environment variable value. If the value is an empty string then the environment variable is deleted.
VolatileIndicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
Return values
EFI_SUCCESSThe environment variable was successfully updated.

Definition at line 2979 of file ShellProtocol.c.

◆ InternalFreeShellFileInfoNode()

VOID InternalFreeShellFileInfoNode ( IN EFI_SHELL_FILE_INFO FileListNode)

Utility cleanup function for EFI_SHELL_FILE_INFO objects.

1) frees all pointers (non-NULL) 2) Closes the SHELL_FILE_HANDLE

Parameters
FileListNodepointer to the list node to free

Definition at line 1901 of file ShellProtocol.c.

◆ InternalOpenFileDevicePath()

EFI_STATUS InternalOpenFileDevicePath ( IN OUT EFI_DEVICE_PATH_PROTOCOL DevicePath,
OUT SHELL_FILE_HANDLE *  FileHandle,
IN UINT64  OpenMode,
IN UINT64 Attributes  OPTIONAL 
)

Worker function to open a file based on a device path. this will open the root of the volume and then traverse down to the file itself.

Parameters
DevicePathDevice Path of the file.
FileHandlePointer to the file upon a successful return.
OpenModemode to open file in.
Attributesthe File Attributes to use when creating a new file.
Return values
EFI_SUCCESSthe file is open and FileHandle is valid
EFI_UNSUPPORTEDthe device path contained non-path elements
otheran error occurred.
Todo:
BlockIo?

Definition at line 985 of file ShellProtocol.c.

◆ InternalSetAlias()

EFI_STATUS InternalSetAlias ( IN CONST CHAR16 *  Command,
IN CONST CHAR16 *  Alias,
IN BOOLEAN  Volatile 
)

Changes a shell command alias.

This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias.

this function does not check for built in alias'.

Parameters
[in]CommandPoints to the NULL-terminated shell command or existing alias.
[in]AliasPoints to the NULL-terminated alias for the shell command. If this is NULL, and Command refers to an alias, that alias will be deleted.
[in]Volatileif TRUE the Alias being set will be stored in a volatile fashion. if FALSE the Alias being set will be stored in a non-volatile fashion.
Return values
EFI_SUCCESSAlias created or deleted successfully.
EFI_NOT_FOUNDthe Alias intended to be deleted was not found

Definition at line 3599 of file ShellProtocol.c.

◆ InternalShellExecute()

EFI_STATUS InternalShellExecute ( IN CONST CHAR16 *CommandLine  OPTIONAL,
IN CONST CHAR16 **Environment  OPTIONAL,
OUT EFI_STATUS *StartImageStatus  OPTIONAL 
)

internal worker function to load and run an image in the current shell.

Parameters
CommandLinePoints to the NULL-terminated UCS-2 encoded string containing the command line. If NULL then the command- line will be empty.
EnvironmentPoints to a NULL-terminated array of environment variables with the format 'x=y', where x is the environment variable name and y is the value. If this is NULL, then the current shell environment is used.
[out]StartImageStatusReturned status from the command line.
Return values
EFI_SUCCESSThe command executed successfully. The status code returned by the command is pointed to by StatusCode.
EFI_INVALID_PARAMETERThe parameters are invalid.
EFI_OUT_OF_RESOURCESOut of resources.
EFI_UNSUPPORTEDNested shell invocations are not allowed.

Definition at line 1700 of file ShellProtocol.c.

◆ InternalShellExecuteDevicePath()

EFI_STATUS InternalShellExecuteDevicePath ( IN CONST EFI_HANDLE ParentImageHandle,
IN CONST EFI_DEVICE_PATH_PROTOCOL DevicePath,
IN CONST CHAR16 *CommandLine  OPTIONAL,
IN CONST CHAR16 **Environment  OPTIONAL,
OUT EFI_STATUS *StartImageStatus  OPTIONAL 
)

internal worker function to load and run an image via device path.

Parameters
ParentImageHandleA handle of the image that is executing the specified command line.
DevicePathdevice path of the file to execute
CommandLinePoints to the NULL-terminated UCS-2 encoded string containing the command line. If NULL then the command- line will be empty.
EnvironmentPoints to a NULL-terminated array of environment variables with the format 'x=y', where x is the environment variable name and y is the value. If this is NULL, then the current shell environment is used.
[out]StartImageStatusReturned status from gBS->StartImage.
Return values
EFI_SUCCESSThe command executed successfully. The status code returned by the command is pointed to by StatusCode.
EFI_INVALID_PARAMETERThe parameters are invalid.
EFI_OUT_OF_RESOURCESOut of resources.
EFI_UNSUPPORTEDNested shell invocations are not allowed.
Todo:
initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)

Definition at line 1482 of file ShellProtocol.c.

◆ InternalShellProtocolIsBlockIoPresent()

BOOLEAN InternalShellProtocolIsBlockIoPresent ( IN CONST EFI_DEVICE_PATH_PROTOCOL DevicePath)

Internal worker to determine whether there is a BlockIo somewhere upon the device path specified.

Parameters
[in]DevicePathThe device path to test.
Return values
TRUEgEfiBlockIoProtocolGuid was installed on a handle with this device path
FALSEgEfiBlockIoProtocolGuid was not found.

Definition at line 47 of file ShellProtocol.c.

◆ InternalShellProtocolIsSimpleFileSystemPresent()

BOOLEAN InternalShellProtocolIsSimpleFileSystemPresent ( IN CONST EFI_DEVICE_PATH_PROTOCOL DevicePath)

Internal worker to determine whether there is a file system somewhere upon the device path specified.

Parameters
[in]DevicePathThe device path to test.
Return values
TRUEgEfiSimpleFileSystemProtocolGuid was installed on a handle with this device path
FALSEgEfiSimpleFileSystemProtocolGuid was not found.

Definition at line 77 of file ShellProtocol.c.

◆ NestingEnabled()

STATIC BOOLEAN NestingEnabled ( VOID  )

Determine if the UEFI Shell is currently running with nesting enabled or disabled.

Return values
FALSEnesting is required
othernesting is enabled

Definition at line 1743 of file ShellProtocol.c.

◆ NotificationFunction()

EFI_STATUS EFIAPI NotificationFunction ( IN EFI_KEY_DATA KeyData)

Notification function for keystrokes.

Parameters
[in]KeyDataThe key that was pressed.
Return values
EFI_SUCCESSThe operation was successful.

Definition at line 3996 of file ShellProtocol.c.

◆ ShellSearchHandle()

EFI_STATUS ShellSearchHandle ( IN CONST CHAR16 *  FilePattern,
IN EFI_UNICODE_COLLATION_PROTOCOL UnicodeCollation,
IN SHELL_FILE_HANDLE  FileHandle,
IN OUT EFI_SHELL_FILE_INFO **  FileList,
IN CONST EFI_SHELL_FILE_INFO *ParentNode  OPTIONAL,
IN CONST CHAR16 *  MapName 
)

If FileHandle is a directory then the function reads from FileHandle and reads in each of the FileInfo structures. If one of them matches the Pattern's first "level" then it opens that handle and calls itself on that handle.

If FileHandle is a file and matches all of the remaining Pattern (which would be on its last node), then add a EFI_SHELL_FILE_INFO object for this file to fileList.

Upon a EFI_SUCCESS return fromt he function any the caller is responsible to call FreeFileList with FileList.

Parameters
[in]FilePatternThe FilePattern to check against.
[in]UnicodeCollationThe pointer to EFI_UNICODE_COLLATION_PROTOCOL structure
[in]FileHandleThe FileHandle to start with
[in,out]FileListpointer to pointer to list of found files.
[in]ParentNodeThe node for the parent. Same file as identified by HANDLE.
[in]MapNameThe file system name this file is on.
Return values
EFI_SUCCESSall files were found and the FileList contains a list.
EFI_NOT_FOUNDno files were found
EFI_OUT_OF_RESOURCESa memory allocation failed

Definition at line 2408 of file ShellProtocol.c.

◆ ToLower()

CHAR16 * ToLower ( CHAR16 *  Str)

Convert a null-terminated unicode string, in-place, to all lowercase. Then return it.

Parameters
StrThe null-terminated string to be converted to all lowercase.
Returns
The null-terminated string converted into all lowercase.

Definition at line 3485 of file ShellProtocol.c.

Variable Documentation

◆ mShellProtocol

EFI_SHELL_PROTOCOL mShellProtocol

Definition at line 3700 of file ShellProtocol.c.