TianoCore EDK2 master
Loading...
Searching...
No Matches
ShellLib.h
Go to the documentation of this file.
1
10#ifndef __SHELL_LIB__
11#define __SHELL_LIB__
12
13#include <Uefi.h>
14#include <Guid/FileInfo.h>
19#include <Protocol/Shell.h>
21
22#define SHELL_FREE_NON_NULL(Pointer) \
23 do { \
24 if ((Pointer) != NULL) { \
25 FreePool((Pointer)); \
26 (Pointer) = NULL; \
27 } \
28 } while(FALSE)
29
30extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
31extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
32
61CHAR16 *
62EFIAPI
64 IN CONST CHAR16 *Path
65 );
66
82EFIAPI
84 IN SHELL_FILE_HANDLE FileHandle
85 );
86
107EFIAPI
109 IN SHELL_FILE_HANDLE FileHandle,
111 );
112
143EFIAPI
146 OUT SHELL_FILE_HANDLE *FileHandle,
147 IN UINT64 OpenMode,
148 IN UINT64 Attributes
149 );
150
181EFIAPI
183 IN CONST CHAR16 *FileName,
184 OUT SHELL_FILE_HANDLE *FileHandle,
185 IN UINT64 OpenMode,
186 IN UINT64 Attributes
187 );
188
217EFIAPI
219 IN CONST CHAR16 *DirectoryName,
220 OUT SHELL_FILE_HANDLE *FileHandle
221 );
222
253EFIAPI
255 IN SHELL_FILE_HANDLE FileHandle,
256 IN OUT UINTN *ReadSize,
257 OUT VOID *Buffer
258 );
259
287EFIAPI
289 IN SHELL_FILE_HANDLE FileHandle,
290 IN OUT UINTN *BufferSize,
291 IN VOID *Buffer
292 );
293
307EFIAPI
309 IN SHELL_FILE_HANDLE *FileHandle
310 );
311
327EFIAPI
329 IN SHELL_FILE_HANDLE *FileHandle
330 );
331
353EFIAPI
355 IN SHELL_FILE_HANDLE FileHandle,
356 IN UINT64 Position
357 );
358
375EFIAPI
377 IN SHELL_FILE_HANDLE FileHandle,
378 OUT UINT64 *Position
379 );
380
396EFIAPI
398 IN SHELL_FILE_HANDLE FileHandle
399 );
400
426EFIAPI
428 IN SHELL_FILE_HANDLE DirHandle,
429 OUT EFI_FILE_INFO **Buffer
430 );
431
453EFIAPI
455 IN SHELL_FILE_HANDLE DirHandle,
456 IN OUT EFI_FILE_INFO *Buffer,
457 IN OUT BOOLEAN *NoFile
458 );
459
473EFIAPI
475 IN SHELL_FILE_HANDLE FileHandle,
476 OUT UINT64 *Size
477 );
478
487BOOLEAN
488EFIAPI
490 VOID
491 );
492
504CONST CHAR16 *
505EFIAPI
507 IN CONST CHAR16 *EnvKey
508 );
509
531EFIAPI
533 IN CONST CHAR16 *EnvKey,
534 IN CONST CHAR16 *EnvVal,
535 IN BOOLEAN Volatile
536 );
537
569EFIAPI
571 IN EFI_HANDLE *ParentHandle,
572 IN CHAR16 *CommandLine,
573 IN BOOLEAN Output,
574 IN CHAR16 **EnvironmentVariables,
575 OUT EFI_STATUS *Status
576 );
577
592CONST CHAR16 *
593EFIAPI
595 IN CHAR16 *CONST DeviceName OPTIONAL
596 );
597
606VOID
607EFIAPI
609 IN BOOLEAN CurrentState
610 );
611
636EFIAPI
638 IN CHAR16 *Arg,
639 IN UINT64 OpenMode,
640 IN OUT EFI_SHELL_FILE_INFO **ListHead
641 );
642
652EFIAPI
654 IN OUT EFI_SHELL_FILE_INFO **ListHead
655 );
656
669CHAR16 *
670EFIAPI
672 IN CONST CHAR16 *FileName
673 );
674
691CHAR16 *
692EFIAPI
694 IN CONST CHAR16 *FileName,
695 IN CONST CHAR16 *FileExtension
696 );
697
698typedef enum {
706 TypeMax,
708
709typedef struct {
710 CHAR16 *Name;
711 SHELL_PARAM_TYPE Type;
713
716
719
745EFIAPI
747 IN CONST SHELL_PARAM_ITEM *CheckList,
748 OUT LIST_ENTRY **CheckPackage,
749 OUT CHAR16 **ProblemParam OPTIONAL,
750 IN BOOLEAN AutoPageBreak,
751 IN BOOLEAN AlwaysAllowNumbers
752 );
753
755#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
756
767VOID
768EFIAPI
770 IN LIST_ENTRY *CheckPackage
771 );
772
787BOOLEAN
788EFIAPI
790 IN CONST LIST_ENTRY *CONST CheckPackage,
791 IN CONST CHAR16 *CONST KeyString
792 );
793
807CONST CHAR16 *
808EFIAPI
810 IN CONST LIST_ENTRY *CheckPackage,
811 IN CHAR16 *KeyString
812 );
813
827CONST CHAR16 *
828EFIAPI
830 IN CONST LIST_ENTRY *CONST CheckPackage,
831 IN UINTN Position
832 );
833
844UINTN
845EFIAPI
847 IN CONST LIST_ENTRY *CheckPackage
848 );
849
865EFIAPI
867 IN CONST LIST_ENTRY *CheckPackage,
868 OUT CHAR16 **Param
869 );
870
885EFIAPI
887 VOID
888 );
889
920EFIAPI
922 IN INT32 Col OPTIONAL,
923 IN INT32 Row OPTIONAL,
924 IN CONST CHAR16 *Format,
925 ...
926 );
927
961EFIAPI
963 IN INT32 Col OPTIONAL,
964 IN INT32 Row OPTIONAL,
965 IN CONST CHAR8 *Language OPTIONAL,
966 IN CONST EFI_STRING_ID HiiFormatStringId,
967 IN CONST EFI_HII_HANDLE HiiFormatHandle,
968 ...
969 );
970
983EFIAPI
985 IN CONST CHAR16 *DirName
986 );
987
1002EFIAPI
1004 IN CONST CHAR16 *Name
1005 );
1006
1021EFIAPI
1023 IN CONST CHAR16 *Name
1024 );
1025
1038UINTN
1039EFIAPI
1041 IN CONST CHAR16 *String
1042 );
1043
1055UINTN
1056EFIAPI
1058 IN CONST CHAR16 *String
1059 );
1060
1093CHAR16 *
1094EFIAPI
1096 IN OUT CHAR16 **Destination,
1097 IN OUT UINTN *CurrentSize,
1098 IN CONST CHAR16 *Source,
1099 IN UINTN Count
1100 );
1101
1130EFIAPI
1132 IN CHAR16 CONST *SourceString,
1133 IN OUT CHAR16 *NewString,
1134 IN UINTN NewSize,
1135 IN CONST CHAR16 *FindTarget,
1136 IN CONST CHAR16 *ReplaceWith,
1137 IN CONST BOOLEAN SkipPreCarrot,
1138 IN CONST BOOLEAN ParameterReplacing
1139 );
1140
1155BOOLEAN
1156EFIAPI
1158 IN CHAR16 Char
1159 );
1160
1175BOOLEAN
1176EFIAPI
1178 IN CHAR16 Char
1179 );
1180
1184typedef enum {
1185 ShellPromptResponseTypeYesNo,
1186 ShellPromptResponseTypeYesNoCancel,
1187 ShellPromptResponseTypeFreeform,
1188 ShellPromptResponseTypeQuitContinue,
1189 ShellPromptResponseTypeYesNoAllCancel,
1190 ShellPromptResponseTypeEnterContinue,
1191 ShellPromptResponseTypeAnyKeyContinue,
1192 ShellPromptResponseTypeMax
1194
1198typedef enum {
1199 ShellPromptResponseYes,
1200 ShellPromptResponseNo,
1201 ShellPromptResponseCancel,
1202 ShellPromptResponseQuit,
1203 ShellPromptResponseContinue,
1204 ShellPromptResponseAll,
1205 ShellPromptResponseMax
1207
1233EFIAPI
1236 IN CHAR16 *Prompt OPTIONAL,
1237 IN OUT VOID **Response OPTIONAL
1238 );
1239
1258EFIAPI
1261 IN CONST EFI_STRING_ID HiiFormatStringId,
1262 IN CONST EFI_HII_HANDLE HiiFormatHandle,
1263 IN OUT VOID **Response
1264 );
1265
1278BOOLEAN
1279EFIAPI
1281 IN CONST CHAR16 *String,
1282 IN CONST BOOLEAN ForceHex,
1283 IN CONST BOOLEAN StopAtSpace
1284 );
1285
1302EFIAPI
1304 IN CONST CHAR16 *String,
1305 OUT UINT64 *Value,
1306 IN CONST BOOLEAN ForceHex,
1307 IN CONST BOOLEAN StopAtSpace
1308 );
1309
1320EFIAPI
1322 IN CONST CHAR16 *Name
1323 );
1324
1340CHAR16 *
1341EFIAPI
1343 IN SHELL_FILE_HANDLE Handle,
1344 IN OUT BOOLEAN *Ascii
1345 );
1346
1374EFIAPI
1376 IN SHELL_FILE_HANDLE Handle,
1377 IN OUT CHAR16 *Buffer,
1378 IN OUT UINTN *Size,
1379 IN BOOLEAN Truncate,
1380 IN OUT BOOLEAN *Ascii
1381 );
1382
1407EFIAPI
1409 IN CONST CHAR16 *FileName
1410 );
1411
1424EFIAPI
1426 IN CONST CHAR16 *CommandToGetHelpOn,
1427 IN CONST CHAR16 *SectionToGetHelpOn,
1428 IN BOOLEAN PrintCommandText
1429 );
1430
1431#endif // __SHELL_LIB__
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_FILE_INFO * FileInfo(IN EFI_FILE_HANDLE FHand)
EFI_STRING_ID NewString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
Definition: Setup.c:981
EFI_STATUS EFIAPI ShellPrintHelp(IN CONST CHAR16 *CommandToGetHelpOn, IN CONST CHAR16 *SectionToGetHelpOn, IN BOOLEAN PrintCommandText)
EFI_STATUS EFIAPI ShellGetFileSize(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Size)
CONST CHAR16 *EFIAPI ShellGetCurrentDir(IN CHAR16 *CONST DeviceName OPTIONAL)
BOOLEAN EFIAPI ShellIsHexaDecimalDigitCharacter(IN CHAR16 Char)
Definition: UefiShellLib.c:171
CHAR16 *EFIAPI ShellFileHandleReturnLine(IN SHELL_FILE_HANDLE Handle, IN OUT BOOLEAN *Ascii)
CHAR16 *EFIAPI FullyQualifyPath(IN CONST CHAR16 *Path)
Definition: UefiShellLib.c:64
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
EFI_STATUS EFIAPI ShellOpenFileByDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
Definition: UefiShellLib.c:640
EFI_FILE_INFO *EFIAPI ShellGetFileInfo(IN SHELL_FILE_HANDLE FileHandle)
Definition: UefiShellLib.c:573
EFI_STATUS EFIAPI ShellSetEnvironmentVariable(IN CONST CHAR16 *EnvKey, IN CONST CHAR16 *EnvVal, IN BOOLEAN Volatile)
EFI_STATUS EFIAPI ShellFindNextFile(IN SHELL_FILE_HANDLE DirHandle, IN OUT EFI_FILE_INFO *Buffer, IN OUT BOOLEAN *NoFile)
EFI_STATUS EFIAPI ShellSetFileInfo(IN SHELL_FILE_HANDLE FileHandle, IN EFI_FILE_INFO *FileInfo)
Definition: UefiShellLib.c:601
EFI_STATUS EFIAPI ShellDeleteFile(IN SHELL_FILE_HANDLE *FileHandle)
Definition: UefiShellLib.c:992
SHELL_PROMPT_REQUEST_TYPE
Definition: ShellLib.h:1184
EFI_STATUS EFIAPI ShellCopySearchAndReplace(IN CHAR16 CONST *SourceString, IN OUT CHAR16 *NewString, IN UINTN NewSize, IN CONST CHAR16 *FindTarget, IN CONST CHAR16 *ReplaceWith, IN CONST BOOLEAN SkipPreCarrot, IN CONST BOOLEAN ParameterReplacing)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
VOID EFIAPI ShellSetPageBreakMode(IN BOOLEAN CurrentState)
EFI_STATUS EFIAPI ShellDeleteFileByName(IN CONST CHAR16 *FileName)
EFI_STATUS EFIAPI ShellPromptForResponseHii(IN SHELL_PROMPT_REQUEST_TYPE Type, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle, IN OUT VOID **Response)
EFI_STATUS EFIAPI ShellCreateDirectory(IN CONST CHAR16 *DirectoryName, OUT SHELL_FILE_HANDLE *FileHandle)
Definition: UefiShellLib.c:857
EFI_STATUS EFIAPI ShellCloseFileMetaArg(IN OUT EFI_SHELL_FILE_INFO **ListHead)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
BOOLEAN EFIAPI ShellIsHexOrDecimalNumber(IN CONST CHAR16 *String, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
SHELL_PARAM_TYPE
Definition: ShellLib.h:698
@ TypeStart
A flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc....
Definition: ShellLib.h:702
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
@ TypeTimeValue
A flag that has a time value following it (IE "-a -5:00").
Definition: ShellLib.h:705
@ TypeMaxValue
A flag followed by all the command line data before the next flag.
Definition: ShellLib.h:704
@ TypeDoubleValue
A flag that has 2 space seperated value data following it (IE "-a 1 2").
Definition: ShellLib.h:703
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699
@ TypePosition
Some data that did not follow a parameter (IE "filename.txt").
Definition: ShellLib.h:701
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
Definition: UefiShellLib.c:720
BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
Definition: UefiShellLib.c:194
SHELL_PARAM_ITEM SfoParamList[]
Helper structure for -sfo only (besides -? and -b)
Definition: UefiShellLib.c:22
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS EFIAPI ShellFindFirstFile(IN SHELL_FILE_HANDLE DirHandle, OUT EFI_FILE_INFO **Buffer)
CHAR16 *EFIAPI ShellFindFilePathEx(IN CONST CHAR16 *FileName, IN CONST CHAR16 *FileExtension)
EFI_STATUS EFIAPI ShellPromptForResponse(IN SHELL_PROMPT_REQUEST_TYPE Type, IN CHAR16 *Prompt OPTIONAL, IN OUT VOID **Response OPTIONAL)
EFI_STATUS EFIAPI ShellCommandLineCheckDuplicate(IN CONST LIST_ENTRY *CheckPackage, OUT CHAR16 **Param)
EFI_STATUS EFIAPI ShellExecute(IN EFI_HANDLE *ParentHandle, IN CHAR16 *CommandLine, IN BOOLEAN Output, IN CHAR16 **EnvironmentVariables, OUT EFI_STATUS *Status)
SHELL_PROMPT_RESPONSE
Definition: ShellLib.h:1198
CONST CHAR16 *EFIAPI ShellGetEnvironmentVariable(IN CONST CHAR16 *EnvKey)
EFI_STATUS EFIAPI ShellFileExists(IN CONST CHAR16 *Name)
EFI_STATUS EFIAPI ShellFileHandleReadLine(IN SHELL_FILE_HANDLE Handle, IN OUT CHAR16 *Buffer, IN OUT UINTN *Size, IN BOOLEAN Truncate, IN OUT BOOLEAN *Ascii)
EFI_STATUS EFIAPI ShellOpenFileMetaArg(IN CHAR16 *Arg, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **ListHead)
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
Definition: UefiShellLib.c:532
UINTN EFIAPI ShellHexStrToUintn(IN CONST CHAR16 *String)
EFI_STATUS EFIAPI ShellIsFile(IN CONST CHAR16 *Name)
EFI_STATUS EFIAPI ShellIsDirectory(IN CONST CHAR16 *DirName)
EFI_STATUS EFIAPI ShellGetFilePosition(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Position)
EFI_STATUS EFIAPI ShellSetFilePosition(IN SHELL_FILE_HANDLE FileHandle, IN UINT64 Position)
CHAR16 *EFIAPI ShellFindFilePath(IN CONST CHAR16 *FileName)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
EFI_STATUS EFIAPI ShellIsFileInPath(IN CONST CHAR16 *Name)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
SHELL_PARAM_ITEM EmptyParamList[]
Helper structure for no parameters (besides -? and -b)
Definition: UefiShellLib.c:19
EFI_STATUS EFIAPI ShellFlushFile(IN SHELL_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI ShellWriteFile(IN SHELL_FILE_HANDLE FileHandle, IN OUT UINTN *BufferSize, IN VOID *Buffer)
Definition: UefiShellLib.c:947
EFI_STATUS EFIAPI ShellCloseFile(IN SHELL_FILE_HANDLE *FileHandle)
Definition: UefiShellLib.c:969
EFI_STATUS EFIAPI ShellReadFile(IN SHELL_FILE_HANDLE FileHandle, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
Definition: UefiShellLib.c:912
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
VOID * EFI_HII_HANDLE