2 Provides interface to shell functionality for shell commands and applications.
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #if !defined(__SHELL_LIB__)
18 #include <Protocol/SimpleFileSystem.h>
19 #include <Protocol/EfiShell.h>
22 This function will retrieve the information about the file for the handle
23 specified and store it in allocated pool memory.
25 This function allocates a buffer to store the file's information. It is the
26 caller's responsibility to free the buffer
28 @param FileHandle The file handle of the file for which information is
31 @retval NULL information could not be retrieved.
33 @return the information about the file
38 IN EFI_FILE_HANDLE FileHandle
42 This function will set the information about the file for the opened handle
45 @param FileHandle The file handle of the file for which information
48 @param FileInfo The infotmation to set.
50 @retval EFI_SUCCESS The information was set.
51 @retval EFI_UNSUPPORTED The InformationType is not known.
52 @retval EFI_NO_MEDIA The device has no medium.
53 @retval EFI_DEVICE_ERROR The device reported an error.
54 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
55 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
56 @retval EFI_ACCESS_DENIED The file was opened read only.
57 @retval EFI_VOLUME_FULL The volume is full.
62 IN EFI_FILE_HANDLE FileHandle
,
63 IN EFI_FILE_INFO
*FileInfo
67 This function will open a file or directory referenced by DevicePath.
69 This function opens a file with the open mode according to the file path. The
70 Attributes is valid only for EFI_FILE_MODE_CREATE.
72 @param FilePath On input the device path to the file. On output
73 the remaining device path.
74 @param DeviceHandle pointer to the system device handle.
75 @param FileHandle pointer to the file handle.
76 @param OpenMode the mode to open the file with.
77 @param Attributes the file's file attributes.
79 @retval EFI_SUCCESS The information was set.
80 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
81 @retval EFI_UNSUPPORTED Could not open the file path.
82 @retval EFI_NOT_FOUND The specified file could not be found on the
83 device or the file system could not be found on
85 @retval EFI_NO_MEDIA The device has no medium.
86 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
87 medium is no longer supported.
88 @retval EFI_DEVICE_ERROR The device reported an error.
89 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
90 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
91 @retval EFI_ACCESS_DENIED The file was opened read only.
92 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
94 @retval EFI_VOLUME_FULL The volume is full.
98 ShellOpenFileByDevicePath(
99 IN OUT EFI_DEVICE_PATH_PROTOCOL
**FilePath
,
100 OUT EFI_HANDLE
*DeviceHandle
,
101 OUT EFI_FILE_HANDLE
*FileHandle
,
107 This function will open a file or directory referenced by filename.
109 If return is EFI_SUCCESS, the Filehandle is the opened file's handle;
110 otherwise, the Filehandle is NULL. The Attributes is valid only for
111 EFI_FILE_MODE_CREATE.
113 @param FileName pointer to file name
114 @param FileHandle pointer to the file handle.
115 @param OpenMode the mode to open the file with.
116 @param Attributes the file's file attributes.
118 @retval EFI_SUCCESS The information was set.
119 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
120 @retval EFI_UNSUPPORTED Could not open the file path.
121 @retval EFI_NOT_FOUND The specified file could not be found on the
122 device or the file system could not be found
124 @retval EFI_NO_MEDIA The device has no medium.
125 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
126 medium is no longer supported.
127 @retval EFI_DEVICE_ERROR The device reported an error.
128 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
129 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
130 @retval EFI_ACCESS_DENIED The file was opened read only.
131 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
133 @retval EFI_VOLUME_FULL The volume is full.
138 IN CONST CHAR16
*FilePath
,
139 OUT EFI_FILE_HANDLE
*FileHandle
,
145 This function create a directory
147 If return is EFI_SUCCESS, the Filehandle is the opened directory's handle;
148 otherwise, the Filehandle is NULL. If the directory already existed, this
149 function opens the existing directory.
151 @param DirectoryName Pointer to Directory name.
152 @param FileHandle Pointer to the file handle.
154 @retval EFI_SUCCESS The information was set.
155 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
156 @retval EFI_UNSUPPORTED Could not open the file path.
157 @retval EFI_NOT_FOUND The specified file could not be found on the
158 device or the file system could not be found
160 @retval EFI_NO_MEDIA The device has no medium.
161 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
162 medium is no longer supported.
163 @retval EFI_DEVICE_ERROR The device reported an error.
164 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
165 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
166 @retval EFI_ACCESS_DENIED The file was opened read only.
167 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
169 @retval EFI_VOLUME_FULL The volume is full.
173 ShellCreateDirectory(
174 IN CONST CHAR16
*DirectoryName
,
175 OUT EFI_FILE_HANDLE
*FileHandle
179 This function reads information from an opened file.
181 If FileHandle is not a directory, the function reads the requested number of
182 bytes from the file at the file's current position and returns them in Buffer.
183 If the read goes beyond the end of the file, the read length is truncated to the
184 end of the file. The file's current position is increased by the number of bytes
185 returned. If FileHandle is a directory, the function reads the directory entry
186 at the file's current position and returns the entry in Buffer. If the Buffer
187 is not large enough to hold the current directory entry, then
188 EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated.
189 BufferSize is set to be the size of the buffer needed to read the entry. On
190 success, the current position is updated to the next directory entry. If there
191 are no more directory entries, the read returns a zero-length buffer.
192 EFI_FILE_INFO is the structure returned as the directory entry.
194 @param FileHandle The opened file handle.
195 @param ReadSize On input the size of buffer in bytes. On return
196 the number of bytes written.
197 @param Buffer The buffer to put read data into.
199 @retval EFI_SUCCESS Data was read.
200 @retval EFI_NO_MEDIA The device has no media.
201 @retval EFI_DEVICE_ERROR The device reported an error.
202 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
203 @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
210 IN EFI_FILE_HANDLE FileHandle
,
211 IN OUT UINTN
*ReadSize
,
216 Write data to a file.
218 This function writes the specified number of bytes to the file at the current
219 file position. The current file position is advanced the actual number of bytes
220 written, which is returned in BufferSize. Partial writes only occur when there
221 has been a data error during the write attempt (such as "volume space full").
222 The file is automatically grown to hold the data if required. Direct writes to
223 opened directories are not supported.
225 @param FileHandle The opened file for writing.
227 @param BufferSize On input the number of bytes in Buffer. On output
228 the number of bytes written.
230 @param Buffer The buffer containing data to write is stored.
232 @retval EFI_SUCCESS Data was written.
233 @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
234 @retval EFI_NO_MEDIA The device has no media.
235 @retval EFI_DEVICE_ERROR The device reported an error.
236 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
237 @retval EFI_WRITE_PROTECTED The device is write-protected.
238 @retval EFI_ACCESS_DENIED The file was open for read only.
239 @retval EFI_VOLUME_FULL The volume is full.
244 IN EFI_FILE_HANDLE FileHandle
,
245 IN OUT UINTN
*BufferSize
,
250 Close an open file handle.
252 This function closes a specified file handle. All "dirty" cached file data is
253 flushed to the device, and the file is closed. In all cases the handle is
256 @param FileHandle The file handle to close.
258 @retval EFI_SUCCESS The file handle was closed sucessfully.
259 @retval INVALID_PARAMETER One of the parameters has an invalid value.
264 IN EFI_FILE_HANDLE
*FileHandle
268 Delete a file and close the handle
270 This function closes and deletes a file. In all cases the file handle is closed.
271 If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is
272 returned, but the handle is still closed.
274 @param FileHandle The file handle to delete.
276 @retval EFI_SUCCESS The file was closed sucessfully.
277 @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not
279 @retval INVALID_PARAMETER One of the parameters has an invalid value.
284 IN EFI_FILE_HANDLE
*FileHandle
288 Set the current position in a file.
290 This function sets the current file position for the handle to the position
291 supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only
292 absolute positioning is supported, and seeking past the end of the file is
293 allowed (a subsequent write would grow the file). Seeking to position
294 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.
295 If FileHandle is a directory, the only position that may be set is zero. This
296 has the effect of starting the read process of the directory entries over.
298 @param FileHandle The file handle on which the position is being set
300 @param Position Byte position from begining of file
302 @retval EFI_SUCCESS Operation completed sucessfully.
303 @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on
305 @retval INVALID_PARAMETER One of the parameters has an invalid value.
309 ShellSetFilePosition (
310 IN EFI_FILE_HANDLE FileHandle
,
315 Gets a file's current position
317 This function retrieves the current file position for the file handle. For
318 directories, the current file position has no meaning outside of the file
319 system driver and as such the operation is not supported. An error is returned
320 if FileHandle is a directory.
322 @param FileHandle The open file handle on which to get the position.
323 @param Position Byte position from begining of file.
325 @retval EFI_SUCCESS the operation completed sucessfully.
326 @retval INVALID_PARAMETER One of the parameters has an invalid value.
327 @retval EFI_UNSUPPORTED the request is not valid on directories.
331 ShellGetFilePosition (
332 IN EFI_FILE_HANDLE FileHandle
,
337 Flushes data on a file
339 This function flushes all modified data associated with a file to a device.
341 @param FileHandle The file handle on which to flush data
343 @retval EFI_SUCCESS The data was flushed.
344 @retval EFI_NO_MEDIA The device has no media.
345 @retval EFI_DEVICE_ERROR The device reported an error.
346 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
347 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
348 @retval EFI_ACCESS_DENIED The file was opened for read only.
353 IN EFI_FILE_HANDLE FileHandle
357 Retrieves the first file from a directory
359 This function takes an open directory handle and gets the first file
360 in the directory's info. Caller can use ShellFindNextFile() to get
363 Caller must use FreePool on *Buffer opon completion of all file searching.
365 @param DirHandle The file handle of the directory to search
366 @param Buffer Pointer to pointer to buffer for file's information
368 @retval EFI_SUCCESS Found the first file.
369 @retval EFI_NOT_FOUND Cannot find the directory.
370 @retval EFI_NO_MEDIA The device has no media.
371 @retval EFI_DEVICE_ERROR The device reported an error.
372 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
373 @return ShellReadFile
378 IN EFI_FILE_HANDLE DirHandle
,
379 OUT EFI_FILE_INFO
**Buffer
383 Retrieves the next file in a directory.
385 To use this function, caller must call the ShellFindFirstFile() to get the
386 first file, and then use this function get other files. This function can be
387 called for several times to get each file's information in the directory. If
388 the call of ShellFindNextFile() got the last file in the directory, the next
389 call of this function has no file to get. *NoFile will be set to TRUE and the
390 data in Buffer is meaningless.
392 @param DirHandle the file handle of the directory
393 @param Buffer pointer to buffer for file's information
394 @param NoFile pointer to boolean when last file is found
396 @retval EFI_SUCCESS Found the next file.
397 @retval EFI_NO_MEDIA The device has no media.
398 @retval EFI_DEVICE_ERROR The device reported an error.
399 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
404 IN EFI_FILE_HANDLE DirHandle
,
405 OUT EFI_FILE_INFO
*Buffer
,
410 Retrieve the size of a file.
412 This function extracts the file size info from the FileHandle's EFI_FILE_INFO
415 @param FileHandle The file handle from which size is retrieved.
416 @param Size Pointer to size.
418 @retval EFI_SUCCESS The operation was completed sucessfully.
419 @retval EFI_DEVICE_ERROR cannot access the file.
424 IN EFI_FILE_HANDLE FileHandle
,
429 Retrieves the status of the break execution flag
431 this function is useful to check whether the application is being asked to halt by the shell.
433 @retval TRUE the execution break is enabled
434 @retval FALSE the execution break is not enabled
438 ShellGetExecutionBreakFlag(
443 Return the value of an environment variable.
445 This function gets the value of the environment variable set by the
446 ShellSetEnvironmentVariable function.
448 @param EnvKey The key name of the environment variable.
450 @retval NULL the named environment variable does not exist.
451 @return != NULL pointer to the value of the environment variable.
455 ShellGetEnvironmentVariable (
456 IN CONST CHAR16
*EnvKey
460 set the value of an environment variable
462 This function changes the current value of the specified environment variable. If the
463 environment variable exists and the Value is an empty string, then the environment
464 variable is deleted. If the environment variable exists and the Value is not an empty
465 string, then the value of the environment variable is changed. If the environment
466 variable does not exist and the Value is an empty string, there is no action. If the
467 environment variable does not exist and the Value is a non-empty string, then the
468 environment variable is created and assigned the specified value.
470 This is not supported pre-UEFI Shell 2.0.
472 @param EnvKey The key name of the environment variable.
473 @param EnvVal The Value of the environment variable
474 @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
476 @retval EFI_SUCCESS the operation was completed sucessfully
477 @retval EFI_UNSUPPORTED This operation is not allowed in pre UEFI 2.0 Shell environments
481 ShellSetEnvironmentVariable (
482 IN CONST CHAR16
*EnvKey
,
483 IN CONST CHAR16
*EnvVal
,
488 Cause the shell to parse and execute a command line.
490 This function creates a nested instance of the shell and executes the specified
491 command (CommandLine) with the specified environment (Environment). Upon return,
492 the status code returned by the specified command is placed in StatusCode.
493 If Environment is NULL, then the current environment is used and all changes made
494 by the commands executed will be reflected in the current environment. If the
495 Environment is non-NULL, then the changes made will be discarded.
496 The CommandLine is executed from the current working directory on the current
499 EnvironmentVariables and Status are only supported for UEFI Shell 2.0.
500 Output is only supported for pre-UEFI Shell 2.0
502 @param ImageHandle Parent image that is starting the operation
503 @param CommandLine pointer to null terminated command line.
504 @param Output true to display debug output. false to hide it.
505 @param EnvironmentVariables optional pointer to array of environment variables
506 in the form "x=y". if NULL current set is used.
507 @param Status the status of the run command line.
509 @retval EFI_SUCCESS the operation completed sucessfully. Status
510 contains the status code returned.
511 @retval EFI_INVALID_PARAMETER a parameter contains an invalid value
512 @retval EFI_OUT_OF_RESOURCES out of resources
513 @retval EFI_UNSUPPORTED the operation is not allowed.
518 IN EFI_HANDLE
*ParentHandle
,
519 IN CHAR16
*CommandLine
,
521 IN CHAR16
**EnvironmentVariables
,
522 OUT EFI_STATUS
*Status
526 Retreives the current directory path
528 If the DeviceName is NULL, it returns the current device's current directory
529 name. If the DeviceName is not NULL, it returns the current directory name
532 @param DeviceName the name of the drive to get directory on
534 @retval NULL the directory does not exist
535 @return != NULL the directory
540 IN CHAR16
*DeviceName OPTIONAL
544 Sets (enabled or disabled) the page break mode.
546 When page break mode is enabled the screen will stop scrolling
547 and wait for operator input before scrolling a subsequent screen.
549 @param CurrentState TRUE to enable and FALSE to disable
553 ShellSetPageBreakMode (
554 IN BOOLEAN CurrentState
558 Opens a group of files based on a path.
560 This function uses the Arg to open all the matching files. Each matched
561 file has a SHELL_FILE_ARG structure to record the file information. These
562 structures are placed on the list ListHead. Users can get the SHELL_FILE_ARG
563 structures from ListHead to access each file. This function supports wildcards
564 and will process '?' and '*' as such. The list must be freed with a call to
565 ShellCloseFileMetaArg().
567 If you are NOT appending to an existing list *ListHead must be NULL. If
568 *ListHead is NULL then it must be callee freed.
570 @param Arg Pointer to path string.
571 @param OpenMode Mode to open files with.
572 @param ListHead Head of linked list of results.
574 @retval EFI_SUCCESS The operation was sucessful and the list head
575 contains the list of opened files.
576 @return != EFI_SUCCESS The operation failed.
578 @sa InternalShellConvertFileListType
582 ShellOpenFileMetaArg (
585 IN OUT EFI_SHELL_FILE_INFO
**ListHead
589 Free the linked list returned from ShellOpenFileMetaArg
591 @param ListHead the pointer to free
593 @retval EFI_SUCCESS the operation was sucessful
594 @retval EFI_INVALID_PARAMETER A parameter was invalid
598 ShellCloseFileMetaArg (
599 IN OUT EFI_SHELL_FILE_INFO
**ListHead
603 Find a file by searching the CWD and then the path.
605 if FileName is NULL then ASSERT.
607 if the return value is not NULL then the memory must be caller freed.
609 @param FileName Filename string.
611 @retval NULL the file was not found
612 @return !NULL the path to the file.
617 IN CONST CHAR16
*FileName
621 TypeFlag
= 0, /// a flag that is present or not present only. (IE "-a")
622 TypeValue
, /// a flag that has some data following it with a space (IE "-a 1")
623 TypePosition
, /// some data that did not follow a parameter (IE "filename.txt")
624 TypeStart
, /// a flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...
625 TypeDoubleValue
, /// a flag that has 2 space seperated value data following it. (IE "-a 1 2")
626 TypeMaxValue
, /// a flag followed by all the command line data before the next flag.
636 /// Helper structure for no parameters (besides -? and -b)
637 extern SHELL_PARAM_ITEM EmptyParamList
[];
640 Checks the command line arguments passed against the list of valid ones.
641 Optionally removes NULL values first.
643 If no initialization is required, then return RETURN_SUCCESS.
645 @param CheckList Pointer to list of parameters to check.
646 @param CheckPackage Package of checked values.
647 @param ProblemParam Pptional pointer to pointer to unicode string for
648 the paramater that caused failure.
649 @param AutoPageBreak Will automatically set PageBreakEnabled.
651 @retval EFI_SUCCESS The operation completed sucessfully.
652 @retval EFI_OUT_OF_RESOURCES A memory allocation failed
653 @retval EFI_INVALID_PARAMETER A parameter was invalid
654 @retval EFI_VOLUME_CORRUPTED the command line was corrupt. an argument was
655 duplicated. the duplicated command line argument
656 was returned in ProblemParam if provided.
657 @retval EFI_DEVICE_ERROR The commands contained 2 opposing arguments. one
658 of the command line arguments was returned in
659 ProblemParam if provided.
660 @retval EFI_NOT_FOUND A argument required a value that was missing.
661 the invalid command line argument was returned in
662 ProblemParam if provided.
666 ShellCommandLineParseEx (
667 IN CONST SHELL_PARAM_ITEM
*CheckList
,
668 OUT LIST_ENTRY
**CheckPackage
,
669 OUT CHAR16
**ProblemParam OPTIONAL
,
670 IN BOOLEAN AutoPageBreak
,
671 IN BOOLEAN AlwaysAllowNumbers
674 // make it easy to upgrade from older versions of the shell library.
675 #define ShellCommandLineParse(CheckList,CheckPackage,ProblemParam,AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
678 Frees shell variable list that was returned from ShellCommandLineParse.
680 This function will free all the memory that was used for the CheckPackage
681 list of postprocessed shell arguments.
683 this function has no return value.
685 if CheckPackage is NULL, then return
687 @param CheckPackage the list to de-allocate
691 ShellCommandLineFreeVarList (
692 IN LIST_ENTRY
*CheckPackage
696 Checks for presence of a flag parameter
698 flag arguments are in the form of "-<Key>" or "/<Key>", but do not have a value following the key
700 if CheckPackage is NULL then return FALSE.
701 if KeyString is NULL then ASSERT()
703 @param CheckPackage The package of parsed command line arguments
704 @param KeyString the Key of the command line argument to check for
706 @retval TRUE the flag is on the command line
707 @retval FALSE the flag is not on the command line
711 ShellCommandLineGetFlag (
712 IN CONST LIST_ENTRY
*CheckPackage
,
717 returns value from command line argument
719 value parameters are in the form of "-<Key> value" or "/<Key> value"
721 if CheckPackage is NULL, then return NULL;
723 @param CheckPackage The package of parsed command line arguments
724 @param KeyString the Key of the command line argument to check for
726 @retval NULL the flag is not on the command line
727 @return !=NULL pointer to unicode string of the value
731 ShellCommandLineGetValue (
732 IN CONST LIST_ENTRY
*CheckPackage
,
737 returns raw value from command line argument
739 raw value parameters are in the form of "value" in a specific position in the list
741 if CheckPackage is NULL, then return NULL;
743 @param CheckPackage The package of parsed command line arguments
744 @param Position the position of the value
746 @retval NULL the flag is not on the command line
747 @return !=NULL pointer to unicode string of the value
751 ShellCommandLineGetRawValue (
752 IN CONST LIST_ENTRY
*CheckPackage
,
757 returns the number of command line value parameters that were parsed.
759 this will not include flags.
761 @retval (UINTN)-1 No parsing has ocurred
762 @return other The number of value parameters found
766 ShellCommandLineGetCount(
771 This function causes the shell library to initialize itself. If the shell library
772 is already initialized it will de-initialize all the current protocol poitners and
773 re-populate them again.
775 When the library is used with PcdShellLibAutoInitialize set to true this function
776 will return EFI_SUCCESS and perform no actions.
778 This function is intended for internal access for shell commands only.
780 @retval EFI_SUCCESS the initialization was complete sucessfully
790 Print at a specific location on the screen.
792 This function will move the cursor to a given screen location, print the specified string,
793 and return the cursor to the original locaiton.
795 If -1 is specified for either the Row or Col the current screen location for BOTH
796 will be used and the cursor's position will not be moved back to an original location.
798 if either Row or Col is out of range for the current console, then ASSERT
799 if Format is NULL, then ASSERT
801 In addition to the standard %-based flags as supported by UefiLib Print() this supports
802 the following additional flags:
803 %N - Set output attribute to normal
804 %H - Set output attribute to highlight
805 %E - Set output attribute to error
806 %B - Set output attribute to blue color
807 %V - Set output attribute to green color
809 Note: The background color is controlled by the shell command cls.
811 @param[in] Row the row to print at
812 @param[in] Col the column to print at
813 @param[in] Format the format string
815 @return the number of characters printed to the screen
821 IN INT32 Col OPTIONAL
,
822 IN INT32 Row OPTIONAL
,
823 IN CONST CHAR16
*Format
,
828 Print at a specific location on the screen.
830 This function will move the cursor to a given screen location, print the specified string,
831 and return the cursor to the original locaiton.
833 If -1 is specified for either the Row or Col the current screen location for BOTH
834 will be used and the cursor's position will not be moved back to an original location.
836 if either Row or Col is out of range for the current console, then ASSERT
837 if Format is NULL, then ASSERT
839 In addition to the standard %-based flags as supported by UefiLib Print() this supports
840 the following additional flags:
841 %N - Set output attribute to normal
842 %H - Set output attribute to highlight
843 %E - Set output attribute to error
844 %B - Set output attribute to blue color
845 %V - Set output attribute to green color
847 Note: The background color is controlled by the shell command cls.
849 @param[in] Row the row to print at
850 @param[in] Col the column to print at
851 @param[in] HiiFormatStringId the format string Id for getting from Hii
852 @param[in] HiiFormatHandle the format string Handle for getting from Hii
854 @return the number of characters printed to the screen
859 IN INT32 Col OPTIONAL
,
860 IN INT32 Row OPTIONAL
,
861 IN CONST EFI_STRING_ID HiiFormatStringId
,
862 IN CONST EFI_HANDLE HiiFormatHandle
,
867 Function to determine if a given filename represents a file or a directory.
869 @param[in] DirName Path to directory to test.
871 @retval EFI_SUCCESS The Path represents a directory
872 @retval EFI_NOT_FOUND The Path does not represent a directory
873 @return other The path failed to open
878 IN CONST CHAR16
*DirName
882 Function to determine whether a string is decimal or hex representation of a number
883 and return the number converted from the string.
885 @param[in] String String representation of a number
887 @retval all the number
892 IN CONST CHAR16
*String
896 Safely append with automatic string resizing given length of Destination and
897 desired length of copy from Source.
899 append the first D characters of Source to the end of Destination, where D is
900 the lesser of Count and the StrLen() of Source. If appending those D characters
901 will fit within Destination (whose Size is given as CurrentSize) and
902 still leave room for a null terminator, then those characters are appended,
903 starting at the original terminating null of Destination, and a new terminating
906 If appending D characters onto Destination will result in a overflow of the size
907 given in CurrentSize the string will be grown such that the copy can be performed
908 and CurrentSize will be updated to the new size.
910 If Source is NULL, there is nothing to append, just return the current buffer in
913 if Destination is NULL, then ASSERT()
914 if Destination's current length (including NULL terminator) is already more then
915 CurrentSize, then ASSERT()
917 @param[in,out] Destination The String to append onto
918 @param[in,out] CurrentSize on call the number of bytes in Destination. On
919 return possibly the new size (still in bytes). if NULL
920 then allocate whatever is needed.
921 @param[in] Source The String to append from
922 @param[in] Count Maximum number of characters to append. if 0 then
925 @return Destination return the resultant string.
930 IN OUT CHAR16
**Destination
,
931 IN OUT UINTN
*CurrentSize
,
932 IN CONST CHAR16
*Source
,
936 #endif // __SHELL_LIB__