summaryrefslogtreecommitdiff
path: root/ShellPkg/Include/Library
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Include/Library')
-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
6 files changed, 1512 insertions, 305 deletions
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__