+ VOID\r
+ );\r
+\r
+/**\r
+ Print at a specific location on the screen.\r
+\r
+ This function will move the cursor to a given screen location and print the specified string.\r
+\r
+ If -1 is specified for either the Row or Col the current screen location for BOTH\r
+ will be used.\r
+\r
+ If either Row or Col is out of range for the current console, then ASSERT.\r
+ If Format is NULL, then ASSERT.\r
+\r
+ In addition to the standard %-based flags as supported by UefiLib Print() this supports\r
+ the following additional flags:\r
+ %N - Set output attribute to normal\r
+ %H - Set output attribute to highlight\r
+ %E - Set output attribute to error\r
+ %B - Set output attribute to blue color\r
+ %V - Set output attribute to green color\r
+\r
+ Note: The background color is controlled by the shell command cls.\r
+\r
+ @param[in] Col The column to print at.\r
+ @param[in] Row The row to print at.\r
+ @param[in] Format The format string.\r
+ @param[in] ... The variable argument list.\r
+\r
+ @return EFI_SUCCESS The printing was successful.\r
+ @return EFI_DEVICE_ERROR The console device reported an error.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellPrintEx(\r
+ IN INT32 Col OPTIONAL,\r
+ IN INT32 Row OPTIONAL,\r
+ IN CONST CHAR16 *Format,\r
+ ...\r
+ );\r
+\r
+/**\r
+ Print at a specific location on the screen.\r
+\r
+ This function will move the cursor to a given screen location and print the specified string.\r
+\r
+ If -1 is specified for either the Row or Col the current screen location for BOTH\r
+ will be used.\r
+\r
+ If either Row or Col is out of range for the current console, then ASSERT.\r
+ If Format is NULL, then ASSERT.\r
+\r
+ In addition to the standard %-based flags as supported by UefiLib Print() this supports\r
+ the following additional flags:\r
+ %N - Set output attribute to normal.\r
+ %H - Set output attribute to highlight.\r
+ %E - Set output attribute to error.\r
+ %B - Set output attribute to blue color.\r
+ %V - Set output attribute to green color.\r
+\r
+ Note: The background color is controlled by the shell command cls.\r
+\r
+ @param[in] Col The column to print at.\r
+ @param[in] Row The row to print at.\r
+ @param[in] Language The language of the string to retrieve. If this parameter\r
+ is NULL, then the current platform language is used.\r
+ @param[in] HiiFormatStringId The format string Id for getting from Hii.\r
+ @param[in] HiiFormatHandle The format string Handle for getting from Hii.\r
+ @param[in] ... The variable argument list.\r
+\r
+ @return EFI_SUCCESS The printing was successful.\r
+ @return EFI_DEVICE_ERROR The console device reported an error.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellPrintHiiEx(\r
+ IN INT32 Col OPTIONAL,\r
+ IN INT32 Row OPTIONAL,\r
+ IN CONST CHAR8 *Language OPTIONAL,\r
+ IN CONST EFI_STRING_ID HiiFormatStringId,\r
+ IN CONST EFI_HANDLE HiiFormatHandle,\r
+ ...\r
+ );\r
+\r
+/**\r
+ Function to determine if a given filename represents a directory.\r
+\r
+ If DirName is NULL, then ASSERT.\r
+\r
+ @param[in] DirName Path to directory to test.\r
+\r
+ @retval EFI_SUCCESS The Path represents a directory.\r
+ @retval EFI_NOT_FOUND The Path does not represent a directory.\r
+ @retval other The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellIsDirectory(\r
+ IN CONST CHAR16 *DirName\r
+ );\r
+\r
+/**\r
+ Function to determine if a given filename represents a file.\r
+\r
+ This will search the CWD only.\r
+\r
+ If Name is NULL, then ASSERT.\r
+\r
+ @param[in] Name Path to file to test.\r
+\r
+ @retval EFI_SUCCESS The Path represents a file.\r
+ @retval EFI_NOT_FOUND The Path does not represent a file.\r
+ @retval other The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellIsFile(\r
+ IN CONST CHAR16 *Name\r
+ );\r
+\r
+/**\r
+ Function to determine if a given filename represents a file.\r
+\r
+ This will search the CWD and then the Path.\r
+\r
+ If Name is NULL, then ASSERT.\r
+\r
+ @param[in] Name Path to file to test.\r
+\r
+ @retval EFI_SUCCESS The Path represents a file.\r
+ @retval EFI_NOT_FOUND The Path does not represent a file.\r
+ @retval other The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellIsFileInPath(\r
+ IN CONST CHAR16 *Name\r
+ );\r
+\r
+/**\r
+ Function to determine whether a string is decimal or hex representation of a number\r
+ and return the number converted from the string.\r
+\r
+ Note: this function cannot be used when (UINTN)(-1), (0xFFFFFFFF) may be a valid\r
+ result. Use ShellConvertStringToUint64 instead.\r
+\r
+ @param[in] String String representation of a number.\r
+\r
+ @return The unsigned integer result of the conversion.\r
+ @retval (UINTN)(-1) An error occured.\r
+**/\r
+UINTN\r
+EFIAPI\r
+ShellStrToUintn(\r
+ IN CONST CHAR16 *String\r
+ );\r
+\r
+/**\r
+ Function return the number converted from a hex representation of a number.\r
+\r
+ Note: this function cannot be used when (UINTN)(-1), (0xFFFFFFFF) may be a valid\r
+ result. Use ShellConvertStringToUint64 instead.\r
+\r
+ @param[in] String String representation of a number.\r
+\r
+ @return The unsigned integer result of the conversion.\r
+ @retval (UINTN)(-1) An error occured.\r
+**/\r
+UINTN\r
+EFIAPI\r
+ShellHexStrToUintn(\r
+ IN CONST CHAR16 *String\r
+ );\r
+\r
+/**\r
+ Safely append with automatic string resizing given length of Destination and\r
+ desired length of copy from Source.\r
+\r
+ Append the first D characters of Source to the end of Destination, where D is\r
+ the lesser of Count and the StrLen() of Source. If appending those D characters\r
+ will fit within Destination (whose Size is given as CurrentSize) and\r
+ still leave room for a NULL terminator, then those characters are appended,\r
+ starting at the original terminating NULL of Destination, and a new terminating\r
+ NULL is appended.\r
+\r
+ If appending D characters onto Destination will result in a overflow of the size\r
+ given in CurrentSize the string will be grown such that the copy can be performed\r
+ and CurrentSize will be updated to the new size.\r
+\r
+ If Source is NULL, there is nothing to append, so return the current buffer in\r
+ Destination.\r
+\r
+ If Destination is NULL, then ASSERT().\r
+ If Destination's current length (including NULL terminator) is already more than\r
+ CurrentSize, then ASSERT().\r
+\r
+ @param[in, out] Destination The String to append onto.\r
+ @param[in, out] CurrentSize On call, the number of bytes in Destination. On\r
+ return, possibly the new size (still in bytes). If NULL,\r
+ then allocate whatever is needed.\r
+ @param[in] Source The String to append from.\r
+ @param[in] Count The maximum number of characters to append. If 0, then\r
+ all are appended.\r
+\r
+ @return The Destination after appending the Source.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+StrnCatGrow (\r
+ IN OUT CHAR16 **Destination,\r
+ IN OUT UINTN *CurrentSize,\r
+ IN CONST CHAR16 *Source,\r
+ IN UINTN Count\r
+ );\r
+\r
+/**\r
+ This is a find and replace function. Upon successful return the NewString is a copy of\r
+ SourceString with each instance of FindTarget replaced with ReplaceWith.\r
+\r
+ If SourceString and NewString overlap the behavior is undefined.\r
+\r
+ If the string would grow bigger than NewSize it will halt and return error.\r
+\r
+ @param[in] SourceString The string with source buffer.\r
+ @param[in, out] NewString The string with resultant buffer.\r
+ @param[in] NewSize The size in bytes of NewString.\r
+ @param[in] FindTarget The string to look for.\r
+ @param[in] ReplaceWith The string to replace FindTarget with.\r
+ @param[in] SkipPreCarrot If TRUE will skip a FindTarget that has a '^'\r
+ immediately before it.\r
+ @param[in] ParameterReplacing If TRUE will add "" around items with spaces.\r
+\r
+ @retval EFI_INVALID_PARAMETER SourceString was NULL.\r
+ @retval EFI_INVALID_PARAMETER NewString was NULL.\r
+ @retval EFI_INVALID_PARAMETER FindTarget was NULL.\r
+ @retval EFI_INVALID_PARAMETER ReplaceWith was NULL.\r
+ @retval EFI_INVALID_PARAMETER FindTarget had length < 1.\r
+ @retval EFI_INVALID_PARAMETER SourceString had length < 1.\r
+ @retval EFI_BUFFER_TOO_SMALL NewSize was less than the minimum size to hold\r
+ the new string (truncation occurred).\r
+ @retval EFI_SUCCESS The string was successfully copied with replacement.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellCopySearchAndReplace(\r
+ IN CHAR16 CONST *SourceString,\r
+ IN OUT CHAR16 *NewString,\r
+ IN UINTN NewSize,\r
+ IN CONST CHAR16 *FindTarget,\r
+ IN CONST CHAR16 *ReplaceWith,\r
+ IN CONST BOOLEAN SkipPreCarrot,\r
+ IN CONST BOOLEAN ParameterReplacing\r
+ );\r
+\r
+/**\r
+ Check if a Unicode character is a hexadecimal character.\r
+\r
+ This internal function checks if a Unicode character is a\r
+ numeric character. The valid hexadecimal characters are\r
+ L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
+\r
+\r
+ @param Char The character to check against.\r
+\r
+ @retval TRUE The Char is a hexadecmial character.\r
+ @retval FALSE The Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsHexaDecimalDigitCharacter (\r
+ IN CHAR16 Char\r
+ );\r
+\r
+/**\r
+ Check if a Unicode character is a decimal character.\r
+\r
+ This internal function checks if a Unicode character is a\r
+ decimal character. The valid characters are\r
+ L'0' to L'9'.\r
+\r
+\r
+ @param Char The character to check against.\r
+\r
+ @retval TRUE The Char is a hexadecmial character.\r
+ @retval FALSE The Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsDecimalDigitCharacter (\r
+ IN CHAR16 Char\r
+ );\r
+\r
+///\r
+/// What type of answer is requested.\r
+///\r
+typedef enum {\r
+ ShellPromptResponseTypeYesNo,\r
+ ShellPromptResponseTypeYesNoCancel,\r
+ ShellPromptResponseTypeFreeform,\r
+ ShellPromptResponseTypeQuitContinue,\r
+ ShellPromptResponseTypeYesNoAllCancel,\r
+ ShellPromptResponseTypeEnterContinue,\r
+ ShellPromptResponseTypeAnyKeyContinue,\r
+ ShellPromptResponseTypeMax\r
+} SHELL_PROMPT_REQUEST_TYPE;\r
+\r
+///\r
+/// What answer was given.\r
+///\r
+typedef enum {\r
+ ShellPromptResponseYes,\r
+ ShellPromptResponseNo,\r
+ ShellPromptResponseCancel,\r
+ ShellPromptResponseQuit,\r
+ ShellPromptResponseContinue,\r
+ ShellPromptResponseAll,\r
+ ShellPromptResponseMax\r
+} SHELL_PROMPT_RESPONSE;\r
+\r
+/**\r
+ Prompt the user and return the resultant answer to the requestor.\r
+\r
+ This function will display the requested question on the shell prompt and then\r
+ wait for an appropriate answer to be input from the console.\r
+\r
+ If the SHELL_PROMPT_REQUEST_TYPE is SHELL_PROMPT_REQUEST_TYPE_YESNO, ShellPromptResponseTypeQuitContinue\r
+ or SHELL_PROMPT_REQUEST_TYPE_YESNOCANCEL then *Response is of type SHELL_PROMPT_RESPONSE.\r
+\r
+ If the SHELL_PROMPT_REQUEST_TYPE is ShellPromptResponseTypeFreeform then *Response is of type\r
+ CHAR16*.\r
+\r
+ In either case *Response must be callee freed if Response was not NULL;\r
+\r
+ @param Type What type of question is asked. This is used to filter the input\r
+ to prevent invalid answers to question.\r
+ @param Prompt The pointer to a string prompt used to request input.\r
+ @param Response The pointer to Response, which will be populated upon return.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_UNSUPPORTED The operation is not supported as requested.\r
+ @retval EFI_INVALID_PARAMETER A parameter was invalid.\r
+ @return other The operation failed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellPromptForResponse (\r
+ IN SHELL_PROMPT_REQUEST_TYPE Type,\r
+ IN CHAR16 *Prompt OPTIONAL,\r
+ IN OUT VOID **Response OPTIONAL\r
+ );\r
+\r
+/**\r
+ Prompt the user and return the resultant answer to the requestor.\r
+\r
+ This function is the same as ShellPromptForResponse, except that the prompt is\r
+ automatically pulled from HII.\r
+\r
+ @param[in] Type What type of question is asked. This is used to filter the input\r
+ to prevent invalid answers to question.\r
+ @param[in] HiiFormatStringId The format string Id for getting from Hii.\r
+ @param[in] HiiFormatHandle The format string Handle for getting from Hii.\r
+ @param[in, out] Response The pointer to Response, which will be populated upon return.\r
+\r
+ @retval EFI_SUCCESS The operation was sucessful.\r
+ @return other The operation failed.\r
+\r
+ @sa ShellPromptForResponse\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellPromptForResponseHii (\r
+ IN SHELL_PROMPT_REQUEST_TYPE Type,\r
+ IN CONST EFI_STRING_ID HiiFormatStringId,\r
+ IN CONST EFI_HANDLE HiiFormatHandle,\r
+ IN OUT VOID **Response\r
+ );\r
+\r
+/**\r
+ Function to determin if an entire string is a valid number.\r
+\r
+ If Hex it must be preceeded with a 0x, 0X, or has ForceHex set TRUE.\r
+\r
+ @param[in] String The string to evaluate.\r
+ @param[in] ForceHex TRUE - always assume hex.\r
+ @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to keep going.\r
+\r
+ @retval TRUE It is all numeric (dec/hex) characters.\r
+ @retval FALSE There is a non-numeric character.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ShellIsHexOrDecimalNumber (\r
+ IN CONST CHAR16 *String,\r
+ IN CONST BOOLEAN ForceHex,\r
+ IN CONST BOOLEAN StopAtSpace\r
+ );\r
+\r
+/**\r
+ Function to verify and convert a string to its numerical 64 bit representation.\r
+\r
+ If Hex it must be preceeded with a 0x, 0X, or has ForceHex set TRUE.\r
+\r
+ @param[in] String The string to evaluate.\r
+ @param[out] Value Upon a successful return the value of the conversion.\r
+ @param[in] ForceHex TRUE - always assume hex.\r
+ @param[in] StopAtSpace TRUE to halt upon finding a space, FALSE to\r
+ process the entire String.\r
+\r
+ @retval EFI_SUCCESS The conversion was successful.\r
+ @retval EFI_INVALID_PARAMETER String contained an invalid character.\r
+ @retval EFI_NOT_FOUND String was a number, but Value was NULL.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellConvertStringToUint64(\r
+ IN CONST CHAR16 *String,\r
+ OUT UINT64 *Value,\r
+ IN CONST BOOLEAN ForceHex,\r
+ IN CONST BOOLEAN StopAtSpace\r
+ );\r
+\r
+/**\r
+ Function to determine if a given filename exists.\r
+\r
+ @param[in] Name Path to test.\r
+\r
+ @retval EFI_SUCCESS The Path represents a file.\r
+ @retval EFI_NOT_FOUND The Path does not represent a file.\r
+ @retval other The path failed to open.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellFileExists(\r
+ IN CONST CHAR16 *Name\r
+ );\r
+\r
+/**\r
+ Function to read a single line from a SHELL_FILE_HANDLE. The \n is not included in the returned\r
+ buffer. The returned buffer must be callee freed.\r
+\r
+ If the position upon start is 0, then the Ascii Boolean will be set. This should be\r
+ maintained and not changed for all operations with the same file.\r
+\r
+ @param[in] Handle SHELL_FILE_HANDLE to read from.\r
+ @param[in, out] Ascii Boolean value for indicating whether the file is\r
+ Ascii (TRUE) or UCS2 (FALSE).\r
+\r
+ @return The line of text from the file.\r
+\r
+ @sa ShellFileHandleReadLine\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+ShellFileHandleReturnLine(\r
+ IN SHELL_FILE_HANDLE Handle,\r
+ IN OUT BOOLEAN *Ascii\r
+ );\r
+\r
+/**\r
+ Function to read a single line (up to but not including the \n) from a SHELL_FILE_HANDLE.\r
+\r
+ If the position upon start is 0, then the Ascii Boolean will be set. This should be\r
+ maintained and not changed for all operations with the same file.\r
+\r
+ @param[in] Handle SHELL_FILE_HANDLE to read from.\r
+ @param[in, out] Buffer The pointer to buffer to read into.\r
+ @param[in, out] Size The pointer to number of bytes in Buffer.\r
+ @param[in] Truncate If the buffer is large enough, this has no effect.\r
+ If the buffer is is too small and Truncate is TRUE,\r
+ the line will be truncated.\r
+ If the buffer is is too small and Truncate is FALSE,\r
+ then no read will occur.\r
+\r
+ @param[in, out] Ascii Boolean value for indicating whether the file is\r
+ Ascii (TRUE) or UCS2 (FALSE).\r
+\r
+ @retval EFI_SUCCESS The operation was successful. The line is stored in\r
+ Buffer.\r
+ @retval EFI_END_OF_FILE There are no more lines in the file.\r
+ @retval EFI_INVALID_PARAMETER Handle was NULL.\r
+ @retval EFI_INVALID_PARAMETER Size was NULL.\r
+ @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.\r
+ Size was updated to the minimum space required.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellFileHandleReadLine(\r
+ IN SHELL_FILE_HANDLE Handle,\r
+ IN OUT CHAR16 *Buffer,\r
+ IN OUT UINTN *Size,\r
+ IN BOOLEAN Truncate,\r
+ IN OUT BOOLEAN *Ascii\r
+ );\r
+\r
+/**\r
+ Function to delete a file by name\r
+ \r
+ @param[in] FileName Pointer to file name to delete.\r
+ \r
+ @retval EFI_SUCCESS the file was deleted sucessfully\r
+ @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not\r
+ deleted\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
+ @retval EFI_NOT_FOUND The specified file could not be found on the\r
+ device or the file system could not be found\r
+ on the device.\r
+ @retval EFI_NO_MEDIA The device has no medium.\r
+ @retval EFI_MEDIA_CHANGED The device has a different medium in it or the\r
+ medium is no longer supported.\r
+ @retval EFI_DEVICE_ERROR The device reported an error.\r
+ @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
+ @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r
+ @retval EFI_ACCESS_DENIED The file was opened read only.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the\r
+ file.\r
+ @retval other The file failed to open\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellDeleteFileByName(\r
+ IN CONST CHAR16 *FileName\r
+ );\r
+\r
+/**\r
+ Function to print help file / man page content in the spec from the UEFI Shell protocol GetHelpText function.\r
+\r
+ @param[in] CommandToGetHelpOn Pointer to a string containing the command name of help file to be printed.\r
+ @param[in] SectionToGetHelpOn Pointer to the section specifier(s).\r
+ @param[in] PrintCommandText If TRUE, prints the command followed by the help content, otherwise prints \r
+ the help content only.\r
+ @retval EFI_DEVICE_ERROR The help data format was incorrect.\r
+ @retval EFI_NOT_FOUND The help data could not be found.\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellPrintHelp (\r
+ IN CONST CHAR16 *CommandToGetHelpOn,\r
+ IN CONST CHAR16 *SectionToGetHelpOn,\r
+ IN BOOLEAN PrintCommandText\r