summaryrefslogtreecommitdiff
path: root/ShellPkg/Include
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-09-14 05:18:09 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-09-14 05:18:09 +0000
commita405b86d274d32b92f69842bfb9a1ab143128f57 (patch)
treeb6fb97d9a65152d2b6527d6cd226a5b48c675dd8 /ShellPkg/Include
parent52fb4d3d133883c6e0e8b8ee8a7af590a920f5eb (diff)
downloadedk2-platforms-a405b86d274d32b92f69842bfb9a1ab143128f57.tar.xz
udk2010.up2.shell initial release.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10874 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Include')
-rw-r--r--ShellPkg/Include/Guid/ShellAliasGuid.h25
-rw-r--r--ShellPkg/Include/Guid/ShellEnvironment2Ext.h6
-rw-r--r--ShellPkg/Include/Guid/ShellMapGuid.h25
-rw-r--r--ShellPkg/Include/Guid/ShellVariableGuid.h25
-rw-r--r--ShellPkg/Include/Library/FileHandleLib.h226
-rw-r--r--ShellPkg/Include/Library/HandleParsingLib.h342
-rw-r--r--ShellPkg/Include/Library/ShellCEntryLib.h6
-rw-r--r--ShellPkg/Include/Library/ShellCommandLib.h757
-rw-r--r--ShellPkg/Include/Library/ShellLib.h433
-rw-r--r--ShellPkg/Include/Library/SortLib.h53
-rw-r--r--ShellPkg/Include/Protocol/EfiShell.h76
-rw-r--r--ShellPkg/Include/Protocol/EfiShellEnvironment2.h256
-rw-r--r--ShellPkg/Include/Protocol/EfiShellInterface.h32
-rw-r--r--ShellPkg/Include/Protocol/EfiShellParameters.h14
-rw-r--r--ShellPkg/Include/ShellBase.h17
15 files changed, 1795 insertions, 498 deletions
diff --git a/ShellPkg/Include/Guid/ShellAliasGuid.h b/ShellPkg/Include/Guid/ShellAliasGuid.h
new file mode 100644
index 0000000000..200e358688
--- /dev/null
+++ b/ShellPkg/Include/Guid/ShellAliasGuid.h
@@ -0,0 +1,25 @@
+/** @file
+ GUID for Shell Variable for Get/Set via runtime services.
+
+ Copyright (c) 2009 - 2010, 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 _SHELL_ALIAS_VARIABLE_GUID_H_
+#define _SHELL_ALIAS_VARIABLE_GUID_H_
+
+#define SHELL_ALIAS_VARIABLE_GUID \
+{ \
+ 0x0053d9d6, 0x2659, 0x4599, { 0xa2, 0x6b, 0xef, 0x45, 0x36, 0xe6, 0x31, 0xa9 } \
+}
+
+extern EFI_GUID gShellAliasGuid;
+
+#endif \ No newline at end of file
diff --git a/ShellPkg/Include/Guid/ShellEnvironment2Ext.h b/ShellPkg/Include/Guid/ShellEnvironment2Ext.h
index da237479ea..a18d16c0e9 100644
--- a/ShellPkg/Include/Guid/ShellEnvironment2Ext.h
+++ b/ShellPkg/Include/Guid/ShellEnvironment2Ext.h
@@ -1,5 +1,5 @@
/** @file
- GUID for EFI shell Environment2 Extension
+ GUID for EFI shell Environment2 Extension.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
@@ -12,8 +12,8 @@
**/
-#ifndef _SHELLPKG_SHELL_ENV2_EXT_GUID_H
-#define _SHELLPKG_SHELL_ENV2_EXT_GUID_H
+#ifndef _SHELLPKG_SHELL_ENV2_EXT_GUID_H_
+#define _SHELLPKG_SHELL_ENV2_EXT_GUID_H_
#define SHELLPKG_SHELL_ENV2_EXT_GUID \
{ \
diff --git a/ShellPkg/Include/Guid/ShellMapGuid.h b/ShellPkg/Include/Guid/ShellMapGuid.h
new file mode 100644
index 0000000000..180a41bf53
--- /dev/null
+++ b/ShellPkg/Include/Guid/ShellMapGuid.h
@@ -0,0 +1,25 @@
+/** @file
+ GUID for Shell Map for Get/Set via runtime services.
+
+ Copyright (c) 2009 - 2010, 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 _SHELL_MAP_GUID_H_
+#define _SHELL_MAP_GUID_H_
+
+#define SHELL_MAP_GUID \
+{ \
+ 0x51271e13, 0x7de3, 0x43af, { 0x8b, 0xc2, 0x71, 0xad, 0x3b, 0x82, 0x43, 0x25 } \
+}
+
+extern EFI_GUID gShellMapGuid;
+
+#endif \ No newline at end of file
diff --git a/ShellPkg/Include/Guid/ShellVariableGuid.h b/ShellPkg/Include/Guid/ShellVariableGuid.h
new file mode 100644
index 0000000000..b93c94774b
--- /dev/null
+++ b/ShellPkg/Include/Guid/ShellVariableGuid.h
@@ -0,0 +1,25 @@
+/** @file
+ GUID for Shell Variable for Get/Set via runtime services.
+
+ Copyright (c) 2009 - 2010, 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 _SHELL_VARIABLE_GUID_H_
+#define _SHELL_VARIABLE_GUID_H_
+
+#define SHELL_VARIABLE_GUID \
+{ \
+ 0x158def5a, 0xf656, 0x419c, { 0xb0, 0x27, 0x7a, 0x31, 0x92, 0xc0, 0x79, 0xd2 } \
+}
+
+extern EFI_GUID gShellVariableGuid;
+
+#endif \ No newline at end of file
diff --git a/ShellPkg/Include/Library/FileHandleLib.h b/ShellPkg/Include/Library/FileHandleLib.h
index c0cde036f9..1c191ad64a 100644
--- a/ShellPkg/Include/Library/FileHandleLib.h
+++ b/ShellPkg/Include/Library/FileHandleLib.h
@@ -12,28 +12,29 @@
**/
-#if !defined (_FILE_HANDLE_LIBRARY_HEADER_)
+#ifndef _FILE_HANDLE_LIBRARY_HEADER_
#define _FILE_HANDLE_LIBRARY_HEADER_
-/// Tag for use in identifying UNICODE files.
-/// If the file is UNICODE the first 16 bits of the file will equal this value.
+#include <Protocol/SimpleFileSystem.h>
+
+/// The tag for use in identifying UNICODE files.
+/// If the file is UNICODE, the first 16 bits of the file will equal this value.
enum {
UnicodeFileTag = 0xFEFF
};
/**
- This function will retrieve the information about the file for the handle
- specified and store it in allocated pool memory.
+ This function retrieves information about the file for the handle
+ specified and stores it in the allocated pool memory.
This function allocates a buffer to store the file's information. It is the
caller's responsibility to free the buffer.
- @param FileHandle The file handle of the file for which information is
- being requested.
-
- @retval NULL information could not be retrieved.
+ @param[in] FileHandle The file handle of the file for which information is
+ being requested.
- @retval !NULL the information about the file
+ @retval NULL Information could not be retrieved.
+ @retval !NULL The information about the file.
**/
EFI_FILE_INFO*
EFIAPI
@@ -42,23 +43,23 @@ FileHandleGetInfo (
);
/**
- This function will set the information about the file for the opened handle
+ This function sets the information about the file for the opened handle
specified.
- @param FileHandle The file handle of the file for which information
+ @param[in] FileHandle The file handle of the file for which information
is being set.
- @param FileInfo The information to set.
+ @param[in] FileInfo The information to set.
@retval EFI_SUCCESS The information was set.
- @retval EFI_INVALID_PARAMETER A Parameter was out of range or invalid.
+ @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid.
@retval EFI_UNSUPPORTED The FileHandle does not support FileInfo.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
@@ -83,16 +84,16 @@ FileHandleSetInfo (
are no more directory entries, the read returns a zero-length buffer.
EFI_FILE_INFO is the structure returned as the directory entry.
- @param FileHandle The opened file handle.
- @param BufferSize On input the size of buffer in bytes. On return
+ @param[in] FileHandle The opened file handle.
+ @param[in,out] BufferSize On input, the size of buffer in bytes. On return,
the number of bytes written.
- @param Buffer The buffer to put read data into.
+ @param[out] Buffer The buffer to put read data into.
- @retval EFI_SUCCESS Data was read.
+ @retval EFI_SUCCESS Data was read.
@retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
+ @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
size.
**/
@@ -114,19 +115,19 @@ FileHandleRead(
The file is automatically grown to hold the data if required. Direct writes to
opened directories are not supported.
- @param FileHandle The opened file for writing
- @param BufferSize On input the number of bytes in Buffer. On output
+ @param[in] FileHandle The opened file for writing.
+ @param[in,out] BufferSize On input, the number of bytes in Buffer. On output,
the number of bytes written.
- @param Buffer The buffer containing data to write is stored.
+ @param[in] Buffer The buffer containing data to write is stored.
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
+ @retval EFI_SUCCESS Data was written.
+ @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
@retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write-protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_WRITE_PROTECTED The device is write-protected.
+ @retval EFI_ACCESS_DENIED The file was opened for read only.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
@@ -143,9 +144,9 @@ FileHandleWrite(
flushed to the device, and the file is closed. In all cases the handle is
closed.
- @param FileHandle The file handle to close.
+ @param[in] FileHandle The file handle to close.
- @retval EFI_SUCCESS The file handle was closed sucessfully.
+ @retval EFI_SUCCESS The file handle was closed successfully.
**/
EFI_STATUS
EFIAPI
@@ -160,11 +161,11 @@ FileHandleClose (
If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is
returned, but the handle is still closed.
- @param FileHandle The file handle to delete.
+ @param[in] FileHandle The file handle to delete.
- @retval EFI_SUCCESS The file was closed sucessfully.
- @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not
- deleted
+ @retval EFI_SUCCESS The file was closed successfully.
+ @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not
+ deleted.
@retval INVALID_PARAMETER One of the parameters has an invalid value.
**/
EFI_STATUS
@@ -177,18 +178,18 @@ FileHandleDelete (
Set the current position in a file.
This function sets the current file position for the handle to the position
- supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only
- absolute positioning is supported, and seeking past the end of the file is
- allowed (a subsequent write would grow the file). Seeking to position
+ supplied. With the exception of moving to position 0xFFFFFFFFFFFFFFFF, only
+ absolute positioning is supported, and moving past the end of the file is
+ allowed (a subsequent write would grow the file). Moving to position
0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.
If FileHandle is a directory, the only position that may be set is zero. This
- has the effect of starting the read process of the directory entries over.
+ has the effect of starting the read process of the directory entries over again.
- @param FileHandle The file handle on which the position is being set
- @param Position Byte position from begining of file
+ @param[in] FileHandle The file handle on which the position is being set.
+ @param[in] Position The byte position from the begining of the file.
- @retval EFI_SUCCESS Operation completed sucessfully.
- @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on
+ @retval EFI_SUCCESS The operation completed sucessfully.
+ @retval EFI_UNSUPPORTED The request for non-zero is not valid on
directories.
@retval INVALID_PARAMETER One of the parameters has an invalid value.
**/
@@ -204,15 +205,15 @@ FileHandleSetPosition (
This function retrieves the current file position for the file handle. For
directories, the current file position has no meaning outside of the file
- system driver and as such the operation is not supported. An error is returned
+ system driver. As such, the operation is not supported. An error is returned
if FileHandle is a directory.
- @param FileHandle The open file handle on which to get the position.
- @param Position Byte position from begining of file.
+ @param[in] FileHandle The open file handle on which to get the position.
+ @param[out] Position The byte position from begining of file.
- @retval EFI_SUCCESS the operation completed sucessfully.
+ @retval EFI_SUCCESS The operation completed successfully.
@retval INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED the request is not valid on directories.
+ @retval EFI_UNSUPPORTED The request is not valid on directories.
**/
EFI_STATUS
EFIAPI
@@ -225,7 +226,7 @@ FileHandleGetPosition (
This function flushes all modified data associated with a file to a device.
- @param FileHandle The file handle on which to flush data.
+ @param[in] FileHandle The file handle on which to flush data.
@retval EFI_SUCCESS The data was flushed.
@retval EFI_NO_MEDIA The device has no media.
@@ -243,16 +244,16 @@ FileHandleFlush (
/**
Function to determine if a given handle is a directory handle.
- If DirHandle is NULL then ASSERT().
+ If DirHandle is NULL, then ASSERT().
- Open the file information on the DirHandle and verify that the Attribute
+ Open the file information on the DirHandle, and verify that the Attribute
includes EFI_FILE_DIRECTORY bit set.
- @param DirHandle Handle to open file.
+ @param[in] DirHandle The handle to open the file.
- @retval EFI_SUCCESS DirHandle is a directory
- @retval EFI_INVALID_PARAMETER DirHandle did not have EFI_FILE_INFO available
- @retval EFI_NOT_FOUND DirHandle is not a directory
+ @retval EFI_SUCCESS DirHandle is a directory.
+ @retval EFI_INVALID_PARAMETER DirHandle did not have EFI_FILE_INFO available.
+ @retval EFI_NOT_FOUND DirHandle is not a directory.
**/
EFI_STATUS
EFIAPI
@@ -263,20 +264,20 @@ FileHandleIsDirectory (
/**
Retrieves the first file from a directory.
- This function opens a directory and gets the first file's info in the
- directory. Caller can use FileHandleFindNextFile() to get other files. When
- complete the caller is responsible for calling FreePool() on *Buffer.
+ This function opens a directory and gets the first file's information in the
+ directory. The caller the uses FileHandleFindNextFile() to get other files. When
+ complete, the caller is responsible for calling FreePool() on *Buffer.
- @param DirHandle The file handle of the directory to search
- @param Buffer Pointer to pointer to buffer for file's information
+ @param[in] DirHandle The file handle of the directory to search.
+ @param[out] Buffer The pointer to pointer to buffer for file's information.
@retval EFI_SUCCESS Found the first file.
@retval EFI_NOT_FOUND Cannot find the directory.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @return Others status of FileHandleGetInfo, FileHandleSetPosition,
- or FileHandleRead
+ @return Others The status of FileHandleGetInfo, FileHandleSetPosition,
+ or FileHandleRead.
**/
EFI_STATUS
EFIAPI
@@ -294,11 +295,11 @@ FileHandleFindFirstFile (
call of this function has no file to get. *NoFile will be set to TRUE and the
Buffer memory will be automatically freed.
- @param DirHandle the file handle of the directory
- @param Buffer pointer to buffer for file's information
- @param NoFile pointer to boolean when last file is found
+ @param[in] DirHandle The file handle of the directory.
+ @param[out] Buffer The pointer to buffer for file's information.
+ @param[out] NoFile The pointer to boolean when last file is found.
- @retval EFI_SUCCESS Found the next file, or reached last file
+ @retval EFI_SUCCESS Found the next file, or reached last file.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@@ -314,17 +315,17 @@ FileHandleFindNextFile(
/**
Retrieve the size of a file.
- If FileHandle is NULL then ASSERT()
- If Size is NULL then ASSERT()
+ If FileHandle is NULL then ASSERT().
+ If Size is NULL then ASSERT().
This function extracts the file size info from the FileHandle's EFI_FILE_INFO
data.
- @param FileHandle The file handle from which size is retrieved.
- @param Size pointer to size.
+ @param[in] FileHandle The file handle from which size is retrieved.
+ @param[out] Size The pointer to size.
- @retval EFI_SUCCESS operation was completed sucessfully
- @retval EFI_DEVICE_ERROR cannot access the file
+ @retval EFI_SUCCESS The operation completed successfully.
+ @retval EFI_DEVICE_ERROR Cannot access the file.
**/
EFI_STATUS
EFIAPI
@@ -334,6 +335,27 @@ FileHandleGetSize (
);
/**
+ Set the size of a file.
+
+ If FileHandle is NULL then ASSERT().
+
+ This function changes the file size info from the FileHandle's EFI_FILE_INFO
+ data.
+
+ @param[in] FileHandle The file handle whose size is to be changed.
+ @param[in] Size The new size.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @retval EFI_DEVICE_ERROR Cannot access the file.
+**/
+EFI_STATUS
+EFIAPI
+FileHandleSetSize (
+ IN EFI_FILE_HANDLE FileHandle,
+ IN UINT64 Size
+ );
+
+/**
Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on the
directory 'stack'.
@@ -341,10 +363,10 @@ FileHandleGetSize (
@param[out] FullFileName Pointer to pointer to generated full file name. It
is the responsibility of the caller to free this memory
with a call to FreePool().
- @retval EFI_SUCCESS the operation was sucessful and the FullFileName is valid.
+ @retval EFI_SUCCESS The operation was successful and FullFileName is valid.
@retval EFI_INVALID_PARAMETER Handle was NULL.
@retval EFI_INVALID_PARAMETER FullFileName was NULL.
- @retval EFI_OUT_OF_MEMORY a memory allocation failed.
+ @retval EFI_OUT_OF_MEMORY A memory allocation failed.
**/
EFI_STATUS
EFIAPI
@@ -359,21 +381,24 @@ FileHandleGetFileName (
If the position upon start is 0, then the Ascii Boolean will be set. This should be
maintained and not changed for all operations with the same file.
- @param[in] Handle FileHandle to read from
- @param[in,out] Buffer pointer to buffer to read into
- @param[in,out] Size pointer to number of bytes in buffer
- @param[in] Truncate if TRUE then allows for truncation of the line to fit.
- if FALSE will reset the position to the begining of the
- line if the buffer is not large enough.
+ @param[in] Handle FileHandle to read from.
+ @param[in,out] Buffer The pointer to buffer to read into.
+ @param[in,out] Size The pointer to number of bytes in Buffer.
+ @param[in] Truncate If the buffer is large enough, this has no effect.
+ If the buffer is is too small and Truncate is TRUE,
+ the line will be truncated.
+ If the buffer is is too small and Truncate is FALSE,
+ then no read will occur.
+
@param[in,out] Ascii Boolean value for indicating whether the file is
- Ascii (TRUE) or UCS2 (FALSE);
+ Ascii (TRUE) or UCS2 (FALSE).
- @retval EFI_SUCCESS the operation was sucessful. the line is stored in
+ @retval EFI_SUCCESS The operation was successful. The line is stored in
Buffer.
@retval EFI_INVALID_PARAMETER Handle was NULL.
@retval EFI_INVALID_PARAMETER Size was NULL.
- @retval EFI_BUFFER_TOO_SMALL Size was not enough space to store the line.
- Size was updated to minimum space required.
+ @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.
+ Size was updated to the minimum space required.
@sa FileHandleRead
**/
EFI_STATUS
@@ -394,7 +419,8 @@ FileHandleReadLine(
maintained and not changed for all operations with the same file.
@param[in] Handle FileHandle to read from.
- @param[in,out] Ascii Boolean value for indicating whether the file is Ascii (TRUE) or UCS2 (FALSE);
+ @param[in,out] Ascii Boolean value for indicating whether the file is
+ Ascii (TRUE) or UCS2 (FALSE).
@return The line of text from the file.
@@ -412,12 +438,12 @@ FileHandleReturnLine(
If Handle is NULL, ASSERT.
- @param[in] Handle FileHandle to write to
+ @param[in] Handle FileHandle to write to.
@param[in] Buffer Buffer to write, if NULL the function will
take no action and return EFI_SUCCESS.
- @retval EFI_SUCCESS the data was written.
- @retval other failure.
+ @retval EFI_SUCCESS The data was written.
+ @retval other Failure.
@sa FileHandleWrite
**/
@@ -429,14 +455,14 @@ FileHandleWriteLine(
);
/**
- function to take a formatted argument and print it to a file.
+ Function to take a formatted argument and print it to a file.
- @param[in] Handle the file handle for the file to write to
- @param[in] Format the format argument (see printlib for format specifier)
- @param[in] ... the variable arguments for the format
+ @param[in] Handle The file handle for the file to write to.
+ @param[in] Format The format argument (see printlib for the format specifier).
+ @param[in] ... The variable arguments for the format.
- @retval EFI_SUCCESS the operation was sucessful
- @return other a return value from FileHandleWriteLine
+ @retval EFI_SUCCESS The operation was successful.
+ @retval other A return value from FileHandleWriteLine.
@sa FileHandleWriteLine
**/
@@ -453,12 +479,12 @@ FileHandlePrintLine(
This will NOT work on directories.
- If Handle is NULL, then ASSERT.
+ If Handle is NULL, then ASSERT().
- @param[in] Handle the file handle
+ @param[in] Handle The file handle.
- @retval TRUE the position is at the end of the file
- @retval FALSE the position is not at the end of the file
+ @retval TRUE The position is at the end of the file.
+ @retval FALSE The position is not at the end of the file.
**/
BOOLEAN
EFIAPI
diff --git a/ShellPkg/Include/Library/HandleParsingLib.h b/ShellPkg/Include/Library/HandleParsingLib.h
new file mode 100644
index 0000000000..f08768c152
--- /dev/null
+++ b/ShellPkg/Include/Library/HandleParsingLib.h
@@ -0,0 +1,342 @@
+/** @file
+ Provides interface to advanced shell functionality for parsing both handle and protocol database.
+
+ Copyright (c) 2010, 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 __HANDLE_PARSING_LIB__
+#define __HANDLE_PARSING_LIB__
+
+#include <Uefi.h>
+
+/**
+ Function to get the name of a protocol or struct from it's GUID.
+
+ If Guid is NULL, then ASSERT.
+
+ @param[in] Guid The GUID to look for the name of.
+ @param[in] Lang The language to use.
+
+ @return The pointer to a string of the name. The caller
+ is responsible to free this memory.
+**/
+CHAR16*
+EFIAPI
+GetStringNameFromGuid(
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR8 *Lang OPTIONAL
+ );
+
+/**
+ Function to get the Guid for a protocol or struct based on it's string name.
+
+ @param[in] Name The pointer to the string name.
+ @param[in] Lang The pointer to the language code (string).
+ @param[in] Guid The pointer to the pointer to the Guid.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+GetGuidFromStringName(
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR8 *Lang OPTIONAL,
+ IN EFI_GUID **Guid
+ );
+
+/**
+ Function to dump protocol information from a handle.
+
+ This function will return a allocated string buffer containing the
+ information. The caller is responsible for freeing the memory.
+
+ If Guid is NULL, ASSERT().
+ If TheHandle is NULL, ASSERT().
+
+ @param[in] TheHandle The handle to dump information from.
+ @param[in] Guid The GUID of the protocol to dump.
+ @param[in] Verbose TRUE for extra info. FALSE otherwise.
+
+ @return The pointer to string.
+ @retval NULL An error was encountered.
+**/
+CHAR16*
+EFIAPI
+GetProtocolInformationDump(
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST EFI_GUID *Guid,
+ IN CONST BOOLEAN Verbose
+ );
+
+/**
+ Function to retrieve the driver name (if possible) from the ComponentName or
+ ComponentName2 protocol.
+
+ The string returned must be callee freed.
+
+ @param[in] TheHandle The driver handle to get the name of.
+ @param[in] Language The language to use.
+
+ @retval NULL The name could not be found.
+ @return A pointer to the string name. Do not de-allocate the memory.
+**/
+CONST CHAR16*
+EFIAPI
+GetStringNameFromHandle(
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST CHAR8 *Language
+ );
+
+#define HR_UNKNOWN 0
+#define HR_IMAGE_HANDLE BIT1
+#define HR_DRIVER_BINDING_HANDLE BIT2 // has driver binding
+#define HR_DEVICE_DRIVER BIT3 // device driver (hybrid?)
+#define HR_BUS_DRIVER BIT4 // a bus driver (hybrid?)
+#define HR_DRIVER_CONFIGURATION_HANDLE BIT5
+#define HR_DRIVER_DIAGNOSTICS_HANDLE BIT6
+#define HR_COMPONENT_NAME_HANDLE BIT7
+#define HR_DEVICE_HANDLE BIT8
+#define HR_PARENT_HANDLE BIT9
+#define HR_CONTROLLER_HANDLE BIT10
+#define HR_CHILD_HANDLE BIT11
+#define HR_VALID_MASK (BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11)
+
+/**
+ Gets all the related EFI_HANDLEs based on the mask supplied.
+
+ This function will scan all EFI_HANDLES in the UEFI environment's handle database
+ and return all the ones with the specified relationship (Mask) to the specified
+ controller handle.
+
+ If both DriverBindingHandle and ControllerHandle are NULL, then ASSERT.
+ If MatchingHandleCount is NULL, then ASSERT.
+
+ If MatchingHandleBuffer is not NULL upon a successful return, the memory must be
+ caller freed.
+
+ @param[in] DriverBindingHandle The handle with Driver Binding protocol on it.
+ @param[in] ControllerHandle The handle with Device Path protocol on it.
+ @param[in] Mask The mask of what relationship(s) is desired.
+ @param[in] MatchingHandleCount The pointer to UINTN specifying number of HANDLES in
+ MatchingHandleBuffer.
+ @param[out] MatchingHandleBuffer On a successful return, a buffer of MatchingHandleCount
+ EFI_HANDLEs with a terminating NULL EFI_HANDLE.
+
+ @retval EFI_SUCCESS The operation was successful, and any related handles
+ are in MatchingHandleBuffer.
+ @retval EFI_NOT_FOUND No matching handles were found.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid or out of range.
+ @sa ParseHandleDatabaseByRelationshipWithType
+**/
+EFI_STATUS
+EFIAPI
+ParseHandleDatabaseByRelationship (
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN CONST UINTN Mask,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ );
+
+/**
+ Gets all the related EFI_HANDLEs based on the mask supplied.
+
+ This function scans all EFI_HANDLES in the UEFI environment's handle database
+ and returns the ones with the specified relationship (Mask) to the specified
+ controller handle.
+
+ If both DriverBindingHandle and ControllerHandle are NULL, then ASSERT.
+ If MatchingHandleCount is NULL, then ASSERT.
+
+ If MatchingHandleBuffer is not NULL upon a successful return the memory must be
+ caller freed.
+
+ @param[in] DriverBindingHandle The handle with Driver Binding protocol on it.
+ @param[in] ControllerHandle The handle with Device Path protocol on it.
+ @param[in] MatchingHandleCount The pointer to UINTN that specifies the number of HANDLES in
+ MatchingHandleBuffer.
+ @param[out] MatchingHandleBuffer On a successful return, a buffer of MatchingHandleCount
+ EFI_HANDLEs with a terminating NULL EFI_HANDLE.
+ @param[out] HandleType An array of type information.
+
+ @retval EFI_SUCCESS The operation was successful, and any related handles
+ are in MatchingHandleBuffer.
+ @retval EFI_NOT_FOUND No matching handles were found.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid or out of range.
+**/
+EFI_STATUS
+EFIAPI
+ParseHandleDatabaseByRelationshipWithType (
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN UINTN *HandleCount,
+ OUT EFI_HANDLE **HandleBuffer,
+ OUT UINTN **HandleType
+ );
+
+/**
+ Gets handles for any parents of the passed in controller.
+
+ @param[in] ControllerHandle The handle of the controller.
+ @param[in] Count The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] Buffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+#define PARSE_HANDLE_DATABASE_PARENTS(ControllerHandle, Count, Buffer) \
+ ParseHandleDatabaseByRelationship(NULL, ControllerHandle, HR_PARENT_HANDLE, Count, Buffer)
+
+/**
+ Gets handles for any UEFI drivers of the passed in controller.
+
+ @param[in] ControllerHandle The handle of the controller.
+ @param[in] Count The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] Buffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+#define PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ControllerHandle, Count, Buffer) \
+ ParseHandleDatabaseByRelationship(NULL, ControllerHandle, HR_DRIVER_BINDING_HANDLE|HR_DEVICE_DRIVER, Count, Buffer)
+
+/**
+ Gets handles for any children of the passed in controller by the passed in driver handle.
+
+ @param[in] DriverHandle The handle of the driver.
+ @param[in] ControllerHandle The handle of the controller.
+ @param[in] Count The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] Buffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+#define PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(DriverHandle, ControllerHandle, Count, Buffer) \
+ ParseHandleDatabaseByRelationship(DriverHandle, ControllerHandle, HR_CHILD_HANDLE|HR_DEVICE_HANDLE, Count, Buffer)
+
+/**
+ Gets handles for any devices managed by the passed in driver.
+
+ @param[in] DriverHandle The handle of the driver.
+ @param[in] Count The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] Buffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+#define PARSE_HANDLE_DATABASE_DEVICES(DriverHandle, Count, Buffer) \
+ ParseHandleDatabaseByRelationship(DriverHandle, NULL, HR_CONTROLLER_HANDLE|HR_DEVICE_HANDLE, Count, Buffer)
+
+/**
+ Gets handles for any child devices produced by the passed in driver.
+
+ @param[in] DriverHandle The handle of the driver.
+ @param[in] MatchingHandleCount The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] MatchingHandleBuffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+EFI_STATUS
+EFIAPI
+ParseHandleDatabaseForChildDevices(
+ IN CONST EFI_HANDLE DriverHandle,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ );
+
+/**
+ Gets handles for any child controllers of the passed in controller.
+
+ @param[in] ControllerHandle The handle of the "parent controller".
+ @param[in] MatchingHandleCount The pointer to the number of handles in
+ MatchingHandleBuffer on return.
+ @param[out] MatchingHandleBuffer The buffer containing handles on a successful
+ return.
+ @retval EFI_SUCCESS The operation was successful.
+ @sa ParseHandleDatabaseByRelationship
+**/
+EFI_STATUS
+EFIAPI
+ParseHandleDatabaseForChildControllers(
+ IN CONST EFI_HANDLE ControllerHandle,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ );
+
+
+/**
+ Function to retrieve the human-friendly index of a given handle. If the handle
+ does not have a index one will be automatically assigned. The index value is valid
+ until the termination of the shell application.
+
+ @param[in] TheHandle The handle to retrieve an index for.
+
+ @retval 0 A memory allocation failed.
+ @return The index of the handle.
+
+**/
+UINTN
+EFIAPI
+ConvertHandleToHandleIndex(
+ IN CONST EFI_HANDLE TheHandle
+ );
+
+/**
+ Function to retrieve the EFI_HANDLE from the human-friendly index.
+
+ @param[in] TheIndex The index to retrieve the EFI_HANDLE for.
+
+ @retval NULL The index was invalid.
+ @return The EFI_HANDLE that index represents.
+
+**/
+EFI_HANDLE
+EFIAPI
+ConvertHandleIndexToHandle(
+ IN CONST UINTN TheIndex
+ );
+
+/**
+ Function to get all handles that support a given protocol or all handles.
+
+ @param[in] ProtocolGuid The guid of the protocol to get handles for. If NULL
+ then the function will return all handles.
+
+ @retval NULL A memory allocation failed.
+ @return A NULL terminated list of handles.
+**/
+EFI_HANDLE*
+EFIAPI
+GetHandleListByPotocol (
+ IN CONST EFI_GUID *ProtocolGuid OPTIONAL
+ );
+
+/**
+ Function to get all handles that support some protocols.
+
+ @param[in] ProtocolGuids A NULL terminated list of protocol GUIDs.
+
+ @retval NULL A memory allocation failed.
+ @return A NULL terminated list of handles.
+**/
+EFI_HANDLE*
+EFIAPI
+GetHandleListByPotocolList (
+ IN CONST EFI_GUID **ProtocolGuids
+ );
+
+#endif // __HANDLE_PARSING_LIB__
diff --git a/ShellPkg/Include/Library/ShellCEntryLib.h b/ShellPkg/Include/Library/ShellCEntryLib.h
index 638dc4b25b..f839372b39 100644
--- a/ShellPkg/Include/Library/ShellCEntryLib.h
+++ b/ShellPkg/Include/Library/ShellCEntryLib.h
@@ -1,5 +1,5 @@
/** @file
- Provides application point extension for "C" style main funciton
+ Provides application point extension for "C" style main funciton.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
@@ -19,8 +19,8 @@
The ShellCEntryLib library instance wrappers the actual UEFI application
entry point and calls this ShellAppMain function.
- @param ImageHandle The image handle of the UEFI Application.
- @param SystemTable A pointer to the EFI System Table.
+ @param[in] Argc The number of parameters.
+ @param[in] Argv The array of pointers to parameters.
@retval 0 The application exited normally.
@retval Other An error occurred.
diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h
new file mode 100644
index 0000000000..53cc80b4b5
--- /dev/null
+++ b/ShellPkg/Include/Library/ShellCommandLib.h
@@ -0,0 +1,757 @@
+/** @file
+ Provides interface to shell internal functions for shell commands.
+
+ This library is for use ONLY by shell commands linked into the shell application.
+ This library will not funciton if it is used for UEFI Shell 2.0 Applications.
+
+ Copyright (c) 2009 - 2010, 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 _SHELL_COMMAND_LIB_
+#define _SHELL_COMMAND_LIB_
+
+#include <Uefi.h>
+#include <ShellBase.h>
+
+#include <Protocol/EfiShell.h>
+#include <Protocol/EfiShellParameters.h>
+#include <Protocol/UnicodeCollation.h>
+#include <Protocol/DevicePathToText.h>
+#include <Protocol/SimpleFileSystem.h>
+
+#include <Library/UefiBootServicesTableLib.h>
+
+//
+// The extern global protocol poionters.
+//
+extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
+extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
+extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
+extern EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText;
+extern CONST CHAR16* SupportLevel[];
+
+//
+// The map list objects.
+//
+typedef struct {
+ LIST_ENTRY Link;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *MapName;
+ CHAR16 *CurrentDirectoryPath;
+ UINT64 Flags;
+} SHELL_MAP_LIST;
+/// List of Mappings - DeviceName and Drive Letter(ism).
+extern SHELL_MAP_LIST gShellMapList;
+/// Pointer to node of current directory in the mMapList.
+extern SHELL_MAP_LIST *gShellCurDir;
+
+/**
+ Returns the help MAN fileName for a given shell command.
+
+ @retval !NULL The unicode string of the MAN filename.
+ @retval NULL An error ocurred.
+
+**/
+typedef
+CONST CHAR16 *
+(EFIAPI *SHELL_GET_MAN_FILENAME)(
+ VOID
+ );
+
+/**
+ Runs a shell command on a given command line.
+
+ The specific operation of a given shell command is specified in the UEFI Shell
+ Specification 2.0, or in the source of the given command.
+
+ Upon completion of the command run the shell protocol and environment variables
+ may have been updated due to the operation.
+
+ @param[in] ImageHandle The ImageHandle to the app, or NULL if
+ the command built into shell.
+ @param[in] SystemTable The pointer to the system table.
+
+ @retval RETURN_SUCCESS The shell command was sucessful.
+ @retval RETURN_UNSUPPORTED The command is not supported.
+**/
+typedef
+SHELL_STATUS
+(EFIAPI *SHELL_RUN_COMMAND)(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Registers the handlers of type SHELL_RUN_COMMAND and
+ SHELL_GET_MAN_FILENAME for each shell command.
+
+ If the ShellSupportLevel is greater than the value of
+ PcdShellSupportLevel, then return RETURN_UNSUPPORTED.
+
+ Registers the the handlers specified by GetHelpInfoHandler and CommandHandler
+ with the command specified by CommandString. If the command named by
+ CommandString has already been registered, then return
+ RETURN_ALREADY_STARTED.
+
+ If there are not enough resources available to register the handlers, then
+ RETURN_OUT_OF_RESOURCES is returned.
+
+ If CommandString is NULL, then ASSERT().
+ If GetHelpInfoHandler is NULL, then ASSERT().
+ If CommandHandler is NULL, then ASSERT().
+ If ProfileName is NULL, then ASSERT().
+
+ @param[in] CommandString The pointer to the command name. This is the
+ name to look for on the command line in
+ the shell.
+ @param[in] CommandHandler The pointer to a function that runs the
+ specified command.
+ @param[in] GetManFileName The pointer to a function that provides man
+ filename.
+ @param[in] ShellMinSupportLevel The minimum Shell Support Level which has this
+ function.
+ @param[in] ProfileName The profile name to require for support of this
+ function.
+ @param[in] CanAffectLE Indicates whether this command's return value
+ can change the LASTERROR environment variable.
+ @param[in] HiiHandle The handle of this command's HII entry.
+ @param[in] ManFormatHelp The HII locator for the help text.
+
+ @retval RETURN_SUCCESS The handlers were registered.
+ @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
+ register the shell command.
+ @retval RETURN_UNSUPPORTED The ShellMinSupportLevel was higher than the
+ currently allowed support level.
+ @retval RETURN_ALREADY_STARTED The CommandString represents a command that
+ is already registered. Only one handler set for
+ a given command is allowed.
+ @sa SHELL_GET_MAN_FILENAME
+ @sa SHELL_RUN_COMMAND
+**/
+RETURN_STATUS
+EFIAPI
+ShellCommandRegisterCommandName (
+ IN CONST CHAR16 *CommandString,
+ IN SHELL_RUN_COMMAND CommandHandler,
+ IN SHELL_GET_MAN_FILENAME GetManFileName,
+ IN UINT32 ShellMinSupportLevel,
+ IN CONST CHAR16 *ProfileName,
+ IN CONST BOOLEAN CanAffectLE,
+ IN CONST EFI_HANDLE HiiHandle,
+ IN CONST EFI_STRING_ID ManFormatHelp
+ );
+
+/**
+ Checks if a command string has been registered for CommandString, and if so, it runs
+ the previously registered handler for that command with the command line.
+
+ If CommandString is NULL, then ASSERT().
+
+ If Sections is specified, then each section name listed will be compared in a case sensitive
+ manner to the section names described in Appendix B UEFI Shell 2.0 Specification. If the section exists,
+ it is appended to the returned help text. If the section does not exist, no
+ information is returned. If Sections is NULL, then all help text information
+ available is returned.
+
+ @param[in] CommandString The pointer to the command name. This is the name
+ found on the command line in the shell.
+ @param[in,out] RetVal The pointer to the return value from the command handler.
+
+ @param[in,out] CanAffectLE Indicates whether this command's return value
+ needs to be placed into LASTERROR environment variable.
+
+ @retval RETURN_SUCCESS The handler was run.
+ @retval RETURN_NOT_FOUND The CommandString did not match a registered
+ command name.
+ @sa SHELL_RUN_COMMAND
+**/
+RETURN_STATUS
+EFIAPI
+ShellCommandRunCommandHandler (
+ IN CONST CHAR16 *CommandString,
+ IN OUT SHELL_STATUS *RetVal,
+ IN OUT BOOLEAN *CanAffectLE OPTIONAL
+ );
+
+/**
+ Checks if a command string has been registered for CommandString, and if so, it
+ returns the MAN filename specified for that command.
+
+ If CommandString is NULL, then ASSERT().
+
+ @param[in] CommandString The pointer to the command name. This is the name
+ found on the command line in the shell.
+
+ @retval NULL The CommandString was not a registered command.
+ @retval other The name of the MAN file.
+ @sa SHELL_GET_MAN_FILENAME
+**/
+CONST CHAR16*
+EFIAPI
+ShellCommandGetManFileNameHandler (
+ IN CONST CHAR16 *CommandString
+ );
+
+
+typedef struct {
+ LIST_ENTRY Link;
+ CHAR16 *CommandString;
+} COMMAND_LIST;
+
+/**
+ Get the list of all available shell internal commands. This is a linked list,
+ via the LIST_ENTRY structure. Enumerate through it using the BaseLib linked
+ list functions. Do not modify the values.
+
+ @return A linked list of all available shell commands.
+**/
+CONST COMMAND_LIST*
+EFIAPI
+ShellCommandGetCommandList (
+ VOID
+ );
+
+typedef struct {
+ LIST_ENTRY Link;
+ CHAR16 *CommandString;
+ CHAR16 *Alias;
+} ALIAS_LIST;
+
+/**
+ Registers aliases to be set as part of the initialization of the shell application.
+
+ If Command is NULL, then ASSERT().
+ If Alias is NULL, then ASSERT().
+
+ @param[in] Command The pointer to the Command.
+ @param[in] Alias The pointer to Alias.
+
+ @retval RETURN_SUCCESS The handlers were registered.
+ @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
+ register the shell command.
+**/
+RETURN_STATUS
+EFIAPI
+ShellCommandRegisterAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias
+ );
+
+/**
+ Get the list of all shell alias commands. This is a linked list,
+ via LIST_ENTRY structure. Enumerate through it using the BaseLib linked
+ list functions. Do not modify the values.
+
+ @return A linked list of all requested shell aliases.
+**/
+CONST ALIAS_LIST*
+EFIAPI
+ShellCommandGetInitAliasList (
+ VOID
+ );
+
+/**
+ Determine if a given alias is on the list of built in aliases.
+
+ @param[in] Alias The alias to test for.
+
+ @retval TRUE The alias is a built in alias.
+ @retval FALSE The alias is not a built in alias.
+**/
+BOOLEAN
+EFIAPI
+ShellCommandIsOnAliasList (
+ IN CONST CHAR16 *Alias
+ );
+
+/**
+ Checks if a command is already on the list.
+
+ @param[in] CommandString The command string to check for on the list.
+
+ @retval TRUE CommandString represents a registered command.
+ @retval FALSE CommandString does not represent a registered command.
+**/
+BOOLEAN
+EFIAPI
+ShellCommandIsCommandOnList (
+ IN CONST CHAR16 *CommandString
+ );
+
+/**
+ Get the help text for a command.
+
+ @param[in] CommandString The command name.
+
+ @retval NULL No help text was found.
+ @return The string of the help text. The caller required to free.
+**/
+CHAR16*
+EFIAPI
+ShellCommandGetCommandHelp (
+ IN CONST CHAR16 *CommandString
+ );
+
+/**
+ Function to make sure that the above pointers are valid.
+**/
+EFI_STATUS
+EFIAPI
+CommandInit (
+ VOID
+ );
+
+/**
+ Function to determine current state of ECHO. Echo determines if lines from scripts
+ and ECHO commands are enabled.
+
+ @retval TRUE Echo is currently enabled.
+ @retval FALSE Echo is currently disabled.
+**/
+BOOLEAN
+EFIAPI
+ShellCommandGetEchoState (
+ VOID
+ );
+
+/**
+ Function to set current state of ECHO. Echo determines if lines from scripts
+ and ECHO commands are enabled.
+
+ @param[in] State TRUE to enable Echo, FALSE otherwise.
+**/
+VOID
+EFIAPI
+ShellCommandSetEchoState (
+ IN BOOLEAN State
+ );
+
+
+
+/**
+ Indicate that the current shell or script should exit.
+
+ @param[in] ScriptOnly TRUE if exiting a script; FALSE otherwise.
+**/
+VOID
+EFIAPI
+ShellCommandRegisterExit (
+ IN BOOLEAN ScriptOnly
+ );
+
+/**
+ Retrieve the Exit indicator.
+
+ @retval TRUE Exit was indicated.
+ @retval FALSE Exit was not indicated.
+**/
+BOOLEAN
+EFIAPI
+ShellCommandGetExit (
+ VOID
+ );
+
+/**
+ Retrieve the Exit script indicator.
+
+ If ShellCommandGetExit returns FALSE, then the return from this is undefined.
+
+ @retval TRUE ScriptOnly was indicated.
+ @retval FALSE ScriptOnly was not indicated.
+**/
+BOOLEAN
+EFIAPI
+ShellCommandGetScriptExit (
+ VOID
+ );
+
+typedef struct {
+ LIST_ENTRY Link; ///< List enumerator items.
+ UINTN Line; ///< What line of the script file this was on.
+ CHAR16 *Cl; ///< The original command line.
+ VOID *Data; ///< The data structure format dependant upon Command. (not always used)
+ BOOLEAN Reset; ///< Reset the command (it must be treated like a initial run (but it may have data already))
+} SCRIPT_COMMAND_LIST;
+
+typedef struct {
+ CHAR16 *ScriptName; ///< The filename of this script.
+ CHAR16 **Argv; ///< The parmameters to the script file.
+ UINTN Argc; ///< The count of parameters.
+ LIST_ENTRY CommandList; ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
+ SCRIPT_COMMAND_LIST *CurrentCommand; ///< The command currently being operated. If !=NULL must be a member of CommandList.
+ LIST_ENTRY SubstList; ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
+} SCRIPT_FILE;
+
+/**
+ Function to return a pointer to the currently running script file object.
+
+ @retval NULL A script file is not currently running.
+ @return A pointer to the current script file object.
+**/
+SCRIPT_FILE*
+EFIAPI
+ShellCommandGetCurrentScriptFile (
+ VOID
+ );
+
+/**
+ Function to set a new script as the currently running one.
+
+ This function will correctly stack and unstack nested scripts.
+
+ @param[in] Script The pointer to new script information structure. If NULL,
+ it removes and de-allocates the topmost Script structure.
+
+ @return A pointer to the current running script file after this
+ change. It is NULL if removing the final script.
+**/
+SCRIPT_FILE*
+EFIAPI
+ShellCommandSetNewScript (
+ IN SCRIPT_FILE *Script OPTIONAL
+ );
+
+/**
+ Function to get the current Profile string.
+
+ This is used to retrieve what profiles were installed.
+
+ @retval NULL There are no installed profiles.
+ @return A semicolon-delimited list of profiles.
+**/
+CONST CHAR16 *
+EFIAPI
+ShellCommandGetProfileList (
+ VOID
+ );
+
+typedef enum {
+ MappingTypeFileSystem,
+ MappingTypeBlockIo,
+ MappingTypeMax
+} SHELL_MAPPING_TYPE;
+
+/**
+ Function to generate the next default mapping name.
+
+ If the return value is not NULL then it must be callee freed.
+
+ @param Type What kind of mapping name to make.
+
+ @retval NULL a memory allocation failed.
+ @return a new map name string
+**/
+CHAR16*
+EFIAPI
+ShellCommandCreateNewMappingName(
+ IN CONST SHELL_MAPPING_TYPE Type
+ );
+
+/**
+ Function to initialize the table for creating consistent map names.
+
+ @param[out] Table The pointer to pointer to pointer to DevicePathProtocol object.
+
+ @retval EFI_SUCCESS The table was created successfully.
+**/
+EFI_STATUS
+EFIAPI
+ShellCommandConsistMappingInitialize (
+ EFI_DEVICE_PATH_PROTOCOL ***Table
+ );
+
+/**
+ Function to uninitialize the table for creating consistent map names.
+
+ The parameter must have been received from ShellCommandConsistMappingInitialize.
+
+ @param[out] Table The pointer to pointer to DevicePathProtocol object.
+
+ @retval EFI_SUCCESS The table was deleted successfully.
+**/
+EFI_STATUS
+EFIAPI
+ShellCommandConsistMappingUnInitialize (
+ EFI_DEVICE_PATH_PROTOCOL **Table
+ );
+
+/**
+ Create a consistent mapped name for the device specified by DevicePath
+ based on the Table.
+
+ This must be called after ShellCommandConsistMappingInitialize() and
+ before ShellCommandConsistMappingUnInitialize() is called.
+
+ @param[in] DeviecPath The pointer to the dev path for the device.
+ @param[in] Table The Table of mapping information.
+
+ @retval NULL A consistent mapped name could not be created.
+ @return A pointer to a string allocated from pool with the device name.
+**/
+CHAR16*
+EFIAPI
+ShellCommandConsistMappingGenMappingName (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL **Table
+ );
+
+/**
+ Function to search the list of mappings for the first matching node on the
+ list based on the MapKey.
+
+ @param[in] MapKey The pointer to the string key to search for in the map.
+
+ @return the node on the list.
+**/
+SHELL_MAP_LIST*
+EFIAPI
+ShellCommandFindMapItem (
+ IN CONST CHAR16 *MapKey
+ );
+
+/**
+ Function to add a map node to the list of map items and update the "path" environment variable (optionally).
+
+ If Path is TRUE (during initialization only), the path environment variable will also be updated to include
+ default paths on the new map name...
+
+ Path should be FALSE when this function is called from the protocol SetMap function.
+
+ @param[in] Name The human readable mapped name.
+ @param[in] DevicePath The Device Path for this map.
+ @param[in] Flags The Flags attribute for this map item.
+ @param[in] Path TRUE to update path, FALSE to skip this step (should only be TRUE during initialization).
+
+ @retval EFI_SUCCESS The addition was sucessful.
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.
+**/
+EFI_STATUS
+EFIAPI
+ShellCommandAddMapItemAndUpdatePath(
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CONST UINT64 Flags,
+ IN CONST BOOLEAN Path
+ );
+
+/**
+ Creates the default map names for each device path in the system with
+ a protocol depending on the Type.
+
+ Also sets up the default path environment variable if Type is FileSystem.
+
+ @retval EFI_SUCCESS All map names were created sucessfully.
+ @retval EFI_NOT_FOUND No protocols were found in the system.
+ @return Error returned from gBS->LocateHandle().
+
+ @sa LocateHandle
+**/
+EFI_STATUS
+EFIAPI
+ShellCommandCreateInitialMappingsAndPaths(
+ VOID
+ );
+
+/**
+ Function to standardize the directory indicators to \ characters.
+
+ @param[in,out] Path The pointer to the path string to fix.
+
+ @retval NULL The operation failed.
+ @return The Path pointer.
+**/
+CHAR16*
+EFIAPI
+ShellCommandCleanPath (
+ IN OUT CHAR16 *Path
+ );
+
+/**
+ Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.
+
+ @param[in] Handle The SHELL_FILE_HANDLE to convert.
+
+ @return a EFI_FILE_PROTOCOL* representing the same file.
+**/
+EFI_FILE_PROTOCOL*
+EFIAPI
+ConvertShellHandleToEfiFileProtocol(
+ IN CONST SHELL_FILE_HANDLE Handle
+ );
+
+/**
+ Remove a SHELL_FILE_HANDLE frmo the list of SHELL_FILE_HANDLES.
+
+ @param[in] Handle The SHELL_FILE_HANDLE to remove.
+
+ @retval TRUE The item was removed.
+ @retval FALSE The item was not found.
+**/
+BOOLEAN
+EFIAPI
+ShellFileHandleRemove(
+ IN CONST SHELL_FILE_HANDLE Handle
+ );
+
+/**
+ Converts a EFI_FILE_PROTOCOL* to an SHELL_FILE_HANDLE.
+
+ @param[in] Handle The pointer to EFI_FILE_PROTOCOL to convert.
+ @param[in] Path The path to the file for verification.
+
+ @return a SHELL_FILE_HANDLE representing the same file.
+**/
+SHELL_FILE_HANDLE
+EFIAPI
+ConvertEfiFileProtocolToShellHandle(
+ IN CONST EFI_FILE_PROTOCOL *Handle,
+ IN CONST CHAR16 *Path
+ );
+
+/**
+ Find the path that was logged with the specified SHELL_FILE_HANDLE.
+
+ @param[in] Handle The SHELL_FILE_HANDLE to query on.
+
+ @return A pointer to the path for the file.
+**/
+CONST CHAR16*
+EFIAPI
+ShellFileHandleGetPath(
+ IN CONST SHELL_FILE_HANDLE Handle
+ );
+
+
+/**
+ Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
+
+ This will NOT work on directories.
+
+ If Handle is NULL, then ASSERT.
+
+ @param[in] Handle the file handle
+
+ @retval TRUE the position is at the end of the file
+ @retval FALSE the position is not at the end of the file
+**/
+BOOLEAN
+EFIAPI
+ShellFileHandleEof(
+ IN SHELL_FILE_HANDLE Handle
+ );
+
+/**
+ Function to read a single line from a SHELL_FILE_HANDLE. The \n is not included in the returned
+ buffer. The returned buffer must be callee freed.
+
+ If the position upon start is 0, then the Ascii Boolean will be set. This should be
+ maintained and not changed for all operations with the same file.
+
+ @param[in] Handle SHELL_FILE_HANDLE to read from.
+ @param[in,out] Ascii Boolean value for indicating whether the file is
+ Ascii (TRUE) or UCS2 (FALSE).
+
+ @return The line of text from the file.
+
+ @sa ShellFileHandleReadLine
+**/
+CHAR16*
+EFIAPI
+ShellFileHandleReturnLine(
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT BOOLEAN *Ascii
+ );
+
+/**
+ Function to read a single line (up to but not including the \n) from a SHELL_FILE_HANDLE.
+
+ If the position upon start is 0, then the Ascii Boolean will be set. This should be
+ maintained and not changed for all operations with the same file.
+
+ @param[in] Handle SHELL_FILE_HANDLE to read from.
+ @param[in,out] Buffer The pointer to buffer to read into.
+ @param[in,out] Size The pointer to number of bytes in Buffer.
+ @param[in] Truncate If the buffer is large enough, this has no effect.
+ If the buffer is is too small and Truncate is TRUE,
+ the line will be truncated.
+ If the buffer is is too small and Truncate is FALSE,
+ then no read will occur.
+
+ @param[in,out] Ascii Boolean value for indicating whether the file is
+ Ascii (TRUE) or UCS2 (FALSE).
+
+ @retval EFI_SUCCESS The operation was successful. The line is stored in
+ Buffer.
+ @retval EFI_INVALID_PARAMETER Handle was NULL.
+ @retval EFI_INVALID_PARAMETER Size was NULL.
+ @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.
+ Size was updated to the minimum space required.
+ @sa ShellFileHandleRead
+**/
+EFI_STATUS
+EFIAPI
+ShellFileHandleReadLine(
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT CHAR16 *Buffer,
+ IN OUT UINTN *Size,
+ IN BOOLEAN Truncate,
+ IN OUT BOOLEAN *Ascii
+ );
+
+typedef struct {
+ LIST_ENTRY Link;
+ void *Buffer;
+} BUFFER_LIST;
+
+/**
+ Frees any BUFFER_LIST defined type.
+
+ @param[in] List The pointer to the list head.
+**/
+VOID
+EFIAPI
+FreeBufferList (
+ IN BUFFER_LIST *List
+ );
+
+/**
+ Chops off last directory or file entry in a path by changing the last '\' to a CHAR_NULL
+
+ @param[in,out] PathToReturn The pointer to the path to modify.
+
+ @retval FALSE No directory was found to chop off.
+ @retval TRUE A directory was chopped off.
+**/
+BOOLEAN
+EFIAPI
+ChopLastSlash(
+ IN OUT CHAR16 *PathToReturn
+ );
+
+/**
+ Function to clean up paths. Removes the following items:
+ single periods in the path (no need for the current directory tag)
+ double periods in the path and removes a single parent directory.
+
+ This will be done inline and the resultant string may be be 'too big'.
+
+ @param[in] PathToReturn The pointer to the string containing the path.
+
+ @return PathToReturn is always returned.
+**/
+CHAR16*
+EFIAPI
+CleanPath(
+ IN CHAR16 *PathToReturn
+ );
+
+#endif //_SHELL_COMMAND_LIB_
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h
index 5c644debfc..7a5d96157b 100644
--- a/ShellPkg/Include/Library/ShellLib.h
+++ b/ShellPkg/Include/Library/ShellLib.h
@@ -12,7 +12,7 @@
**/
-#if !defined(__SHELL_LIB__)
+#ifndef __SHELL_LIB__
#define __SHELL_LIB__
#include <Uefi.h>
@@ -24,6 +24,12 @@
#include <Protocol/EfiShell.h>
#include <Protocol/EfiShellParameters.h>
+// (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)
+#define MAX_FILE_NAME_LEN 512
+
+extern EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;
+extern EFI_SHELL_PROTOCOL *mEfiShellProtocol;
+
/**
This function will retrieve the information about the file for the handle
specified and store it in allocated pool memory.
@@ -41,31 +47,32 @@
EFI_FILE_INFO*
EFIAPI
ShellGetFileInfo (
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
- This function will set the information about the file for the opened handle
+ This function sets the information about the file for the opened handle
specified.
@param[in] FileHandle The file handle of the file for which information
is being set.
- @param[in] FileInfo The infotmation to set.
+ @param[in] FileInfo The information to set.
- @retval EFI_SUCCESS The information was set.
- @retval EFI_UNSUPPORTED The InformationType is not known.
+ @retval EFI_SUCCESS The information was set.
+ @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid.
+ @retval EFI_UNSUPPORTED The FileHandle does not support FileInfo.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
ShellSetFileInfo (
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN EFI_FILE_INFO *FileInfo
);
@@ -75,36 +82,36 @@ ShellSetFileInfo (
This function opens a file with the open mode according to the file path. The
Attributes is valid only for EFI_FILE_MODE_CREATE.
- @param[in] FilePath On input the device path to the file. On output
+ @param[in,out] FilePath On input, the device path to the file. On output,
the remaining device path.
- @param[out] DeviceHandle Pointer to the system device handle.
- @param[out] FileHandle Pointer to the file handle.
- @param[in] OpenMode The mode to open the file with.
- @param[in] Attributes The file's file attributes.
+ @param[out] DeviceHandle Pointer to the system device handle.
+ @param[out] FileHandle Pointer to the file handle.
+ @param[in] OpenMode The mode to open the file with.
+ @param[in] Attributes The file's file attributes.
- @retval EFI_SUCCESS The information was set.
+ @retval EFI_SUCCESS The information was set.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Could not open the file path.
+ @retval EFI_UNSUPPORTED Could not open the file path.
@retval EFI_NOT_FOUND The specified file could not be found on the
device or the file system could not be found on
the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
file.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
ShellOpenFileByDevicePath(
IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
OUT EFI_HANDLE *DeviceHandle,
- OUT EFI_FILE_HANDLE *FileHandle,
+ OUT SHELL_FILE_HANDLE *FileHandle,
IN UINT64 OpenMode,
IN UINT64 Attributes
);
@@ -113,36 +120,36 @@ ShellOpenFileByDevicePath(
This function will open a file or directory referenced by filename.
If return is EFI_SUCCESS, the Filehandle is the opened file's handle;
- otherwise, the Filehandle is NULL. The Attributes is valid only for
+ otherwise, the Filehandle is NULL. Attributes is valid only for
EFI_FILE_MODE_CREATE.
- @param[in] FileName Pointer to file name.
- @param[out] FileHandle Pointer to the file handle.
- @param[in] OpenMode The mode to open the file with.
- @param[in] Attributes The file's file attributes.
+ @param[in] FilePath The pointer to file name.
+ @param[out] FileHandle The pointer to the file handle.
+ @param[in] OpenMode The mode to open the file with.
+ @param[in] Attributes The file's file attributes.
- @retval EFI_SUCCESS The information was set.
+ @retval EFI_SUCCESS The information was set.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Could not open the file path.
+ @retval EFI_UNSUPPORTED Could not open the file path.
@retval EFI_NOT_FOUND The specified file could not be found on the
device or the file system could not be found
on the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
file.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
ShellOpenFileByName(
IN CONST CHAR16 *FilePath,
- OUT EFI_FILE_HANDLE *FileHandle,
+ OUT SHELL_FILE_HANDLE *FileHandle,
IN UINT64 OpenMode,
IN UINT64 Attributes
);
@@ -154,31 +161,31 @@ ShellOpenFileByName(
otherwise, the Filehandle is NULL. If the directory already existed, this
function opens the existing directory.
- @param[in] DirectoryName Pointer to Directory name.
- @param[out] FileHandle Pointer to the file handle.
+ @param[in] DirectoryName The pointer to Directory name.
+ @param[out] FileHandle The pointer to the file handle.
- @retval EFI_SUCCESS The information was set.
+ @retval EFI_SUCCESS The information was set.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Could not open the file path.
+ @retval EFI_UNSUPPORTED Could not open the file path.
@retval EFI_NOT_FOUND The specified file could not be found on the
- device or the file system could not be found
+ device, or the file system could not be found
on the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ @retval EFI_NO_MEDIA The device has no medium.
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.
+ @retval EFI_ACCESS_DENIED The file was opened read only.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
file.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
ShellCreateDirectory(
IN CONST CHAR16 *DirectoryName,
- OUT EFI_FILE_HANDLE *FileHandle
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -198,22 +205,22 @@ ShellCreateDirectory(
EFI_FILE_INFO is the structure returned as the directory entry.
@param[in] FileHandle The opened file handle.
- @param[in] ReadSize On input the size of buffer in bytes. On return
+ @param[in,out] ReadSize On input the size of buffer in bytes. On return
the number of bytes written.
@param[out] Buffer The buffer to put read data into.
- @retval EFI_SUCCESS Data was read.
+ @retval EFI_SUCCESS Data was read.
@retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
+ @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
size.
**/
EFI_STATUS
EFIAPI
ShellReadFile(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *ReadSize,
OUT VOID *Buffer
);
@@ -230,24 +237,24 @@ ShellReadFile(
@param[in] FileHandle The opened file for writing.
- @param[in] BufferSize On input the number of bytes in Buffer. On output
+ @param[in,out] BufferSize On input the number of bytes in Buffer. On output
the number of bytes written.
@param[in] Buffer The buffer containing data to write is stored.
- @retval EFI_SUCCESS Data was written.
- @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
+ @retval EFI_SUCCESS Data was written.
+ @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
@retval EFI_NO_MEDIA The device has no media.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The device is write-protected.
- @retval EFI_ACCESS_DENIED The file was open for read only.
- @retval EFI_VOLUME_FULL The volume is full.
+ @retval EFI_DEVICE_ERROR The device reported an error.
+ @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+ @retval EFI_WRITE_PROTECTED The device is write-protected.
+ @retval EFI_ACCESS_DENIED The file was open for read only.
+ @retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
ShellWriteFile(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
);
@@ -262,12 +269,12 @@ ShellWriteFile(
@param[in] FileHandle The file handle to close.
@retval EFI_SUCCESS The file handle was closed sucessfully.
- @retval INVALID_PARAMETER One of the parameters has an invalid value.
+ @retval INVALID_PARAMETER One of the parameters has an invalid value.
**/
EFI_STATUS
EFIAPI
ShellCloseFile (
- IN EFI_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -287,7 +294,7 @@ ShellCloseFile (
EFI_STATUS
EFIAPI
ShellDeleteFile (
- IN EFI_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -295,15 +302,15 @@ ShellDeleteFile (
This function sets the current file position for the handle to the position
supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only
- absolute positioning is supported, and seeking past the end of the file is
- allowed (a subsequent write would grow the file). Seeking to position
+ absolute positioning is supported, and moving past the end of the file is
+ allowed (a subsequent write would grow the file). Moving to position
0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.
If FileHandle is a directory, the only position that may be set is zero. This
has the effect of starting the read process of the directory entries over.
@param[in] FileHandle The file handle on which the position is being set.
- @param[in] Position Byte position from begining of file.
+ @param[in] Position The byte position from the begining of the file.
@retval EFI_SUCCESS Operation completed sucessfully.
@retval EFI_UNSUPPORTED The seek request for non-zero is not valid on
@@ -313,7 +320,7 @@ ShellDeleteFile (
EFI_STATUS
EFIAPI
ShellSetFilePosition (
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN UINT64 Position
);
@@ -326,7 +333,7 @@ ShellSetFilePosition (
if FileHandle is a directory.
@param[in] FileHandle The open file handle on which to get the position.
- @param[out] Position Byte position from begining of file.
+ @param[out] Position The byte position from the begining of the file.
@retval EFI_SUCCESS The operation completed sucessfully.
@retval INVALID_PARAMETER One of the parameters has an invalid value.
@@ -335,7 +342,7 @@ ShellSetFilePosition (
EFI_STATUS
EFIAPI
ShellGetFilePosition (
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Position
);
@@ -356,7 +363,7 @@ ShellGetFilePosition (
EFI_STATUS
EFIAPI
ShellFlushFile (
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -368,20 +375,20 @@ ShellFlushFile (
Caller must use FreePool on *Buffer opon completion of all file searching.
- @param[in] DirHandle The file handle of the directory to search
- @param[out] Buffer Pointer to pointer to buffer for file's information
+ @param[in] DirHandle The file handle of the directory to search.
+ @param[out] Buffer The pointer to the buffer for the file's information.
@retval EFI_SUCCESS Found the first file.
@retval EFI_NOT_FOUND Cannot find the directory.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @return ShellReadFile
+ @sa ShellReadFile
**/
EFI_STATUS
EFIAPI
ShellFindFirstFile (
- IN EFI_FILE_HANDLE DirHandle,
+ IN SHELL_FILE_HANDLE DirHandle,
OUT EFI_FILE_INFO **Buffer
);
@@ -392,24 +399,25 @@ ShellFindFirstFile (
first file, and then use this function get other files. This function can be
called for several times to get each file's information in the directory. If
the call of ShellFindNextFile() got the last file in the directory, the next
- call of this function has no file to get. *NoFile will be set to TRUE and the
+ call of this function has no file to get. *NoFile will be set to TRUE, and the
data in Buffer is meaningless.
@param[in] DirHandle The file handle of the directory.
- @param[out] Buffer Pointer to buffer for file's information.
- @param[out] NoFile Pointer to boolean when last file is found.
+ @param[in,out] Buffer The pointer to buffer for file's information.
+ @param[in,out] NoFile The pointer to boolean when last file is found.
@retval EFI_SUCCESS Found the next file.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+ @sa ShellReadFile
**/
EFI_STATUS
EFIAPI
ShellFindNextFile(
- IN EFI_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO *Buffer,
- OUT BOOLEAN *NoFile
+ IN SHELL_FILE_HANDLE DirHandle,
+ IN OUT EFI_FILE_INFO *Buffer,
+ IN OUT BOOLEAN *NoFile
);
/**
@@ -419,7 +427,7 @@ ShellFindNextFile(
data.
@param[in] FileHandle The file handle from which size is retrieved.
- @param[out] Size Pointer to size.
+ @param[out] Size The pointer to size.
@retval EFI_SUCCESS The operation was completed sucessfully.
@retval EFI_DEVICE_ERROR Cannot access the file.
@@ -427,7 +435,7 @@ ShellFindNextFile(
EFI_STATUS
EFIAPI
ShellGetFileSize (
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Size
);
@@ -436,8 +444,8 @@ ShellGetFileSize (
This function is useful to check whether the application is being asked to halt by the shell.
- @retval TRUE the execution break is enabled
- @retval FALSE the execution break is not enabled
+ @retval TRUE The execution break is enabled.
+ @retval FALSE The execution break is not enabled.
**/
BOOLEAN
EFIAPI
@@ -454,7 +462,7 @@ ShellGetExecutionBreakFlag(
@param[in] EnvKey The key name of the environment variable.
@retval NULL The named environment variable does not exist.
- @return != NULL pointer to the value of the environment variable.
+ @return != NULL The pointer to the value of the environment variable.
**/
CONST CHAR16*
EFIAPI
@@ -479,8 +487,8 @@ ShellGetEnvironmentVariable (
@param[in] EnvVal The Value of the environment variable
@param[in] Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
- @retval EFI_SUCCESS the operation was completed sucessfully
- @retval EFI_UNSUPPORTED This operation is not allowed in pre UEFI 2.0 Shell environments
+ @retval EFI_SUCCESS The operation completed sucessfully
+ @retval EFI_UNSUPPORTED This operation is not allowed in pre-UEFI 2.0 Shell environments.
**/
EFI_STATUS
EFIAPI
@@ -507,11 +515,11 @@ ShellSetEnvironmentVariable (
ShellExecute() function. The Output parameter has no effect in a
UEFI Shell 2.0 environment.
- @param[in] ImageHandle Parent image that is starting the operation.
- @param[in] CommandLine Pointer to NULL terminated command line.
+ @param[in] ParentHandle The parent image starting the operation.
+ @param[in] CommandLine The pointer to a NULL terminated command line.
@param[in] Output True to display debug output. False to hide it.
@param[in] EnvironmentVariables Optional pointer to array of environment variables
- in the form "x=y". If NULL current set is used.
+ in the form "x=y". If NULL, the current set is used.
@param[out] Status The status of the run command line.
@retval EFI_SUCCESS The operation completed sucessfully. Status
@@ -545,7 +553,7 @@ ShellExecute (
CONST CHAR16*
EFIAPI
ShellGetCurrentDir (
- IN CHAR16 *DeviceName OPTIONAL
+ IN CHAR16 * CONST DeviceName OPTIONAL
);
/**
@@ -575,9 +583,9 @@ ShellSetPageBreakMode (
If you are NOT appending to an existing list *ListHead must be NULL. If
*ListHead is NULL then it must be callee freed.
- @param[in] Arg Pointer to path string.
+ @param[in] Arg The pointer to path string.
@param[in] OpenMode Mode to open files with.
- @param[in] ListHead Head of linked list of results.
+ @param[in,out] ListHead Head of linked list of results.
@retval EFI_SUCCESS The operation was sucessful and the list head
contains the list of opened files.
@@ -596,7 +604,7 @@ ShellOpenFileMetaArg (
/**
Free the linked list returned from ShellOpenFileMetaArg.
- @param[in] ListHead The pointer to free.
+ @param[in,out] ListHead The pointer to free.
@retval EFI_SUCCESS The operation was sucessful.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
@@ -631,12 +639,12 @@ ShellFindFilePath (
in the order provided and return the first one that is successful.
If FileName is NULL, then ASSERT.
- If FileExtension is NULL, then behavior is identical to ShellFindFilePath.
+ If FileExtension is NULL, then the behavior is identical to ShellFindFilePath.
If the return value is not NULL then the memory must be caller freed.
- @param[in] FileName Filename string.
- @param[in] FileExtension Semi-colon delimeted list of possible extensions.
+ @param[in] FileName The filename string.
+ @param[in] FileExtension Semicolon delimited list of possible extensions.
@retval NULL The file was not found.
@retval !NULL The path to the file.
@@ -656,25 +664,28 @@ typedef enum {
TypeDoubleValue, ///< A flag that has 2 space seperated value data following it (IE "-a 1 2").
TypeMaxValue, ///< A flag followed by all the command line data before the next flag.
TypeMax,
-} ParamType;
+} SHELL_PARAM_TYPE;
typedef struct {
- CHAR16 *Name;
- ParamType Type;
+ CHAR16 *Name;
+ SHELL_PARAM_TYPE Type;
} SHELL_PARAM_ITEM;
/// Helper structure for no parameters (besides -? and -b)
extern SHELL_PARAM_ITEM EmptyParamList[];
+/// Helper structure for -sfo only (besides -? and -b)
+extern SHELL_PARAM_ITEM SfoParamList[];
+
/**
Checks the command line arguments passed against the list of valid ones.
Optionally removes NULL values first.
If no initialization is required, then return RETURN_SUCCESS.
- @param[in] CheckList Pointer to list of parameters to check.
- @param[out] CheckPackage Package of checked values.
+ @param[in] CheckList The pointer to list of parameters to check.
+ @param[out] CheckPackage The package of checked values.
@param[out] ProblemParam Optional pointer to pointer to unicode string for
the paramater that caused failure.
@param[in] AutoPageBreak Will automatically set PageBreakEnabled.
@@ -683,9 +694,7 @@ extern SHELL_PARAM_ITEM EmptyParamList[];
@retval EFI_SUCCESS The operation completed sucessfully.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
- @retval EFI_VOLUME_CORRUPTED The command line was corrupt. An argument was
- duplicated. The duplicated command line argument
- was returned in ProblemParam if provided.
+ @retval EFI_VOLUME_CORRUPTED The command line was corrupt.
@retval EFI_DEVICE_ERROR The commands contained 2 opposing arguments. One
of the command line arguments was returned in
ProblemParam if provided.
@@ -735,12 +744,12 @@ ShellCommandLineFreeVarList (
@retval TRUE The flag is on the command line.
@retval FALSE The flag is not on the command line.
- **/
+**/
BOOLEAN
EFIAPI
ShellCommandLineGetFlag (
- IN CONST LIST_ENTRY *CheckPackage,
- IN CHAR16 *KeyString
+ IN CONST LIST_ENTRY * CONST CheckPackage,
+ IN CONST CHAR16 * CONST KeyString
);
/**
@@ -754,8 +763,8 @@ ShellCommandLineGetFlag (
@param[in] KeyString The Key of the command line argument to check for.
@retval NULL The flag is not on the command line.
- @retval !=NULL Pointer to unicode string of the value.
- **/
+ @retval !=NULL The pointer to unicode string of the value.
+**/
CONST CHAR16*
EFIAPI
ShellCommandLineGetValue (
@@ -774,13 +783,13 @@ ShellCommandLineGetValue (
@param[in] Position The position of the value.
@retval NULL The flag is not on the command line.
- @retval !=NULL Pointer to unicode string of the value.
- **/
+ @retval !=NULL The pointer to unicode string of the value.
+**/
CONST CHAR16*
EFIAPI
ShellCommandLineGetRawValue (
- IN CONST LIST_ENTRY *CheckPackage,
- IN UINT32 Position
+ IN CONST LIST_ENTRY * CONST CheckPackage,
+ IN UINTN Position
);
/**
@@ -788,20 +797,22 @@ ShellCommandLineGetRawValue (
This will not include flags.
- @retval (UINTN)-1 No parsing has ocurred.
- @return The number of value parameters found.
+ @param[in] CheckPackage The package of parsed command line arguments.
+
+ @retval (UINTN)-1 No parsing has occurred.
+ @retval other The number of value parameters found.
**/
UINTN
EFIAPI
ShellCommandLineGetCount(
- VOID
+ IN CONST LIST_ENTRY *CheckPackage
);
/**
- Determins if a parameter is duplicated.
+ Determines if a parameter is duplicated.
- If Param is not NULL then it will point to a callee allocated string buffer
- with the parameter value if a duplicate is found.
+ If Param is not NULL, then it will point to a callee-allocated string buffer
+ with the parameter value, if a duplicate is found.
If CheckPackage is NULL, then ASSERT.
@@ -820,7 +831,7 @@ ShellCommandLineCheckDuplicate (
/**
This function causes the shell library to initialize itself. If the shell library
- is already initialized it will de-initialize all the current protocol poitners and
+ is already initialized it will de-initialize all the current protocol pointers and
re-populate them again.
When the library is used with PcdShellLibAutoInitialize set to true this function
@@ -828,7 +839,7 @@ ShellCommandLineCheckDuplicate (
This function is intended for internal access for shell commands only.
- @retval EFI_SUCCESS the initialization was complete sucessfully
+ @retval EFI_SUCCESS The initialization was complete sucessfully.
**/
EFI_STATUS
@@ -858,14 +869,15 @@ ShellInitialize (
Note: The background color is controlled by the shell command cls.
- @param[in] Row The row to print at.
@param[in] Col The column to print at.
+ @param[in] Row The row to print at.
@param[in] Format The format string.
+ @param[in] ... The variable argument list.
- @return The number of characters printed to the screen.
+ @return EFI_SUCCESS The printing was successful.
+ @return EFI_DEVICE_ERROR The console device reported an error.
**/
-
-UINTN
+EFI_STATUS
EFIAPI
ShellPrintEx(
IN INT32 Col OPTIONAL,
@@ -895,16 +907,18 @@ ShellPrintEx(
Note: The background color is controlled by the shell command cls.
- @param[in] Row The row to print at.
@param[in] Col The column to print at.
+ @param[in] Row The row to print at.
@param[in] Language The language of the string to retrieve. If this parameter
is NULL, then the current platform language is used.
@param[in] HiiFormatStringId The format string Id for getting from Hii.
@param[in] HiiFormatHandle The format string Handle for getting from Hii.
+ @param[in] ... The variable argument list.
- @return the number of characters printed to the screen.
+ @return EFI_SUCCESS The printing was successful.
+ @return EFI_DEVICE_ERROR The console device reported an error.
**/
-UINTN
+EFI_STATUS
EFIAPI
ShellPrintHiiEx(
IN INT32 Col OPTIONAL,
@@ -999,7 +1013,7 @@ ShellStrToUintn(
given in CurrentSize the string will be grown such that the copy can be performed
and CurrentSize will be updated to the new size.
- If Source is NULL, there is nothing to append, just return the current buffer in
+ If Source is NULL, there is nothing to append, so return the current buffer in
Destination.
If Destination is NULL, then ASSERT().
@@ -1007,14 +1021,14 @@ ShellStrToUintn(
CurrentSize, then ASSERT().
@param[in,out] Destination The String to append onto.
- @param[in,out] CurrentSize On call the number of bytes in Destination. On
- return possibly the new size (still in bytes). If NULL
+ @param[in,out] CurrentSize On call, the number of bytes in Destination. On
+ return, possibly the new size (still in bytes). If NULL,
then allocate whatever is needed.
@param[in] Source The String to append from.
- @param[in] Count Maximum number of characters to append. If 0 then
+ @param[in] Count The maximum number of characters to append. If 0, then
all are appended.
- @return The Destination after apending the Source.
+ @return The Destination after appending the Source.
**/
CHAR16*
EFIAPI
@@ -1033,13 +1047,14 @@ StrnCatGrow (
If the string would grow bigger than NewSize it will halt and return error.
- @param[in] SourceString String with source buffer.
- @param[in,out] NewString String with resultant buffer.
- @param[in] NewSize Size in bytes of NewString.
- @param[in] FindTarget String to look for.
- @param[in] ReplaceWith String to replace FindTarget with.
+ @param[in] SourceString The string with source buffer.
+ @param[in,out] NewString The string with resultant buffer.
+ @param[in] NewSize The size in bytes of NewString.
+ @param[in] FindTarget The string to look for.
+ @param[in] ReplaceWith The string to replace FindTarget with.
@param[in] SkipPreCarrot If TRUE will skip a FindTarget that has a '^'
immediately before it.
+ @param[in] ParameterReplacing If TRUE will add "" around items with spaces.
@retval EFI_INVALID_PARAMETER SourceString was NULL.
@retval EFI_INVALID_PARAMETER NewString was NULL.
@@ -1049,36 +1064,32 @@ StrnCatGrow (
@retval EFI_INVALID_PARAMETER SourceString had length < 1.
@retval EFI_BUFFER_TOO_SMALL NewSize was less than the minimum size to hold
the new string (truncation occurred).
- @retval EFI_SUCCESS The string was sucessfully copied with replacement.
+ @retval EFI_SUCCESS The string was successfully copied with replacement.
**/
-
EFI_STATUS
EFIAPI
-ShellCopySearchAndReplace2(
+ShellCopySearchAndReplace(
IN CHAR16 CONST *SourceString,
- IN CHAR16 *NewString,
+ IN OUT CHAR16 *NewString,
IN UINTN NewSize,
IN CONST CHAR16 *FindTarget,
IN CONST CHAR16 *ReplaceWith,
- IN CONST BOOLEAN SkipPreCarrot
+ IN CONST BOOLEAN SkipPreCarrot,
+ IN CONST BOOLEAN ParameterReplacing
);
-///
-/// make upgrades easier from old version
-///
-#define ShellLibCopySearchAndReplace(a,b,c,d,e) ShellCopySearchAndReplace2(a,b,c,d,e,FALSE)
-
/**
Check if a Unicode character is a hexadecimal character.
This internal function checks if a Unicode character is a
- decimal character. The valid hexadecimal character is
+ numeric character. The valid hexadecimal characters are
L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
- @param[in] Char The character to check.
- @retval TRUE The Char is a hexadecmial character.
- @retval FALSE The Char is not a hexadecmial character.
+ @param Char The character to check against.
+
+ @retval TRUE The Char is a hexadecmial character.
+ @retval FALSE The Char is not a hexadecmial character.
**/
BOOLEAN
@@ -1087,31 +1098,51 @@ ShellIsHexaDecimalDigitCharacter (
IN CHAR16 Char
);
+/**
+ Check if a Unicode character is a decimal character.
+
+ This internal function checks if a Unicode character is a
+ decimal character. The valid characters are
+ L'0' to L'9'.
+
+
+ @param Char The character to check against.
+
+ @retval TRUE The Char is a hexadecmial character.
+ @retval FALSE The Char is not a hexadecmial character.
+
+**/
+BOOLEAN
+EFIAPI
+ShellIsDecimalDigitCharacter (
+ IN CHAR16 Char
+ );
+
///
-/// What type of answer is requested
+/// What type of answer is requested.
///
typedef enum {
- SHELL_PROMPT_REQUEST_TYPE_YES_NO,
- SHELL_PROMPT_REQUEST_TYPE_YES_NO_CANCEL,
- SHELL_PROMPT_REQUEST_TYPE_FREEFORM,
- SHELL_PROMPT_REQUEST_TYPE_QUIT_CONTINUE,
- SHELL_PROMPT_REQUEST_TYPE_YES_NO_ALL_CANCEL,
- SHELL_PROMPT_REQUEST_TYPE_ENTER_TO_COMTINUE,
- SHELL_PROMPT_REQUEST_TYPE_ANYKEY_TO_COMTINUE,
- SHELL_PROMPT_REQUEST_TYPE_MAX
+ ShellPromptResponseTypeYesNo,
+ ShellPromptResponseTypeYesNoCancel,
+ ShellPromptResponseTypeFreeform,
+ ShellPromptResponseTypeQuitContinue,
+ ShellPromptResponseTypeYesNoAllCancel,
+ ShellPromptResponseTypeEnterContinue,
+ ShellPromptResponseTypeAnyKeyContinue,
+ ShellPromptResponseTypeMax
} SHELL_PROMPT_REQUEST_TYPE;
///
-/// what answer was given
+/// What answer was given.
///
typedef enum {
- SHELL_PROMPT_RESPONSE_YES,
- SHELL_PROMPT_RESPONSE_NO,
- SHELL_PROMPT_RESPONSE_CANCEL,
- SHELL_PROMPT_RESPONSE_QUIT,
- SHELL_PROMPT_RESPONSE_CONTINUE,
- SHELL_PROMPT_RESPONSE_ALL,
- SHELL_PROMPT_RESPONSE_MAX
+ ShellPromptResponseYes,
+ ShellPromptResponseNo,
+ ShellPromptResponseCancel,
+ ShellPromptResponseQuit,
+ ShellPromptResponseContinue,
+ ShellPromptResponseAll,
+ ShellPromptResponseMax
} SHELL_PROMPT_RESPONSE;
/**
@@ -1120,23 +1151,22 @@ typedef enum {
This function will display the requested question on the shell prompt and then
wait for an apropriate answer to be input from the console.
- if the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, SHELL_PROMPT_REQUEST_TYPE_QUIT_CONTINUE
+ If the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, ShellPromptResponseTypeQuitContinue
or SHELL_PROMPT_REQUEST_TYPE_YESNOCANCEL then *Response is of type SHELL_PROMPT_RESPONSE.
- if the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_FREEFORM then *Response is of type
+ If the SHELL_PROMPT_REQUEST_TYPE is ShellPromptResponseTypeFreeform then *Response is of type
CHAR16*.
In either case *Response must be callee freed if Response was not NULL;
@param Type What type of question is asked. This is used to filter the input
to prevent invalid answers to question.
- @param Prompt Pointer to string prompt to use to request input.
- @param Response Pointer to Response which will be populated upon return.
+ @param Prompt The pointer to a string prompt used to request input.
+ @param Response The pointer to Response, which will be populated upon return.
- @retval EFI_SUCCESS The operation was sucessful.
+ @retval EFI_SUCCESS The operation was successful.
@retval EFI_UNSUPPORTED The operation is not supported as requested.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
- @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@return other The operation failed.
**/
EFI_STATUS
@@ -1155,11 +1185,12 @@ ShellPromptForResponse (
@param Type What type of question is asked. This is used to filter the input
to prevent invalid answers to question.
- @param Prompt Pointer to string prompt to use to request input.
- @param Response Pointer to Response which will be populated upon return.
+ @param[in] HiiFormatStringId The format string Id for getting from Hii.
+ @param[in] HiiFormatHandle The format string Handle for getting from Hii.
+ @param Response The pointer to Response, which will be populated upon return.
- @retval EFI_SUCCESS the operation was sucessful.
- @return other the operation failed.
+ @retval EFI_SUCCESS The operation was sucessful.
+ @return other The operation failed.
@sa ShellPromptForResponse
**/
@@ -1172,5 +1203,39 @@ ShellPromptForResponseHii (
IN OUT VOID **Response
);
+/**
+ Function to determin if an entire string is a valid number.
+
+ If Hex it must be preceeded with a 0x or has ForceHex, set TRUE.
+
+ @param[in] String The string to evaluate.
+ @param[in] ForceHex TRUE - always assume hex.
+ @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going.
+
+ @retval TRUE It is all numeric (dec/hex) characters.
+ @retval FALSE There is a non-numeric character.
+**/
+BOOLEAN
+EFIAPI
+ShellIsHexOrDecimalNumber (
+ IN CONST CHAR16 *String,
+ IN CONST BOOLEAN ForceHex,
+ IN CONST BOOLEAN StopAtSpace
+ );
+
+/**
+ Function to determine if a given filename exists.
+
+ @param[in] Name Path to test.
+
+ @retval EFI_SUCCESS The Path represents a file.
+ @retval EFI_NOT_FOUND The Path does not represent a file.
+ @retval other The path failed to open.
+**/
+EFI_STATUS
+EFIAPI
+ShellFileExists(
+ IN CONST CHAR16 *Name
+ );
#endif // __SHELL_LIB__
diff --git a/ShellPkg/Include/Library/SortLib.h b/ShellPkg/Include/Library/SortLib.h
index c8b68d9381..c8a5ccf0f0 100644
--- a/ShellPkg/Include/Library/SortLib.h
+++ b/ShellPkg/Include/Library/SortLib.h
@@ -1,7 +1,7 @@
/** @file
Library used for sorting and comparison routines.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2010, 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
@@ -12,18 +12,18 @@
**/
-#if !defined(__SORT_LIB_H__)
+#ifndef __SORT_LIB_H__
#define __SORT_LIB_H__
/**
- Prototype for comparison function for any 2 element types.
+ Prototype for comparison function for any two element types.
- @param[in] Buffer1 Pointer to first buffer.
- @param[in] Buffer2 Pointer to second buffer.
+ @param[in] Buffer1 The pointer to first buffer.
+ @param[in] Buffer2 The pointer to second buffer.
@retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
+ @return <0 Buffer1 is less than Buffer2.
+ @return >0 Buffer1 is greater than Buffer2.
**/
typedef
INTN
@@ -40,15 +40,15 @@ INTN
If BufferToSort is NULL, then ASSERT.
If CompareFunction is NULL, then ASSERT.
- If Count is < 2 then perform no action.
- If Size is < 1 then perform no action.
+ If Count is < 2 , then perform no action.
+ If Size is < 1 , then perform no action.
- @param[in,out] BufferToSort On call a Buffer of (possibly sorted) elements
- on return a buffer of sorted elements.
- @param[in] Count The number of elements in the buffer to sort
- @param[in] ElementSize Size of an element in bytes.
+ @param[in,out] BufferToSort On call, a Buffer of (possibly sorted) elements;
+ on return, a buffer of sorted elements.
+ @param[in] Count The number of elements in the buffer to sort.
+ @param[in] ElementSize The size of an element in bytes.
@param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements.
+ of any two elements.
**/
VOID
EFIAPI
@@ -63,8 +63,8 @@ PerformQuickSort (
/**
Function to compare 2 device paths for use as CompareFunction.
- @param[in] Buffer1 Pointer to Device Path to compare.
- @param[in] Buffer2 Pointer to second DevicePath to compare.
+ @param[in] Buffer1 The pointer to Device Path to compare.
+ @param[in] Buffer2 The pointer to second DevicePath to compare.
@retval 0 Buffer1 equal to Buffer2.
@return < 0 Buffer1 is less than Buffer2.
@@ -80,8 +80,8 @@ DevicePathCompare (
/**
Function to compare 2 strings without regard to case of the characters.
- @param[in] Buffer1 Pointer to String to compare (CHAR16**).
- @param[in] Buffer2 Pointer to second String to compare (CHAR16**).
+ @param[in] Buffer1 The pointer to String to compare (CHAR16**).
+ @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
@retval 0 Buffer1 equal to Buffer2.
@return < 0 Buffer1 is less than Buffer2.
@@ -94,4 +94,21 @@ StringNoCaseCompare (
IN CONST VOID *Buffer2
);
+/**
+ Function to compare 2 strings.
+
+ @param[in] Buffer1 The pointer to String to compare (CHAR16**).
+ @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
+
+ @retval 0 Buffer1 equal to Buffer2.
+ @return < 0 Buffer1 is less than Buffer2.
+ @return > 0 Buffer1 is greater than Buffer2.
+**/
+INTN
+EFIAPI
+StringCompare (
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
+ );
+
#endif //__SORT_LIB_H__
diff --git a/ShellPkg/Include/Protocol/EfiShell.h b/ShellPkg/Include/Protocol/EfiShell.h
index 35a6e0a2f8..ce38e0e439 100644
--- a/ShellPkg/Include/Protocol/EfiShell.h
+++ b/ShellPkg/Include/Protocol/EfiShell.h
@@ -1,7 +1,7 @@
/** @file
EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2010, 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
@@ -15,7 +15,7 @@
#ifndef __EFI_SHELL_PROTOCOL__
#define __EFI_SHELL_PROTOCOL__
-#include <Protocol/SimpleFileSystem.h>
+#include <ShellBase.h>
#include <Guid/FileInfo.h>
#define EFI_SHELL_PROTOCOL_GUID \
@@ -26,12 +26,12 @@
// replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.
// they are identical outside of the name.
typedef struct {
- LIST_ENTRY Link; ///< Linked list members.
- EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
- CONST CHAR16 *FullName; ///< Fully qualified filename.
- CONST CHAR16 *FileName; ///< name of this file.
- EFI_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
- EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
+ LIST_ENTRY Link; ///< Linked list members.
+ EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
+ CONST CHAR16 *FullName; ///< Fully qualified filename.
+ CONST CHAR16 *FileName; ///< name of this file.
+ SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
+ EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
} EFI_SHELL_FILE_INFO;
/**
@@ -61,7 +61,7 @@ BOOLEAN
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_CLOSE_FILE)(
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -79,9 +79,9 @@ EFI_STATUS
already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.
@param[in] FileName Pointer to NULL-terminated file path.
- @param[in] FileAttribs The new file's attrbiutes. the different attributes are
+ @param[in] FileAttribs The new file's attrbiutes. The different attributes are
described in EFI_FILE_PROTOCOL.Open().
- @param[out] FileHandle On return, points to the created file handle or directory's handle
+ @param[out] FileHandle On return, points to the created file handle or directory's handle.
@retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@@ -103,9 +103,9 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_CREATE_FILE)(
- IN CONST CHAR16 *FileName,
- IN UINT64 FileAttribs,
- OUT EFI_FILE_HANDLE *FileHandle
+ IN CONST CHAR16 *FileName,
+ IN UINT64 FileAttribs,
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -123,7 +123,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_DELETE_FILE)(
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -194,10 +194,10 @@ VOID
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_EXECUTE) (
- IN EFI_HANDLE *ParentImageHandle,
- IN CHAR16 *CommandLine OPTIONAL,
- IN CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StatusCode OPTIONAL
+ IN EFI_HANDLE *ParentImageHandle,
+ IN CHAR16 *CommandLine OPTIONAL,
+ IN CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StatusCode OPTIONAL
);
/**
@@ -224,8 +224,8 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FIND_FILES)(
- IN CONST CHAR16 *FilePattern,
- OUT EFI_SHELL_FILE_INFO **FileList
+ IN CONST CHAR16 *FilePattern,
+ OUT EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -243,8 +243,8 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(
-IN EFI_FILE_HANDLE FileDirHandle,
-OUT EFI_SHELL_FILE_INFO **FileList
+IN SHELL_FILE_HANDLE FileDirHandle,
+OUT EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -265,7 +265,7 @@ OUT EFI_SHELL_FILE_INFO **FileList
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FLUSH_FILE)(
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -342,10 +342,10 @@ typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;
typedef
EFI_STATUS
(*EFI_SHELL_GET_DEVICE_NAME) (
- IN EFI_HANDLE DeviceHandle,
- IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
- IN CHAR8 *Language,
- OUT CHAR16 **BestDeviceName
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
+ IN CHAR8 *Language,
+ OUT CHAR16 **BestDeviceName
);
/**
@@ -427,7 +427,7 @@ CONST CHAR16 *
typedef
EFI_FILE_INFO *
(EFIAPI *EFI_SHELL_GET_FILE_INFO)(
- IN EFI_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -464,7 +464,7 @@ CHAR16 *
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_FILE_POSITION)(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Position
);
@@ -482,7 +482,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_FILE_SIZE)(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Size
);
@@ -629,7 +629,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (
IN CONST CHAR16 *FileName,
- OUT EFI_FILE_HANDLE *FileHandle,
+ OUT SHELL_FILE_HANDLE *FileHandle,
IN UINT64 OpenMode
);
@@ -676,7 +676,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_ROOT)(
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT EFI_FILE_HANDLE *FileHandle
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -698,7 +698,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(
IN EFI_HANDLE DeviceHandle,
- OUT EFI_FILE_HANDLE *FileHandle
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -723,7 +723,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_READ_FILE) (
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *ReadSize,
IN OUT VOID *Buffer
);
@@ -873,7 +873,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_FILE_INFO)(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN CONST EFI_FILE_INFO *FileInfo
);
@@ -895,7 +895,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_FILE_POSITION)(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN UINT64 Position
);
@@ -945,7 +945,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_WRITE_FILE)(
- IN EFI_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
);
diff --git a/ShellPkg/Include/Protocol/EfiShellEnvironment2.h b/ShellPkg/Include/Protocol/EfiShellEnvironment2.h
index 1c82853027..ad0b551b96 100644
--- a/ShellPkg/Include/Protocol/EfiShellEnvironment2.h
+++ b/ShellPkg/Include/Protocol/EfiShellEnvironment2.h
@@ -13,7 +13,7 @@
**/
-#if !defined (_SHELL_ENVIRONMENT_2_PROTOCOL_H_)
+#ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
#define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
#define DEFAULT_INIT_ROW 1
@@ -24,8 +24,8 @@
to a given location. The location is dependant on the implementation. This is
used when programatically adding shell commands.
- @param Handle The handle the protocol is on.
- @param Interface The interface to the protocol.
+ @param[in] Handle The handle the protocol is on.
+ @param[in] Interface The interface to the protocol.
**/
typedef
@@ -40,11 +40,11 @@ VOID
implementation. The specific command depends on the implementation. This is
used when programatically adding shell commands.
- @param ImageHandle The handle to the binary shell.
- @param SystemTable Pointer to the system table.
+ @param[in] ImageHandle The handle to the binary shell.
+ @param[in] SystemTable The pointer to the system table.
- @retval EFI_SUCCESS The command ran to completion
- @retval other An error ocurred. Any error is possible
+ @retval EFI_SUCCESS The command completed.
+ @retval other An error occurred. Any error is possible
depending on the implementation of the shell
command.
@@ -61,7 +61,7 @@ EFI_STATUS
This is used when programatically adding shell commands. Upon successful return
the memory allocated is up to the caller to free.
- @param Str Pointer to pointer to string to display for help.
+ @param[in,out] Str Pointer to pointer to string to display for help.
@retval EFI_SUCCESS The help string is in the parameter Str.
@@ -111,8 +111,8 @@ GUID for the shell environment2 extension (main GUID above).
0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
}
-#define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2
-#define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2
+#define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
+#define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
/**
Execute a command line.
@@ -121,13 +121,13 @@ GUID for the shell environment2 extension (main GUID above).
parsing any requires scripts, and if DebugOutput is TRUE printing errors
encountered directly to the screen.
- @param ParentImageHandle Handle of image executing this operation.
- @param CommandLine The string command line to execute.
- @param DebugOutput TRUE indicates that errors should be printed directly.
+ @param[in] ParentImageHandle Handle of the image executing this operation.
+ @param[in] CommandLine The string command line to execute.
+ @param[in] DebugOutput TRUE indicates that errors should be printed directly.
FALSE supresses error messages.
@retval EFI_SUCCESS The command line executed and completed.
- @retval EFI_ABORTED The operation did not complete due to abort.
+ @retval EFI_ABORTED The operation aborted.
@retval EFI_INVALID_PARAMETER A parameter did not have a valid value.
@retval EFI_OUT_OF_RESOURCES A required memory allocation failed.
@@ -144,7 +144,7 @@ EFI_STATUS
/**
This function returns a shell environment variable value.
- @param Name Pointer to the string with the shell environment
+ @param[in] Name The pointer to the string with the shell environment
variable name.
@retval NULL The shell environment variable's value could not be found.
@@ -160,7 +160,7 @@ CHAR16 *
/**
This function returns a shell environment map value.
- @param Name Pointer to the string with the shell environment
+ @param[in] Name The pointer to the string with the shell environment
map name.
@retval NULL The shell environment map's value could not be found.
@@ -179,9 +179,9 @@ CHAR16 *
This will allocate all required memory, put the new command on the command
list in the correct location.
- @param Handler The handler function to call when the command gets called.
- @param Cmd The command name.
- @param GetLineHelp Function to call of get help for this command.
+ @param[in] Handler The handler function to call when the command gets called.
+ @param[in] Cmd The command name.
+ @param[in] GetLineHelp The function to call of type "get help" for this command.
@retval EFI_SUCCESS The command is now part of the command list.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@@ -203,12 +203,12 @@ EFI_STATUS
This will get the current protocol info and add the new info or update existing info
and then resave the info.
- @param Protocol Pointer to the protocol's GUID.
- @param DumpToken The function pointer to dump token function or
+ @param[in] Protocol The pointer to the protocol's GUID.
+ @param[in] DumpToken The function pointer to dump token function or
NULL.
- @param DumpInfo The function pointer to dump infomation function
+ @param[in] DumpInfo The function pointer to dump infomation function
or NULL.
- @param IdString The english name of the protocol.
+ @param[in] IdString The English name of the protocol.
**/
typedef
VOID
@@ -226,11 +226,11 @@ VOID
found it will return the name of that protocol. If no name is found and
GenId is TRUE it will generate ths string.
- @param Protocol The GUID of the protocol to look for.
- @param GenId Whether to generate a name string if its not found.
+ @param[in] Protocol The GUID of the protocol to look for.
+ @param[in] GenId Whether to generate a name string if it is not found.
- @return !NULL The Name of the protocol.
- @retval NULL The Name was not found and GenId was not TRUE.
+ @return !NULL The Name of the protocol.
+ @retval NULL The Name was not found, and GenId was not TRUE.
**/
typedef
CHAR16*
@@ -246,10 +246,10 @@ CHAR16*
If DeviceName is specified, then return the current shell directory on that
device. If DeviceName is NULL, then return the current directory on the
current device. The caller us responsible to free the returned string when
- no londer required.
+ no longer required.
- @param DeviceName The name of the device to get the current
- directory on or NULL for current device.
+ @param[in] DeviceName The name of the device to get the current
+ directory on, or NULL for current device.
@return String array with the current directory on the current or specified device.
@@ -270,11 +270,11 @@ CHAR16*
The memory allocated by the callee for this list is freed by making a call to
SHELLENV_FREE_FILE_LIST.
- @param Arg Pointer Path to files to open.
- @param ListHead Pointer to allocated and initialized list head
- upon which to append all the opened file structures.
+ @param[in] Arg The pointer Path to files to open.
+ @param[in,out] ListHead The pointer to the allocated and initialized list head
+ upon which to append all opened file structures.
- @retval EFI_SUCCESS 1 or more files was opened and a struct of each file's
+ @retval EFI_SUCCESS One or more files was opened and a struct of each file's
information was appended to ListHead.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_NOT_FOUND No matching files could be found.
@@ -289,9 +289,9 @@ EFI_STATUS
/**
This frees all of the nodes under the ListHead, but not ListHead itself.
- @param ListHead Pointer to list to free all nodes of.
+ @param[in,out] ListHead Pointer to list to free all nodes of.
- @retval EFI_SUCCESS Always returned.
+ @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
**/
typedef
EFI_STATUS
@@ -307,10 +307,10 @@ EFI_STATUS
EFI_SHELL_INTERFACE protocol. It is the caller's responsibility to free the
memory.
- @param ImageHandle The handle which will use the new ShellInterface
+ @param[in] ImageHandle The handle which will use the new ShellInterface
protocol.
- @return the newly allocated shell interface protocol.
+ @return The newly allocated shell interface protocol.
**/
typedef
@@ -332,12 +332,12 @@ EFI_SHELL_INTERFACE*
typedef
BOOLEAN
(EFIAPI *SHELLENV_BATCH_IS_ACTIVE) (
- IN VOID
+ VOID
);
/**
This is an internal shell function to free any and all allocated resources.
- This should be called just closing the shell.
+ This should be called immediately prior to closing the shell.
**/
typedef
VOID
@@ -349,12 +349,12 @@ VOID
This function enables the page break mode.
This mode causes the output to pause after each complete screen to enable a
- user to more easily read it. If AutoWrap is TRUE then rows with too many
- characters will be chopped and divided into 2 rows. If FALSE then rows with
+ user to more easily read it. If AutoWrap is TRUE, then rows with too many
+ characters will be chopped and divided into 2 rows. If FALSE, then rows with
too many characters may not be fully visible to the user on the screen.
- @param StartRow The row number to start this on.
- @param AutoWrap Whether to auto wrap rows that are too long.
+ @param[in] StartRow The row number to start this on.
+ @param[in] AutoWrap Whether to auto wrap rows that are too long.
**/
typedef
VOID
@@ -366,13 +366,13 @@ VOID
/**
This function disables the page break mode.
- Tisabling this causes the output to print out exactly as coded with no breaks
+ Disabling this causes the output to print out exactly as coded, with no breaks
for readability.
**/
typedef
VOID
(EFIAPI *SHELLENV_DISABLE_PAGE_BREAK) (
- IN VOID
+ VOID
);
/**
@@ -384,7 +384,7 @@ VOID
typedef
BOOLEAN
(EFIAPI *SHELLENV_GET_PAGE_BREAK) (
- IN VOID
+ VOID
);
/**
@@ -395,7 +395,7 @@ BOOLEAN
#define EFI_OUTPUT_PAUSE 0x00000002
#define EFI_EXECUTION_BREAK 0x00000004
- @param KeyFilter The new key filter to use.
+ @param[in] KeyFilter The new key filter to use.
**/
typedef
VOID
@@ -411,12 +411,12 @@ VOID
#define EFI_OUTPUT_PAUSE 0x00000002
#define EFI_EXECUTION_BREAK 0x00000004
- @retval the current filter mask.
+ @retval The current filter mask.
**/
typedef
UINT32
(EFIAPI *SHELLENV_GET_KEY_FILTER) (
- IN VOID
+ VOID
);
/**
@@ -425,33 +425,33 @@ UINT32
This is used to inform a shell application that a break condition has been
initiated. Long loops should check this to prevent delays to the break.
- @retval TRUE A break has been signaled. the application
+ @retval TRUE A break has been signaled. The application
should exit with EFI_ABORTED as soon as possible.
@retval FALSE Continue as normal.
**/
typedef
BOOLEAN
(EFIAPI *SHELLENV_GET_EXECUTION_BREAK) (
- IN VOID
+ VOID
);
/**
- This is an internal-shell function used to increment the shell nesting level.
+ This is an internal shell function used to increment the shell nesting level.
**/
typedef
VOID
(EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL) (
- IN VOID
+ VOID
);
/**
- This is an internal-shell function used to decrement the shell nesting level.
+ This is an internal shell function used to decrement the shell nesting level.
**/
typedef
VOID
(EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL) (
- IN VOID
+ VOID
);
/**
@@ -464,7 +464,7 @@ VOID
typedef
BOOLEAN
(EFIAPI *SHELLENV_IS_ROOT_SHELL) (
- IN VOID
+ VOID
);
/**
@@ -473,11 +473,11 @@ BOOLEAN
This is an internal shell function to handle shell cascading. It restores the
original set of console protocols.
- @param ConInHandle The handle of ConIn.
- @param ConIn Pointer to the location to return the pointer to
+ @param[in] ConInHandle The handle of ConIn.
+ @param[in,out] ConIn The pointer to the location to return the pointer to
the original console input.
- @param ConOutHandle The handle of ConOut
- @param ConOut Pointer to the location to return the pointer to
+ @param[in] ConOutHandle The handle of ConOut
+ @param[in,out] ConOut The pointer to the location to return the pointer to
the original console output.
**/
typedef
@@ -507,12 +507,12 @@ VOID
This is an internal shell function to enumerate the handle database.
This function gets the next handle in the handle database. If no handles are
- found EFI_NOT_FOUND is returned. If the previous Handle was the last handle
+ found, EFI_NOT_FOUND is returned. If the previous Handle was the last handle,
it is set to NULL before returning.
This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
- @param Handle Pointer to pointer to Handle. Will be set
+ @param[in,out] Handle The pointer to pointer to Handle. It is set
on a sucessful return.
@retval EFI_SUCCESS The next handle in the handle database is *Handle.
@@ -533,10 +533,10 @@ EFI_STATUS
This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
- @param SkipNum how many handles to skip
+ @param[in] SkipNum How many handles to skip
- @retval EFI_SUCCESS the next handle in the handle database is *Handle
- @retval EFI_ACCESS_DENIED there are not SkipNum handles left in the database
+ @retval EFI_SUCCESS The next handle in the handle database is *Handle
+ @retval EFI_ACCESS_DENIED There are not SkipNum handles left in the database
**/
typedef
EFI_STATUS
@@ -552,9 +552,9 @@ EFI_STATUS
This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
- @param EnumIndex Where to start.
+ @param[in] EnumIndex Where to start.
- @return the number of handles either read out or skipped before this reset.
+ @return The number of handles either read out or skipped before this reset.
**/
typedef
UINTN
@@ -568,7 +568,7 @@ UINTN
This must be called after INIT_HANDLE_ENUMERATOR.
This function releases all memory and resources associated with the handle database.
- Tfter this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will
+ After this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will
function properly.
**/
typedef
@@ -584,7 +584,7 @@ VOID
This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
- @return the number of handles in the handle database.
+ @return The number of handles in the handle database.
**/
typedef
UINTN
@@ -596,12 +596,12 @@ UINTN
Handle Enumerator structure.
**/
typedef struct {
- INIT_HANDLE_ENUMERATOR Init; ///< Pointer to INIT_HANDLE_ENUMERATOR function.
- NEXT_HANDLE Next; ///< Pointer to NEXT_HANDLE function.
- SKIP_HANDLE Skip; ///< Pointer to SKIP_HANDLE function.
- RESET_HANDLE_ENUMERATOR Reset; ///< Pointer to RESET_HANDLE_ENUMERATOR function.
- CLOSE_HANDLE_ENUMERATOR Close; ///< Pointer to CLOSE_HANDLE_ENUMERATOR function.
- GET_NUM GetNum; ///< Pointer to GET_NUM function.
+ INIT_HANDLE_ENUMERATOR Init; ///< The pointer to INIT_HANDLE_ENUMERATOR function.
+ NEXT_HANDLE Next; ///< The pointer to NEXT_HANDLE function.
+ SKIP_HANDLE Skip; ///< The pointer to SKIP_HANDLE function.
+ RESET_HANDLE_ENUMERATOR Reset; ///< The pointer to RESET_HANDLE_ENUMERATOR function.
+ CLOSE_HANDLE_ENUMERATOR Close; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
+ GET_NUM GetNum; ///< The pointer to GET_NUM function.
} HANDLE_ENUMERATOR;
/**
@@ -614,18 +614,18 @@ typedef struct {
**/
typedef struct {
UINTN Signature; ///< PROTOCOL_INFO_SIGNATURE.
- LIST_ENTRY Link; ///< Standard lined list helper member.
+ LIST_ENTRY Link; ///< Standard linked list helper member.
//
// The parsing info for the protocol.
//
- EFI_GUID ProtocolId; ///< GUID for the protocol.
- CHAR16 *IdString; ///< Name of the protocol.
- SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< Pointer to DumpToken function for the protocol.
- SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< Pointer to DumpInfo function for the protocol.
+ EFI_GUID ProtocolId; ///< The GUID for the protocol.
+ CHAR16 *IdString; ///< The name of the protocol.
+ SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< The pointer to DumpToken function for the protocol.
+ SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< The pointer to DumpInfo function for the protocol.
//
// Patabase info on which handles are supporting this protocol.
//
- UINTN NoHandles; ///< How many handles produce this protocol.
+ UINTN NoHandles; ///< The number of handles producing this protocol.
EFI_HANDLE *Handles; ///< The array of handles.
} PROTOCOL_INFO;
@@ -649,14 +649,14 @@ VOID
/**
This function is an internal shell function for enumeration of protocols.
- This functiol will return the next protocol in the list. If this is called
- immediately after initialization it will return the first. If this is called
- immediately after reset it will return the protocol first again.
+ This function returns the next protocol on the list. If this is called
+ immediately after initialization, it will return the first protocol on the list.
+ If this is called immediately after reset, it will return the first protocol again.
This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
called after INIT_PROTOCOL_INFO_ENUMERATOR.
- @param ProtocolInfo Pointer to pointer to protocol information structure.
+ @param[in,out] ProtocolInfo The pointer to pointer to protocol information structure.
@retval EFI_SUCCESS The next protocol's information was sucessfully returned.
@retval NULL There are no more protocols.
@@ -675,7 +675,7 @@ EFI_STATUS
This function does nothing and always returns EFI_SUCCESS.
- @retval EFI_SUCCESS always returned (see above).
+ @retval EFI_SUCCESS Always returned (see above).
**/
typedef
EFI_STATUS
@@ -718,11 +718,11 @@ VOID
Protocol enumerator structure of function pointers.
**/
typedef struct {
- INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< Pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
- NEXT_PROTOCOL_INFO Next; ///< Pointer to NEXT_PROTOCOL_INFO function.
- SKIP_PROTOCOL_INFO Skip; ///< Pointer to SKIP_PROTOCOL_INFO function.
- RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< Pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
- CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< Pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
+ INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
+ NEXT_PROTOCOL_INFO Next; ///< The pointer to NEXT_PROTOCOL_INFO function.
+ SKIP_PROTOCOL_INFO Skip; ///< The pointer to SKIP_PROTOCOL_INFO function.
+ RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
+ CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
} PROTOCOL_INFO_ENUMERATOR;
/**
@@ -742,42 +742,42 @@ typedef struct {
whether the handle in question produced either EFI_DRIVER_DIAGNOSTICS_PROTOCOL or
EFI_DRIVER_DIAGNOSTICS2_PROTOCOL.
- Upon sucessful return the memory for *BestDeviceName is up to the caller to free.
+ Upon successful return, the memory for *BestDeviceName is up to the caller to free.
- @param DeviceHandle The device handle whose name is desired.
- @param UseComponentName Whether to use the ComponentName protocol at all.
- @param UseDevicePath Whether to use the DevicePath protocol at all.
- @param Language Pointer to language string to use.
- @param BestDeviceName Pointer to pointer to string allocated with the name.
- @param ConfigurationStatus Pointer to status for opening a Configuration protocol.
- @param DiagnosticsStatus Pointer to status for opening a Diagnostics protocol.
- @param Display Whether to Print this out to default Print location.
- @param Indent How many characters to indent the printing.
+ @param[in] DeviceHandle The device handle whose name is desired.
+ @param[in] UseComponentName Whether to use the ComponentName protocol at all.
+ @param[in] UseDevicePath Whether to use the DevicePath protocol at all.
+ @param[in] Language The pointer to the language string to use.
+ @param[in,out] BestDeviceName The pointer to pointer to string allocated with the name.
+ @param[out] ConfigurationStatus The pointer to status for opening a Configuration protocol.
+ @param[out] DiagnosticsStatus The pointer to status for opening a Diagnostics protocol.
+ @param[in] Display Whether to Print this out to default Print location.
+ @param[in] Indent How many characters to indent the printing.
@retval EFI_SUCCESS This function always returns EFI_SUCCESS.
**/
typedef
EFI_STATUS
(EFIAPI *GET_DEVICE_NAME) (
- EFI_HANDLE DeviceHandle,
- BOOLEAN UseComponentName,
- BOOLEAN UseDevicePath,
- CHAR8 *Language,
- CHAR16 **BestDeviceName,
- EFI_STATUS *ConfigurationStatus,
- EFI_STATUS *DiagnosticsStatus,
- BOOLEAN Display,
- UINTN Indent
+ IN EFI_HANDLE DeviceHandle,
+ IN BOOLEAN UseComponentName,
+ IN BOOLEAN UseDevicePath,
+ IN CHAR8 *Language,
+ IN OUT CHAR16 **BestDeviceName,
+ OUT EFI_STATUS *ConfigurationStatus,
+ OUT EFI_STATUS *DiagnosticsStatus,
+ IN BOOLEAN Display,
+ IN UINTN Indent
);
-#define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< string for lowest version this shell supports
-#define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< string for highest version this shell supports
+#define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.
+#define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.
/**
This function gets the shell mode as stored in the shell environment
"efishellmode". It will not fail.
- @param Mode Returns a string representing one of the
+ @param[out] Mode Returns a string representing one of the
2 supported modes of the shell.
@retval EFI_SUCCESS This function always returns success.
@@ -798,6 +798,8 @@ EFI_STATUS
If anything prevents the complete conversion free any allocated memory and
return NULL.
+ @param[in] Path The path to convert.
+
@retval !NULL A pointer to the callee allocated Device Path.
@retval NULL The operation could not be completed.
**/
@@ -820,9 +822,9 @@ EFI_DEVICE_PATH_PROTOCOL*
This function will use the internal lock to prevent changes to the map during
the lookup operation.
- @param DevPath The device path to search for a name for.
- @param ConsistMapping What state to verify map flag VAR_ID_CONSIST.
- @param Name On sucessful return the name of that device path.
+ @param[in] DevPath The device path to search for a name for.
+ @param[in] ConsistMapping What state to verify map flag VAR_ID_CONSIST.
+ @param[out] Name On sucessful return the name of that device path.
@retval EFI_SUCCESS The DevPath was found and the name returned
in Name.
@@ -847,11 +849,11 @@ EFI_STATUS
The memory allocated by the callee for this list is freed by making a call to
SHELLENV_FREE_FILE_LIST.
- @param Arg Pointer Path to files to open.
- @param ListHead Pointer to allocated and initialized list head
+ @param[in] Arg The pointer to the path of the files to be opened.
+ @param[in,out] ListHead The pointer to allocated and initialized list head
upon which to append all the opened file structures.
- @retval EFI_SUCCESS 1 or more files was opened and a struct of each file's
+ @retval EFI_SUCCESS One or more files was opened and a struct of each file's
information was appended to ListHead.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_NOT_FOUND No matching files could be found.
@@ -872,7 +874,7 @@ EFI_STATUS
files in the list of returned files. Any file listed twice will have one of its
instances removed.
- @param ListHead Pointer to linked list head that was returned from
+ @param[in] ListHead The pointer to linked list head that was returned from
SHELLENV_FILE_META_ARG_NO_WILDCARD or
SHELLENV_FILE_META_ARG.
@@ -888,22 +890,22 @@ EFI_STATUS
/**
Converts a File System map name to a device path.
- if DevPath is NULL, then ASSERT().
+ If DevPath is NULL, then ASSERT().
This function looks through the shell environment map for a map whose Name
- matches the Name parameter. If one is found the device path pointer is
+ matches the Name parameter. If one is found, the device path pointer is
updated to point to that file systems device path. The caller should not
free the memory from that device path.
This function will use the internal lock to prevent changes to the map during
the lookup operation.
- @param Name Pointer to NULL terminated UNICODE string of the
+ @param[in] Name The pointer to the NULL terminated UNICODE string of the
file system name.
- @param DevPath Pointer to pointer to DevicePath. only valid on
- OUT if sucessful.
+ @param[out] DevPath The pointer to pointer to DevicePath. Only valid on
+ successful return.
- @retval EFI_SUCCESS The conversion was successful and the device
+ @retval EFI_SUCCESS The conversion was successful, and the device
path was returned.
@retval EFI_NOT_FOUND The file system could not be found in the map.
**/
diff --git a/ShellPkg/Include/Protocol/EfiShellInterface.h b/ShellPkg/Include/Protocol/EfiShellInterface.h
index 4e6e641ff7..6a34c60b07 100644
--- a/ShellPkg/Include/Protocol/EfiShellInterface.h
+++ b/ShellPkg/Include/Protocol/EfiShellInterface.h
@@ -4,9 +4,7 @@
Shell Interface - additional information (over image_info) provided
to an application started by the shell.
- ConIo - provides a file style interface to the console. Note that the
- ConOut & ConIn interfaces in the system table will work as well, and both
- all will be redirected to a file if needed on a command line
+ ConIo provides a file-style interface to the console.
The shell interface's and data (including ConIo) are only valid during
the applications Entry Point. Once the application returns from it's
@@ -23,16 +21,18 @@
**/
-#if !defined(_SHELLINTERFACE_H_)
+#ifndef _SHELLINTERFACE_H_
#define _SHELLINTERFACE_H_
+#include <Protocol/SimpleFileSystem.h>
+
#define SHELL_INTERFACE_PROTOCOL_GUID \
{ \
0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
}
///
-/// bit definitions for EFI_SHELL_ARG_INFO
+/// Bit definitions for EFI_SHELL_ARG_INFO
///
typedef enum {
ARG_NO_ATTRIB = 0x0,
@@ -43,48 +43,48 @@ typedef enum {
} EFI_SHELL_ARG_INFO_TYPES;
///
-/// attributes for an argument.
+/// Attributes for an argument.
///
typedef struct _EFI_SHELL_ARG_INFO {
UINT32 Attributes;
} EFI_SHELL_ARG_INFO;
///
-/// This protocol provides access to additional information about a shell app.
+/// This protocol provides access to additional information about a shell application.
///
typedef struct {
///
- /// Handle back to original image handle & image info
+ /// Handle back to original image handle & image information.
///
EFI_HANDLE ImageHandle;
EFI_LOADED_IMAGE_PROTOCOL *Info;
///
- /// Parsed arg list converted more C like format
+ /// Parsed arg list converted more C-like format.
///
CHAR16 **Argv;
UINTN Argc;
///
- /// Storage for file redirection args after parsing
+ /// Storage for file redirection args after parsing.
///
CHAR16 **RedirArgv;
UINTN RedirArgc;
///
- /// A file style handle for console io
+ /// A file style handle for console io.
///
- EFI_FILE_HANDLE StdIn;
- EFI_FILE_HANDLE StdOut;
- EFI_FILE_HANDLE StdErr;
+ EFI_FILE_PROTOCOL *StdIn;
+ EFI_FILE_PROTOCOL *StdOut;
+ EFI_FILE_PROTOCOL *StdErr;
///
- /// list of attributes for each argument
+ /// List of attributes for each argument.
///
EFI_SHELL_ARG_INFO *ArgInfo;
///
- /// whether we are echoing
+ /// Whether we are echoing.
///
BOOLEAN EchoOn;
} EFI_SHELL_INTERFACE;
diff --git a/ShellPkg/Include/Protocol/EfiShellParameters.h b/ShellPkg/Include/Protocol/EfiShellParameters.h
index 32d8379d3b..7082d421be 100644
--- a/ShellPkg/Include/Protocol/EfiShellParameters.h
+++ b/ShellPkg/Include/Protocol/EfiShellParameters.h
@@ -12,6 +12,8 @@
**/
+#include <ShellBase.h>
+
#ifndef __EFI_SHELL_PARAMETERS_PROTOCOL__
#define __EFI_SHELL_PARAMETERS_PROTOCOL__
@@ -36,21 +38,21 @@ typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {
///
/// The file handle for the standard input for this executable. This may be different
- /// from the ConInHandle in the EFI_SYSTEM_TABLE.
+ /// from the ConInHandle in EFI_SYSTEM_TABLE.
///
- EFI_FILE_HANDLE StdIn;
+ SHELL_FILE_HANDLE StdIn;
///
/// The file handle for the standard output for this executable. This may be different
- /// from the ConOutHandle in the EFI_SYSTEM_TABLE.
+ /// from the ConOutHandle in EFI_SYSTEM_TABLE.
///
- EFI_FILE_HANDLE StdOut;
+ SHELL_FILE_HANDLE StdOut;
///
/// The file handle for the standard error output for this executable. This may be
- /// different from the StdErrHandle in the EFI_SYSTEM_TABLE.
+ /// different from the StdErrHandle in EFI_SYSTEM_TABLE.
///
- EFI_FILE_HANDLE StdErr;
+ SHELL_FILE_HANDLE StdErr;
} EFI_SHELL_PARAMETERS_PROTOCOL;
extern EFI_GUID gEfiShellParametersProtocolGuid;
diff --git a/ShellPkg/Include/ShellBase.h b/ShellPkg/Include/ShellBase.h
index 3aee67442f..6b88cbc431 100644
--- a/ShellPkg/Include/ShellBase.h
+++ b/ShellPkg/Include/ShellBase.h
@@ -1,7 +1,7 @@
/** @file
Root include file for Shell Package modules that utilize the SHELL_RETURN type
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2010, 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
@@ -12,9 +12,20 @@
**/
-#if !defined(__SHELL_BASE__)
+#ifndef __SHELL_BASE__
#define __SHELL_BASE__
+typedef VOID *SHELL_FILE_HANDLE;
+
+#ifndef SHELL_FREE_NON_NULL
+#define SHELL_FREE_NON_NULL(Pointer) \
+ do { \
+ if (Pointer != NULL) { \
+ FreePool(Pointer); \
+ } \
+ } while(FALSE)
+#endif //SHELL_FREE_NON_NULL
+
typedef enum {
///
/// The operation completed successfully.
@@ -60,7 +71,7 @@ SHELL_NOT_READY = 6,
SHELL_DEVICE_ERROR = 7,
///
-/// The device can not be written to.
+/// The device cannot be written to.
///
SHELL_WRITE_PROTECTED = 8,