]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/ShellLib.h
udk2010.up2.shell initial release.
[mirror_edk2.git] / ShellPkg / Include / Library / ShellLib.h
index 5c644debfcf9beeb1e465919b2eee11305398154..7a5d96157bd7a8e050eb6e0cc45b51326356eb41 100644 (file)
@@ -12,7 +12,7 @@
 \r
 **/\r
 \r
-#if !defined(__SHELL_LIB__)\r
+#ifndef __SHELL_LIB__\r
 #define __SHELL_LIB__\r
 \r
 #include <Uefi.h>\r
 #include <Protocol/EfiShell.h>\r
 #include <Protocol/EfiShellParameters.h>\r
 \r
+// (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)\r
+#define MAX_FILE_NAME_LEN 512\r
+\r
+extern EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;\r
+extern EFI_SHELL_PROTOCOL            *mEfiShellProtocol;\r
+\r
 /**\r
   This function will retrieve the information about the file for the handle\r
   specified and store it in allocated pool memory.\r
 EFI_FILE_INFO*\r
 EFIAPI\r
 ShellGetFileInfo (\r
-  IN EFI_FILE_HANDLE            FileHandle\r
+  IN SHELL_FILE_HANDLE          FileHandle\r
   );\r
 \r
 /**\r
-  This function will set the information about the file for the opened handle\r
+  This function sets the information about the file for the opened handle\r
   specified.\r
 \r
   @param[in]  FileHandle        The file handle of the file for which information\r
                                 is being set.\r
 \r
-  @param[in] FileInfo           The infotmation to set.\r
+  @param[in]  FileInfo          The information to set.\r
 \r
-  @retval EFI_SUCCESS            The information was set.\r
-  @retval EFI_UNSUPPORTED       The InformationType is not known.\r
+  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid.\r
+  @retval EFI_UNSUPPORTED       The FileHandle does not support FileInfo.\r
   @retval EFI_NO_MEDIA               The device has no medium.\r
   @retval EFI_DEVICE_ERROR         The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED   The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
-  @retval EFI_VOLUME_FULL            The volume is full.\r
+  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED     The file was opened read only.\r
+  @retval EFI_VOLUME_FULL       The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellSetFileInfo (\r
-  IN EFI_FILE_HANDLE           FileHandle,\r
+  IN SHELL_FILE_HANDLE         FileHandle,\r
   IN EFI_FILE_INFO              *FileInfo\r
   );\r
 \r
@@ -75,36 +82,36 @@ ShellSetFileInfo (
   This function opens a file with the open mode according to the file path. The\r
   Attributes is valid only for EFI_FILE_MODE_CREATE.\r
 \r
-  @param[in]  FilePath                       On input the device path to the file.  On output\r
+  @param[in,out]  FilePath      On input, the device path to the file.  On output,\r
                                 the remaining device path.\r
-  @param[out]  DeviceHandle      Pointer to the system device handle.\r
-  @param[out]  FileHandle                  Pointer to the file handle.\r
-  @param[in]  OpenMode           The mode to open the file with.\r
-  @param[in]  Attributes                 The file's file attributes.\r
+  @param[out]  DeviceHandle     Pointer to the system device handle.\r
+  @param[out]  FileHandle       Pointer to the file handle.\r
+  @param[in]  OpenMode          The mode to open the file with.\r
+  @param[in]  Attributes        The file's file attributes.\r
 \r
-  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_SUCCESS          The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED            Could not open the file path.\r
+  @retval EFI_UNSUPPORTED       Could not open the file path.\r
   @retval EFI_NOT_FOUND                The specified file could not be found on the\r
                                 device or the file system could not be found on\r
                                 the device.\r
-  @retval EFI_NO_MEDIA               The device has no medium.\r
-  @retval EFI_MEDIA_CHANGED        The device has a different medium in it or the\r
+  @retval EFI_NO_MEDIA          The device has no medium.\r
+  @retval EFI_MEDIA_CHANGED     The device has a different medium in it or the\r
                                 medium is no longer supported.\r
-  @retval EFI_DEVICE_ERROR         The device reported an error.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
+  @retval EFI_WRITE_PROTECTED   The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED     The file was opened read only.\r
   @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the\r
                                 file.\r
-  @retval EFI_VOLUME_FULL            The volume is full.\r
+  @retval EFI_VOLUME_FULL       The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellOpenFileByDevicePath(\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL        **FilePath,\r
   OUT EFI_HANDLE                       *DeviceHandle,\r
-  OUT EFI_FILE_HANDLE                  *FileHandle,\r
+  OUT SHELL_FILE_HANDLE                *FileHandle,\r
   IN UINT64                            OpenMode,\r
   IN UINT64                            Attributes\r
   );\r
@@ -113,36 +120,36 @@ ShellOpenFileByDevicePath(
   This function will open a file or directory referenced by filename.\r
 \r
   If return is EFI_SUCCESS, the Filehandle is the opened file's handle;\r
-  otherwise, the Filehandle is NULL. The Attributes is valid only for\r
+  otherwise, the Filehandle is NULL. Attributes is valid only for\r
   EFI_FILE_MODE_CREATE.\r
 \r
-  @param[in] FileName                Pointer to file name.\r
-  @param[out] FileHandle                   Pointer to the file handle.\r
-  @param[in] OpenMode                  The mode to open the file with.\r
-  @param[in] Attributes                      The file's file attributes.\r
+  @param[in] FilePath           The pointer to file name.\r
+  @param[out] FileHandle        The pointer to the file handle.\r
+  @param[in] OpenMode           The mode to open the file with.\r
+  @param[in] Attributes         The file's file attributes.\r
 \r
-  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_SUCCESS          The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED            Could not open the file path.\r
+  @retval EFI_UNSUPPORTED       Could not open the file path.\r
   @retval EFI_NOT_FOUND                The specified file could not be found on the\r
                                 device or the file system could not be found\r
                                 on the device.\r
-  @retval EFI_NO_MEDIA               The device has no medium.\r
-  @retval EFI_MEDIA_CHANGED        The device has a different medium in it or the\r
+  @retval EFI_NO_MEDIA          The device has no medium.\r
+  @retval EFI_MEDIA_CHANGED     The device has a different medium in it or the\r
                                 medium is no longer supported.\r
-  @retval EFI_DEVICE_ERROR         The device reported an error.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
+  @retval EFI_WRITE_PROTECTED   The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED     The file was opened read only.\r
   @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the\r
                                 file.\r
-  @retval EFI_VOLUME_FULL            The volume is full.\r
+  @retval EFI_VOLUME_FULL       The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellOpenFileByName(\r
   IN CONST CHAR16                          *FilePath,\r
-  OUT EFI_FILE_HANDLE           *FileHandle,\r
+  OUT SHELL_FILE_HANDLE         *FileHandle,\r
   IN UINT64                     OpenMode,\r
   IN UINT64                            Attributes\r
   );\r
@@ -154,31 +161,31 @@ ShellOpenFileByName(
   otherwise, the Filehandle is NULL. If the directory already existed, this\r
   function opens the existing directory.\r
 \r
-  @param[in]  DirectoryName     Pointer to Directory name.\r
-  @param[out] FileHandle        Pointer to the file handle.\r
+  @param[in]  DirectoryName     The pointer to Directory name.\r
+  @param[out] FileHandle        The pointer to the file handle.\r
 \r
-  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_SUCCESS          The information was set.\r
   @retval EFI_INVALID_PARAMETER        One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED            Could not open the file path.\r
+  @retval EFI_UNSUPPORTED       Could not open the file path.\r
   @retval EFI_NOT_FOUND                The specified file could not be found on the\r
-                                device or the file system could not be found\r
+                                device, or the file system could not be found\r
                                 on the device.\r
-  @retval EFI_NO_MEDIA               The device has no medium.\r
-  @retval EFI_MEDIA_CHANGED        The device has a different medium in it or the\r
+  @retval EFI_NO_MEDIA          The device has no medium.\r
+  @retval EFI_MEDIA_CHANGED     The device has a different medium in it or the\r
                                 medium is no longer supported.\r
-  @retval EFI_DEVICE_ERROR         The device reported an error.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
+  @retval EFI_WRITE_PROTECTED   The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED     The file was opened read only.\r
   @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the\r
                                 file.\r
-  @retval EFI_VOLUME_FULL            The volume is full.\r
+  @retval EFI_VOLUME_FULL       The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellCreateDirectory(\r
   IN CONST CHAR16             *DirectoryName,\r
-  OUT EFI_FILE_HANDLE         *FileHandle\r
+  OUT SHELL_FILE_HANDLE       *FileHandle\r
   );\r
 \r
 /**\r
@@ -198,22 +205,22 @@ ShellCreateDirectory(
   EFI_FILE_INFO is the structure returned as the directory entry.\r
 \r
   @param[in] FileHandle         The opened file handle.\r
-  @param[in] ReadSize           On input the size of buffer in bytes.  On return\r
+  @param[in,out] ReadSize       On input the size of buffer in bytes.  On return\r
                                 the number of bytes written.\r
   @param[out] Buffer            The buffer to put read data into.\r
 \r
-  @retval EFI_SUCCESS            Data was read.\r
+  @retval EFI_SUCCESS           Data was read.\r
   @retval EFI_NO_MEDIA         The device has no media.\r
-  @retval EFI_DEVICE_ERROR         The device reported an error.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_BUFFER_TO_SMALL    Buffer is too small. ReadSize contains required\r
+  @retval EFI_BUFFER_TO_SMALL   Buffer is too small. ReadSize contains required\r
                                 size.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellReadFile(\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
+  IN SHELL_FILE_HANDLE          FileHandle,\r
   IN OUT UINTN                  *ReadSize,\r
   OUT VOID                      *Buffer\r
   );\r
@@ -230,24 +237,24 @@ ShellReadFile(
 \r
   @param[in] FileHandle         The opened file for writing.\r
 \r
-  @param[in] BufferSize         On input the number of bytes in Buffer.  On output\r
+  @param[in,out] BufferSize     On input the number of bytes in Buffer.  On output\r
                                 the number of bytes written.\r
 \r
   @param[in] Buffer             The buffer containing data to write is stored.\r
 \r
-  @retval EFI_SUCCESS            Data was written.\r
-  @retval EFI_UNSUPPORTED            Writes to an open directory are not supported.\r
+  @retval EFI_SUCCESS           Data was written.\r
+  @retval EFI_UNSUPPORTED       Writes to an open directory are not supported.\r
   @retval EFI_NO_MEDIA         The device has no media.\r
-  @retval EFI_DEVICE_ERROR         The device reported an error.\r
-  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED    The device is write-protected.\r
-  @retval EFI_ACCESS_DENIED        The file was open for read only.\r
-  @retval EFI_VOLUME_FULL            The volume is full.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
+  @retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
+  @retval EFI_WRITE_PROTECTED   The device is write-protected.\r
+  @retval EFI_ACCESS_DENIED     The file was open for read only.\r
+  @retval EFI_VOLUME_FULL       The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellWriteFile(\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
+  IN SHELL_FILE_HANDLE          FileHandle,\r
   IN OUT UINTN                  *BufferSize,\r
   IN VOID                       *Buffer\r
   );\r
@@ -262,12 +269,12 @@ ShellWriteFile(
   @param[in] FileHandle           The file handle to close.\r
 \r
   @retval EFI_SUCCESS             The file handle was closed sucessfully.\r
-  @retval INVALID_PARAMETER            One of the parameters has an invalid value.\r
+  @retval INVALID_PARAMETER       One of the parameters has an invalid value.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellCloseFile (\r
-  IN EFI_FILE_HANDLE            *FileHandle\r
+  IN SHELL_FILE_HANDLE          *FileHandle\r
   );\r
 \r
 /**\r
@@ -287,7 +294,7 @@ ShellCloseFile (
 EFI_STATUS\r
 EFIAPI\r
 ShellDeleteFile (\r
-  IN EFI_FILE_HANDLE           *FileHandle\r
+  IN SHELL_FILE_HANDLE          *FileHandle\r
   );\r
 \r
 /**\r
@@ -295,15 +302,15 @@ ShellDeleteFile (
 \r
   This function sets the current file position for the handle to the position\r
   supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only\r
-  absolute positioning is supported, and seeking past the end of the file is\r
-  allowed (a subsequent write would grow the file). Seeking to position\r
+  absolute positioning is supported, and moving past the end of the file is\r
+  allowed (a subsequent write would grow the file). Moving to position\r
   0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.\r
   If FileHandle is a directory, the only position that may be set is zero. This\r
   has the effect of starting the read process of the directory entries over.\r
 \r
   @param[in] FileHandle         The file handle on which the position is being set.\r
 \r
-  @param[in] Position           Byte position from begining of file.\r
+  @param[in] Position           The byte position from the begining of the file.\r
 \r
   @retval EFI_SUCCESS           Operation completed sucessfully.\r
   @retval EFI_UNSUPPORTED       The seek request for non-zero is not valid on\r
@@ -313,7 +320,7 @@ ShellDeleteFile (
 EFI_STATUS\r
 EFIAPI\r
 ShellSetFilePosition (\r
-  IN EFI_FILE_HANDLE           FileHandle,\r
+  IN SHELL_FILE_HANDLE         FileHandle,\r
   IN UINT64            Position\r
   );\r
 \r
@@ -326,7 +333,7 @@ ShellSetFilePosition (
   if FileHandle is a directory.\r
 \r
   @param[in] FileHandle         The open file handle on which to get the position.\r
-  @param[out] Position          Byte position from begining of file.\r
+  @param[out] Position          The byte position from the begining of the file.\r
 \r
   @retval EFI_SUCCESS           The operation completed sucessfully.\r
   @retval INVALID_PARAMETER     One of the parameters has an invalid value.\r
@@ -335,7 +342,7 @@ ShellSetFilePosition (
 EFI_STATUS\r
 EFIAPI\r
 ShellGetFilePosition (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
+  IN SHELL_FILE_HANDLE          FileHandle,\r
   OUT UINT64                    *Position\r
   );\r
 \r
@@ -356,7 +363,7 @@ ShellGetFilePosition (
 EFI_STATUS\r
 EFIAPI\r
 ShellFlushFile (\r
-  IN EFI_FILE_HANDLE            FileHandle\r
+  IN SHELL_FILE_HANDLE          FileHandle\r
   );\r
 \r
 /**\r
@@ -368,20 +375,20 @@ ShellFlushFile (
 \r
   Caller must use FreePool on *Buffer opon completion of all file searching.\r
 \r
-  @param[in] DirHandle          The file handle of the directory to search\r
-  @param[out] Buffer            Pointer to pointer to buffer for file's information\r
+  @param[in] DirHandle          The file handle of the directory to search.\r
+  @param[out] Buffer            The pointer to the buffer for the file's information.\r
 \r
   @retval EFI_SUCCESS           Found the first file.\r
   @retval EFI_NOT_FOUND         Cannot find the directory.\r
   @retval EFI_NO_MEDIA          The device has no media.\r
   @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
-  @return ShellReadFile\r
+  @sa ShellReadFile\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellFindFirstFile (\r
-  IN EFI_FILE_HANDLE            DirHandle,\r
+  IN SHELL_FILE_HANDLE          DirHandle,\r
   OUT EFI_FILE_INFO             **Buffer\r
   );\r
 \r
@@ -392,24 +399,25 @@ ShellFindFirstFile (
   first file, and then use this function get other files. This function can be\r
   called for several times to get each file's information in the directory. If\r
   the call of ShellFindNextFile() got the last file in the directory, the next\r
-  call of this function has no file to get. *NoFile will be set to TRUE and the\r
+  call of this function has no file to get. *NoFile will be set to TRUE, and the\r
   data in Buffer is meaningless.\r
 \r
   @param[in] DirHandle          The file handle of the directory.\r
-  @param[out] Buffer                         Pointer to buffer for file's information.\r
-  @param[out] NoFile                         Pointer to boolean when last file is found.\r
+  @param[in,out] Buffer         The pointer to buffer for file's information.\r
+  @param[in,out] NoFile         The pointer to boolean when last file is found.\r
 \r
   @retval EFI_SUCCESS           Found the next file.\r
   @retval EFI_NO_MEDIA          The device has no media.\r
   @retval EFI_DEVICE_ERROR      The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
+  @sa ShellReadFile\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ShellFindNextFile(\r
-  IN EFI_FILE_HANDLE             DirHandle,\r
-  OUT EFI_FILE_INFO              *Buffer,\r
-  OUT BOOLEAN                    *NoFile\r
+  IN SHELL_FILE_HANDLE           DirHandle,\r
+  IN OUT EFI_FILE_INFO           *Buffer,\r
+  IN OUT BOOLEAN                 *NoFile\r
   );\r
 \r
 /**\r
@@ -419,7 +427,7 @@ ShellFindNextFile(
   data.\r
 \r
   @param[in] FileHandle         The file handle from which size is retrieved.\r
-  @param[out] Size              Pointer to size.\r
+  @param[out] Size              The pointer to size.\r
 \r
   @retval EFI_SUCCESS           The operation was completed sucessfully.\r
   @retval EFI_DEVICE_ERROR      Cannot access the file.\r
@@ -427,7 +435,7 @@ ShellFindNextFile(
 EFI_STATUS\r
 EFIAPI\r
 ShellGetFileSize (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
+  IN SHELL_FILE_HANDLE          FileHandle,\r
   OUT UINT64                    *Size\r
   );\r
 \r
@@ -436,8 +444,8 @@ ShellGetFileSize (
 \r
   This function is useful to check whether the application is being asked to halt by the shell.\r
 \r
-  @retval TRUE                  the execution break is enabled\r
-  @retval FALSE                 the execution break is not enabled\r
+  @retval TRUE                  The execution break is enabled.\r
+  @retval FALSE                 The execution break is not enabled.\r
 **/\r
 BOOLEAN\r
 EFIAPI\r
@@ -454,7 +462,7 @@ ShellGetExecutionBreakFlag(
   @param[in] EnvKey             The key name of the environment variable.\r
 \r
   @retval NULL                  The named environment variable does not exist.\r
-  @return != NULL               pointer to the value of the environment variable.\r
+  @return != NULL               The pointer to the value of the environment variable.\r
 **/\r
 CONST CHAR16*\r
 EFIAPI\r
@@ -479,8 +487,8 @@ ShellGetEnvironmentVariable (
   @param[in] EnvVal             The Value of the environment variable\r
   @param[in] Volatile           Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r
 \r
-  @retval EFI_SUCCESS           the operation was completed sucessfully\r
-  @retval EFI_UNSUPPORTED       This operation is not allowed in pre UEFI 2.0 Shell environments\r
+  @retval EFI_SUCCESS           The operation completed sucessfully\r
+  @retval EFI_UNSUPPORTED       This operation is not allowed in pre-UEFI 2.0 Shell environments.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -507,11 +515,11 @@ ShellSetEnvironmentVariable (
   ShellExecute() function.  The Output parameter has no effect in a\r
   UEFI Shell 2.0 environment.\r
 \r
-  @param[in] ImageHandle          Parent image that is starting the operation.\r
-  @param[in] CommandLine          Pointer to NULL terminated command line.\r
+  @param[in] ParentHandle         The parent image starting the operation.\r
+  @param[in] CommandLine          The pointer to a NULL terminated command line.\r
   @param[in] Output               True to display debug output.  False to hide it.\r
   @param[in] EnvironmentVariables Optional pointer to array of environment variables\r
-                                  in the form "x=y".  If NULL current set is used.\r
+                                  in the form "x=y".  If NULL, the current set is used.\r
   @param[out] Status              The status of the run command line.\r
 \r
   @retval EFI_SUCCESS             The operation completed sucessfully.  Status\r
@@ -545,7 +553,7 @@ ShellExecute (
 CONST CHAR16*\r
 EFIAPI\r
 ShellGetCurrentDir (\r
-  IN CHAR16                     *DeviceName OPTIONAL\r
+  IN CHAR16                     * CONST DeviceName OPTIONAL\r
   );\r
 \r
 /**\r
@@ -575,9 +583,9 @@ ShellSetPageBreakMode (
   If you are NOT appending to an existing list *ListHead must be NULL.  If\r
   *ListHead is NULL then it must be callee freed.\r
 \r
-  @param[in] Arg                Pointer to path string.\r
+  @param[in] Arg                The pointer to path string.\r
   @param[in] OpenMode           Mode to open files with.\r
-  @param[in] ListHead           Head of linked list of results.\r
+  @param[in,out] ListHead       Head of linked list of results.\r
 \r
   @retval EFI_SUCCESS           The operation was sucessful and the list head\r
                                 contains the list of opened files.\r
@@ -596,7 +604,7 @@ ShellOpenFileMetaArg (
 /**\r
   Free the linked list returned from ShellOpenFileMetaArg.\r
 \r
-  @param[in] ListHead           The pointer to free.\r
+  @param[in,out] ListHead       The pointer to free.\r
 \r
   @retval EFI_SUCCESS           The operation was sucessful.\r
   @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
@@ -631,12 +639,12 @@ ShellFindFilePath (
   in the order provided and return the first one that is successful.\r
 \r
   If FileName is NULL, then ASSERT.\r
-  If FileExtension is NULL, then behavior is identical to ShellFindFilePath.\r
+  If FileExtension is NULL, then the behavior is identical to ShellFindFilePath.\r
 \r
   If the return value is not NULL then the memory must be caller freed.\r
 \r
-  @param[in] FileName           Filename string.\r
-  @param[in] FileExtension      Semi-colon delimeted list of possible extensions.\r
+  @param[in] FileName           The filename string.\r
+  @param[in] FileExtension      Semicolon delimited list of possible extensions.\r
 \r
   @retval NULL                  The file was not found.\r
   @retval !NULL                 The path to the file.\r
@@ -656,25 +664,28 @@ typedef enum {
   TypeDoubleValue,  ///< A flag that has 2 space seperated value data following it (IE "-a 1 2").\r
   TypeMaxValue,     ///< A flag followed by all the command line data before the next flag.\r
   TypeMax,\r
-} ParamType;\r
+} SHELL_PARAM_TYPE;\r
 \r
 typedef struct {\r
-  CHAR16      *Name;\r
-  ParamType   Type;\r
+  CHAR16             *Name;\r
+  SHELL_PARAM_TYPE   Type;\r
 } SHELL_PARAM_ITEM;\r
 \r
 \r
 /// Helper structure for no parameters (besides -? and -b)\r
 extern SHELL_PARAM_ITEM EmptyParamList[];\r
 \r
+/// Helper structure for -sfo only (besides -? and -b)\r
+extern SHELL_PARAM_ITEM SfoParamList[];\r
+\r
 /**\r
   Checks the command line arguments passed against the list of valid ones.\r
   Optionally removes NULL values first.\r
 \r
   If no initialization is required, then return RETURN_SUCCESS.\r
 \r
-  @param[in] CheckList          Pointer to list of parameters to check.\r
-  @param[out] CheckPackage      Package of checked values.\r
+  @param[in] CheckList          The pointer to list of parameters to check.\r
+  @param[out] CheckPackage      The package of checked values.\r
   @param[out] ProblemParam      Optional pointer to pointer to unicode string for\r
                                 the paramater that caused failure.\r
   @param[in] AutoPageBreak      Will automatically set PageBreakEnabled.\r
@@ -683,9 +694,7 @@ extern SHELL_PARAM_ITEM EmptyParamList[];
   @retval EFI_SUCCESS           The operation completed sucessfully.\r
   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
   @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
-  @retval EFI_VOLUME_CORRUPTED  The command line was corrupt.  An argument was\r
-                                duplicated.  The duplicated command line argument\r
-                                was returned in ProblemParam if provided.\r
+  @retval EFI_VOLUME_CORRUPTED  The command line was corrupt.\r
   @retval EFI_DEVICE_ERROR      The commands contained 2 opposing arguments.  One\r
                                 of the command line arguments was returned in\r
                                 ProblemParam if provided.\r
@@ -735,12 +744,12 @@ ShellCommandLineFreeVarList (
 \r
   @retval TRUE                  The flag is on the command line.\r
   @retval FALSE                 The flag is not on the command line.\r
-  **/\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 ShellCommandLineGetFlag (\r
-  IN CONST LIST_ENTRY              *CheckPackage,\r
-  IN CHAR16                        *KeyString\r
+  IN CONST LIST_ENTRY         * CONST CheckPackage,\r
+  IN CONST CHAR16             * CONST KeyString\r
   );\r
 \r
 /**\r
@@ -754,8 +763,8 @@ ShellCommandLineGetFlag (
   @param[in] KeyString          The Key of the command line argument to check for.\r
 \r
   @retval NULL                  The flag is not on the command line.\r
-  @retval !=NULL                Pointer to unicode string of the value.\r
-  **/\r
+  @retval !=NULL                The pointer to unicode string of the value.\r
+**/\r
 CONST CHAR16*\r
 EFIAPI\r
 ShellCommandLineGetValue (\r
@@ -774,13 +783,13 @@ ShellCommandLineGetValue (
   @param[in] Position           The position of the value.\r
 \r
   @retval NULL                  The flag is not on the command line.\r
-  @retval !=NULL                Pointer to unicode string of the value.\r
-  **/\r
+  @retval !=NULL                The pointer to unicode string of the value.\r
+**/\r
 CONST CHAR16*\r
 EFIAPI\r
 ShellCommandLineGetRawValue (\r
-  IN CONST LIST_ENTRY              *CheckPackage,\r
-  IN UINT32                        Position\r
+  IN CONST LIST_ENTRY              * CONST CheckPackage,\r
+  IN UINT                        Position\r
   );\r
 \r
 /**\r
@@ -788,20 +797,22 @@ ShellCommandLineGetRawValue (
 \r
   This will not include flags.\r
 \r
-  @retval (UINTN)-1     No parsing has ocurred.\r
-  @return               The number of value parameters found.\r
+  @param[in] CheckPackage       The package of parsed command line arguments.\r
+\r
+  @retval (UINTN)-1             No parsing has occurred.\r
+  @retval other                 The number of value parameters found.\r
 **/\r
 UINTN\r
 EFIAPI\r
 ShellCommandLineGetCount(\r
-  VOID\r
+  IN CONST LIST_ENTRY              *CheckPackage\r
   );\r
 \r
 /**\r
-  Determins if a parameter is duplicated.\r
+  Determines if a parameter is duplicated.\r
 \r
-  If Param is not NULL then it will point to a callee allocated string buffer\r
-  with the parameter value if a duplicate is found.\r
+  If Param is not NULL, then it will point to a callee-allocated string buffer\r
+  with the parameter value, if a duplicate is found.\r
 \r
   If CheckPackage is NULL, then ASSERT.\r
 \r
@@ -820,7 +831,7 @@ ShellCommandLineCheckDuplicate (
 \r
 /**\r
   This function causes the shell library to initialize itself.  If the shell library\r
-  is already initialized it will de-initialize all the current protocol poitners and\r
+  is already initialized it will de-initialize all the current protocol pointers and\r
   re-populate them again.\r
 \r
   When the library is used with PcdShellLibAutoInitialize set to true this function\r
@@ -828,7 +839,7 @@ ShellCommandLineCheckDuplicate (
 \r
   This function is intended for internal access for shell commands only.\r
 \r
-  @retval EFI_SUCCESS   the initialization was complete sucessfully\r
+  @retval EFI_SUCCESS   The initialization was complete sucessfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -858,14 +869,15 @@ ShellInitialize (
 \r
   Note: The background color is controlled by the shell command cls.\r
 \r
-  @param[in] Row        The row to print at.\r
   @param[in] Col        The column to print at.\r
+  @param[in] Row        The row to print at.\r
   @param[in] Format     The format string.\r
+  @param[in] ...        The variable argument list.\r
 \r
-  @return The number of characters printed to the screen.\r
+  @return EFI_SUCCESS           The printing was successful.\r
+  @return EFI_DEVICE_ERROR      The console device reported an error.\r
 **/\r
-\r
-UINTN\r
+EFI_STATUS\r
 EFIAPI\r
 ShellPrintEx(\r
   IN INT32                Col OPTIONAL,\r
@@ -895,16 +907,18 @@ ShellPrintEx(
 \r
   Note: The background color is controlled by the shell command cls.\r
 \r
-  @param[in] Row                The row to print at.\r
   @param[in] Col                The column to print at.\r
+  @param[in] Row                The row to print at.\r
   @param[in] Language           The language of the string to retrieve.  If this parameter\r
                                 is NULL, then the current platform language is used.\r
   @param[in] HiiFormatStringId  The format string Id for getting from Hii.\r
   @param[in] HiiFormatHandle    The format string Handle for getting from Hii.\r
+  @param[in] ...                The variable argument list.\r
 \r
-  @return the number of characters printed to the screen.\r
+  @return EFI_SUCCESS           The printing was successful.\r
+  @return EFI_DEVICE_ERROR      The console device reported an error.\r
 **/\r
-UINTN\r
+EFI_STATUS\r
 EFIAPI\r
 ShellPrintHiiEx(\r
   IN INT32                Col OPTIONAL,\r
@@ -999,7 +1013,7 @@ ShellStrToUintn(
   given in CurrentSize the string will be grown such that the copy can be performed\r
   and CurrentSize will be updated to the new size.\r
 \r
-  If Source is NULL, there is nothing to append, just return the current buffer in\r
+  If Source is NULL, there is nothing to append, so return the current buffer in\r
   Destination.\r
 \r
   If Destination is NULL, then ASSERT().\r
@@ -1007,14 +1021,14 @@ ShellStrToUintn(
   CurrentSize, then ASSERT().\r
 \r
   @param[in,out] Destination    The String to append onto.\r
-  @param[in,out] CurrentSize    On call the number of bytes in Destination.  On\r
-                                return possibly the new size (still in bytes).  If NULL\r
+  @param[in,out] CurrentSize    On call, the number of bytes in Destination.  On\r
+                                return, possibly the new size (still in bytes).  If NULL,\r
                                 then allocate whatever is needed.\r
   @param[in]     Source         The String to append from.\r
-  @param[in]     Count          Maximum number of characters to append.  If 0 then\r
+  @param[in]     Count          The maximum number of characters to append.  If 0, then\r
                                 all are appended.\r
 \r
-  @return                       The Destination after apending the Source.\r
+  @return                       The Destination after appending the Source.\r
 **/\r
 CHAR16*\r
 EFIAPI\r
@@ -1033,13 +1047,14 @@ StrnCatGrow (
 \r
   If the string would grow bigger than NewSize it will halt and return error.\r
 \r
-  @param[in] SourceString             String with source buffer.\r
-  @param[in,out] NewString            String with resultant buffer.\r
-  @param[in] NewSize                  Size in bytes of NewString.\r
-  @param[in] FindTarget               String to look for.\r
-  @param[in] ReplaceWith              String to replace FindTarget with.\r
+  @param[in] SourceString             The string with source buffer.\r
+  @param[in,out] NewString            The string with resultant buffer.\r
+  @param[in] NewSize                  The size in bytes of NewString.\r
+  @param[in] FindTarget               The string to look for.\r
+  @param[in] ReplaceWith              The string to replace FindTarget with.\r
   @param[in] SkipPreCarrot            If TRUE will skip a FindTarget that has a '^'\r
                                       immediately before it.\r
+  @param[in] ParameterReplacing       If TRUE will add "" around items with spaces.\r
 \r
   @retval EFI_INVALID_PARAMETER       SourceString was NULL.\r
   @retval EFI_INVALID_PARAMETER       NewString was NULL.\r
@@ -1049,36 +1064,32 @@ StrnCatGrow (
   @retval EFI_INVALID_PARAMETER       SourceString had length < 1.\r
   @retval EFI_BUFFER_TOO_SMALL        NewSize was less than the minimum size to hold\r
                                       the new string (truncation occurred).\r
-  @retval EFI_SUCCESS                 The string was sucessfully copied with replacement.\r
+  @retval EFI_SUCCESS                 The string was successfully copied with replacement.\r
 **/\r
-\r
 EFI_STATUS\r
 EFIAPI\r
-ShellCopySearchAndReplace2(\r
+ShellCopySearchAndReplace(\r
   IN CHAR16 CONST                     *SourceString,\r
-  IN CHAR16                           *NewString,\r
+  IN OUT CHAR16                       *NewString,\r
   IN UINTN                            NewSize,\r
   IN CONST CHAR16                     *FindTarget,\r
   IN CONST CHAR16                     *ReplaceWith,\r
-  IN CONST BOOLEAN                    SkipPreCarrot\r
+  IN CONST BOOLEAN                    SkipPreCarrot,\r
+  IN CONST BOOLEAN                    ParameterReplacing\r
   );\r
 \r
-///\r
-/// make upgrades easier from old version\r
-///\r
-#define ShellLibCopySearchAndReplace(a,b,c,d,e) ShellCopySearchAndReplace2(a,b,c,d,e,FALSE)\r
-\r
 /**\r
   Check if a Unicode character is a hexadecimal character.\r
 \r
   This internal function checks if a Unicode character is a\r
-  decimal character.  The valid hexadecimal character is\r
+  numeric character.  The valid hexadecimal characters are\r
   L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
 \r
-  @param[in]  Char  The character to check.\r
 \r
-  @retval TRUE      The Char is a hexadecmial character.\r
-  @retval FALSE     The Char is not a hexadecmial character.\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  The Char is a hexadecmial character.\r
+  @retval FALSE The Char is not a hexadecmial character.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1087,31 +1098,51 @@ ShellIsHexaDecimalDigitCharacter (
   IN      CHAR16                    Char\r
   );\r
 \r
+/**\r
+  Check if a Unicode character is a decimal character.\r
+\r
+  This internal function checks if a Unicode character is a\r
+  decimal character.  The valid characters are\r
+  L'0' to L'9'.\r
+\r
+\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  The Char is a hexadecmial character.\r
+  @retval FALSE The Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsDecimalDigitCharacter (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
 ///\r
-/// What type of answer is requested\r
+/// What type of answer is requested.\r
 ///\r
 typedef enum {\r
-  SHELL_PROMPT_REQUEST_TYPE_YES_NO,\r
-  SHELL_PROMPT_REQUEST_TYPE_YES_NO_CANCEL,\r
-  SHELL_PROMPT_REQUEST_TYPE_FREEFORM,\r
-  SHELL_PROMPT_REQUEST_TYPE_QUIT_CONTINUE,\r
-  SHELL_PROMPT_REQUEST_TYPE_YES_NO_ALL_CANCEL,\r
-  SHELL_PROMPT_REQUEST_TYPE_ENTER_TO_COMTINUE,\r
-  SHELL_PROMPT_REQUEST_TYPE_ANYKEY_TO_COMTINUE,\r
-  SHELL_PROMPT_REQUEST_TYPE_MAX\r
+  ShellPromptResponseTypeYesNo,\r
+  ShellPromptResponseTypeYesNoCancel,\r
+  ShellPromptResponseTypeFreeform,\r
+  ShellPromptResponseTypeQuitContinue,\r
+  ShellPromptResponseTypeYesNoAllCancel,\r
+  ShellPromptResponseTypeEnterContinue,\r
+  ShellPromptResponseTypeAnyKeyContinue,\r
+  ShellPromptResponseTypeMax\r
 } SHELL_PROMPT_REQUEST_TYPE;\r
 \r
 ///\r
-/// what answer was given\r
+/// What answer was given.\r
 ///\r
 typedef enum {\r
-  SHELL_PROMPT_RESPONSE_YES,\r
-  SHELL_PROMPT_RESPONSE_NO,\r
-  SHELL_PROMPT_RESPONSE_CANCEL,\r
-  SHELL_PROMPT_RESPONSE_QUIT,\r
-  SHELL_PROMPT_RESPONSE_CONTINUE,\r
-  SHELL_PROMPT_RESPONSE_ALL,\r
-  SHELL_PROMPT_RESPONSE_MAX\r
+  ShellPromptResponseYes,\r
+  ShellPromptResponseNo,\r
+  ShellPromptResponseCancel,\r
+  ShellPromptResponseQuit,\r
+  ShellPromptResponseContinue,\r
+  ShellPromptResponseAll,\r
+  ShellPromptResponseMax\r
 } SHELL_PROMPT_RESPONSE;\r
 \r
 /**\r
@@ -1120,23 +1151,22 @@ typedef enum {
   This function will display the requested question on the shell prompt and then\r
   wait for an apropriate answer to be input from the console.\r
 \r
-  if the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, SHELL_PROMPT_REQUEST_TYPE_QUIT_CONTINUE\r
+  If the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, ShellPromptResponseTypeQuitContinue\r
   or SHELL_PROMPT_REQUEST_TYPE_YESNOCANCEL then *Response is of type SHELL_PROMPT_RESPONSE.\r
 \r
-  if the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_FREEFORM then *Response is of type\r
+  If the SHELL_PROMPT_REQUEST_TYPE is ShellPromptResponseTypeFreeform then *Response is of type\r
   CHAR16*.\r
 \r
   In either case *Response must be callee freed if Response was not NULL;\r
 \r
   @param Type                     What type of question is asked.  This is used to filter the input\r
                                   to prevent invalid answers to question.\r
-  @param Prompt                   Pointer to string prompt to use to request input.\r
-  @param Response                 Pointer to Response which will be populated upon return.\r
+  @param Prompt                   The pointer to a string prompt used to request input.\r
+  @param Response                 The pointer to Response, which will be populated upon return.\r
 \r
-  @retval EFI_SUCCESS             The operation was sucessful.\r
+  @retval EFI_SUCCESS             The operation was successful.\r
   @retval EFI_UNSUPPORTED         The operation is not supported as requested.\r
   @retval EFI_INVALID_PARAMETER   A parameter was invalid.\r
-  @retval EFI_OUT_OF_RESOURCES    A memory allocation failed.\r
   @return other                   The operation failed.\r
 **/\r
 EFI_STATUS\r
@@ -1155,11 +1185,12 @@ ShellPromptForResponse (
 \r
   @param Type     What type of question is asked.  This is used to filter the input\r
                   to prevent invalid answers to question.\r
-  @param Prompt   Pointer to string prompt to use to request input.\r
-  @param Response Pointer to Response which will be populated upon return.\r
+  @param[in] HiiFormatStringId  The format string Id for getting from Hii.\r
+  @param[in] HiiFormatHandle    The format string Handle for getting from Hii.\r
+  @param Response               The pointer to Response, which will be populated upon return.\r
 \r
-  @retval EFI_SUCCESS the operation was sucessful.\r
-  @return other       the operation failed.\r
+  @retval EFI_SUCCESS The operation was sucessful.\r
+  @return other       The operation failed.\r
 \r
   @sa ShellPromptForResponse\r
 **/\r
@@ -1172,5 +1203,39 @@ ShellPromptForResponseHii (
   IN OUT VOID             **Response\r
   );\r
 \r
+/**\r
+  Function to determin if an entire string is a valid number.\r
+\r
+  If Hex it must be preceeded with a 0x or has ForceHex, set TRUE.\r
+\r
+  @param[in] String       The string to evaluate.\r
+  @param[in] ForceHex     TRUE - always assume hex.\r
+  @param[in] StopAtSpace  TRUE to halt upon finding a space, FALSE to keep going.\r
+\r
+  @retval TRUE        It is all numeric (dec/hex) characters.\r
+  @retval FALSE       There is a non-numeric character.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsHexOrDecimalNumber (\r
+  IN CONST CHAR16   *String,\r
+  IN CONST BOOLEAN  ForceHex,\r
+  IN CONST BOOLEAN  StopAtSpace\r
+  );\r
+\r
+/**\r
+  Function to determine if a given filename exists.\r
+\r
+  @param[in] Name         Path to test.\r
+\r
+  @retval EFI_SUCCESS     The Path represents a file.\r
+  @retval EFI_NOT_FOUND   The Path does not represent a file.\r
+  @retval other           The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellFileExists(\r
+  IN CONST CHAR16 *Name\r
+  );\r
 \r
 #endif // __SHELL_LIB__\r