2 Defines for EFI shell environment 2 ported to EDK II build environment. (no spec)
4 Copyright (c) 2005 - 2009, Intel Corporation<BR>
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.
19 #include <Protocol/SimpleTextIn.h>
20 #include <Protocol/SimpleTextOut.h>
21 #include <Protocol/EfiShellInterface.h>
23 #define DEFAULT_INIT_ROW 1
24 #define DEFAULT_AUTO_LF FALSE
28 This function is a prototype for a function that dumps information on a protocol
29 to a given location. The location is dependant on the implementation. This is
30 used when programatically adding shell commands.
32 @param Handle the handle the protocol is on
33 @param Interface the interface to the protocol
38 (EFIAPI
*SHELLENV_DUMP_PROTOCOL_INFO
) (
44 This function is a prototype for each command internal to the EFI shell
45 implementation. The specific command depends on the implementation. This is
46 used when programatically adding shell commands.
48 @param ImageHandle The handle to the binary shell.
49 @param SystemTable Pointer to the system table.
51 @retval EFI_SUCCESS The command ran to completion
52 @retval other An error ocurred. Any error is possible
53 depending on the implementation of the shell
59 (EFIAPI
*SHELLENV_INTERNAL_COMMAND
) (
60 IN EFI_HANDLE ImageHandle
,
61 IN EFI_SYSTEM_TABLE
*SystemTable
65 This function is a prototype for one that gets a help string for a given command.
66 This is used when programatically adding shell commands. Upon successful return
67 the memory allocated is up to the caller to free.
69 @param Str Pointer to pointer to string to display for help.
71 @retval EFI_SUCCESS Phe help string is in the parameter Str.
76 (EFIAPI
*SHELLCMD_GET_LINE_HELP
) (
81 Structure returned from functions that open multiple files.
84 UINT32 Signature
; ///< SHELL_FILE_ARG_SIGNATURE
85 LIST_ENTRY Link
; ///< Linked list helper
86 EFI_STATUS Status
; ///< File's status
88 EFI_FILE_HANDLE Parent
; ///< What is the Parent file of this file
89 UINT64 OpenMode
; ///< How was the file opened
90 CHAR16
*ParentName
; ///< String representation of parent
91 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
; ///< DevicePath for Parent
93 CHAR16
*FullName
; ///< Path and file name for this file
94 CHAR16
*FileName
; ///< File name for this file
96 EFI_FILE_HANDLE Handle
; ///< Handle to this file
97 EFI_FILE_INFO
*Info
; ///< Pointer to file info for this file
100 /// Signature for SHELL_FILE_ARG
101 #define SHELL_FILE_ARG_SIGNATURE SIGNATURE_32 ('g', 'r', 'a', 'f')
104 * GUID for the shell environment2 and shell environment
106 #define SHELL_ENVIRONMENT_PROTOCOL_GUID \
108 0x47c7b221, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
112 * GUID for the shell environment2 extension (main GUID same as shell environment).
114 #define EFI_SE_EXT_SIGNATURE_GUID \
116 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
119 #define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2
120 #define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2
123 Execute a command line
125 This function will run the CommandLine. This includes loading any required images,
126 parsing any requires scripts, and it DebugOutput is TRUE printing errors
127 encountered directly to the screen.
129 @param ParentImageHandle Handle of image executing this operation.
130 @param CommandLine string command line to execute.
131 @param DebugOutput TRUE indicates that errors should be printed directly.
132 FALSE supresses error messages.
134 @retval EFI_SUCCESS The command line executed and completed.
135 @retval EFI_ABORTED The operation did not complete due to abort.
136 @retval EFI_INVALID_PARAMETER A parameter did not have a valid value.
137 @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.
143 (EFIAPI
*SHELLENV_EXECUTE
) (
144 IN EFI_HANDLE
*ParentImageHandle
,
145 IN CHAR16
*CommandLine
,
146 IN BOOLEAN DebugOutput
150 this function returns a shell environment variable value.
152 @param Name pointer to the string with the shell environment
155 @retval NULL the shell environment variable's value could not be found
156 @retval !NULL the value of the shell environment variable Name
161 (EFIAPI
*SHELLENV_GET_ENV
) (
166 this function returns a shell environment map value.
168 @param Name pointer to the string with the shell environment
171 @retval NULL the shell environment map's value could not be found
172 @retval !NULL the value of the shell environment map Name
177 (EFIAPI
*SHELLENV_GET_MAP
) (
182 This function will add an internal command to the shell interface.
184 This will allocate all required memory, put the new command on the command
185 list in the correct location.
187 @param Handler the handler function to call when the command gets called
188 @param CmdStr The command name
189 @param GetLineHelp function to call of get help for this command
191 @retval EFI_SUCCESS the command is now part of the command list
192 @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
193 @sa SHELLENV_INTERNAL_COMMAND
194 @sa SHELLCMD_GET_LINE_HELP
198 (EFIAPI
*SHELLENV_ADD_CMD
) (
199 IN SHELLENV_INTERNAL_COMMAND Handler
,
201 IN SHELLCMD_GET_LINE_HELP GetLineHelp
205 Internal interface to add protocol handlers.
207 This function is for internal shell use only. This is how protocol handlers are added.
208 This will get the current protocol info and add the new info or update existing info
209 and then resave the info.
211 @param SaveId save this change as an EFI variable
212 @param Protocol the protocol's GUID
213 @param DumpToken The function pointer to dump token function or
215 @param DumpInfo The function pointer to dump infomation function
217 @param IdString The english name of the protocol
221 (EFIAPI
*SHELLENV_ADD_PROT
) (
222 IN EFI_GUID
*Protocol
,
223 IN SHELLENV_DUMP_PROTOCOL_INFO DumpToken OPTIONAL
,
224 IN SHELLENV_DUMP_PROTOCOL_INFO DumpInfo OPTIONAL
,
229 this function finds a protocol handle by a GUID.
231 This function will check for already known protocols by GUID and if one is
232 found it will return the name of that protocol. if no name is found and
233 GenId is TRUE it will generate ths string.
235 @param Protocol the GUID of the protocol to look for.
236 @param GenId whether to generate a name string if its not found.
238 @return !NULL the Name of the protocol.
239 @retval NULL the Name was not found and GenId was not TRUE.
243 (EFIAPI
*SHELLENV_GET_PROT
) (
244 IN EFI_GUID
*Protocol
,
249 this function returns the current directory on a given device
251 If DeviceName is specified, then return the current shell directory on that
252 device. If DeviceName is NULL, then return the current directory on the
253 current device. The caller us responsible to free the returned string when
256 @param DeviceName the name of the device to get the current
257 directory on or NULL for current device
259 @return The current directory on the current or specified device.
264 (EFIAPI
*SHELLENV_CUR_DIR
) (
265 IN CHAR16
*DeviceName OPTIONAL
269 this function will open a group of files that match the Arg path, including
270 support for wildcard characters ('?' and '*') in the Arg path. if there are
271 any wildcard characters in the path this function will find any and all files
272 that match the wildcards. the return is a double linked list based on the
273 LIST_ENTRY linked list structure. use this in conjunction with the
274 SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.
275 The memory allocated by the callee for this list is freed by making a call to
276 SHELLENV_FREE_FILE_LIST.
278 @param Arg pointer Path to files to open
279 @param ListHead pointer to allocated and initialized list head
280 upon which to append all the opened file structures.
282 @retval EFI_SUCCESS 1 or more files was opened and a struct of each file's
283 information was appended to ListHead.
284 @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
285 @retval EFI_NOT_FOUND no matching files could be found.
286 @sa SHELLENV_FREE_FILE_LIST
289 (EFIAPI
*SHELLENV_FILE_META_ARG
) (
291 IN OUT LIST_ENTRY
*ListHead
295 this frees all of the nodes under the ListHead, but not ListHead itself.
297 @param ListHead Pointer to list to free all nodes of.
299 @retval EFI_SUCCESS always returned.
303 (EFIAPI
*SHELLENV_FREE_FILE_LIST
) (
304 IN OUT LIST_ENTRY
*ListHead
308 this function creates a new instance of the ShellInterface protocol for use on
311 This function is for internal shell usage. this will allocate and then populate
312 EFI_SHELL_INTERFACE protocol. it is the caller's responsibility to free the
315 @param ImageHandle the handle which will use the new ShellInterface
318 @return the newly allocated shell interface protocol.
323 (EFIAPI
*SHELLENV_NEW_SHELL
) (
324 IN EFI_HANDLE ImageHandle
328 this function determins whether a script file is currently being processed.
330 a script file (.nsh file) can contain a series of commands and this is useful to
331 know for some shell commands whether they are being run manually or as part of a
334 @retval TRUE A script file is being processed
335 @return FALSE A script file is not being processed
339 (EFIAPI
*SHELLENV_BATCH_IS_ACTIVE
) (
344 This is an internal shell function to free any and all allocated resources.
345 This should be called just closing the shell.
349 (EFIAPI
*SHELLENV_FREE_RESOURCES
) (
354 This function enables the page break mode.
356 This mode causes the output to pause after each complete screen to enable a
357 user to more easily read it. if AutoWrap is TRUE then rows with too many
358 characters will be chopped and divided into 2 rows. if FALSE then rows with
359 too many characters may not be fully visible to the user on the screen.
361 @param StartRow the row number to start this on.
362 @param AutoWrap whether to auto wrap rows that are
366 (EFIAPI
*SHELLENV_ENABLE_PAGE_BREAK
) (
372 This function disables the page break mode.
374 disabling this causes the output to print out exactly as coded with no breaks
379 (EFIAPI
*SHELLENV_DISABLE_PAGE_BREAK
) (
384 Get the status of the page break output mode.
386 @retval FALSE page break output mode is not enabled
387 @retval TRUE page break output mode is enabled
391 (EFIAPI
*SHELLENV_GET_PAGE_BREAK
) (
396 this function sets the keys to filter for for the console in. the valid
399 #define EFI_OUTPUT_SCROLL 0x00000001
400 #define EFI_OUTPUT_PAUSE 0x00000002
401 #define EFI_EXECUTION_BREAK 0x00000004
403 @param KeyFilter The new key filter to use.
407 (EFIAPI
*SHELLENV_SET_KEY_FILTER
) (
412 this function gets the keys to filter for for the console in. the valid
415 #define EFI_OUTPUT_SCROLL 0x00000001
416 #define EFI_OUTPUT_PAUSE 0x00000002
417 #define EFI_EXECUTION_BREAK 0x00000004
419 @retval the current filter mask.
423 (EFIAPI
*SHELLENV_GET_KEY_FILTER
) (
428 this function determins if the shell application should break.
430 This is used to inform a shell application that a break condition has been
431 initiated. long loops should check this to prevent delays to the break.
433 @retval TRUE a break has been signaled. the application
434 should exit with EFI_ABORTED as soon as possible.
435 @retval FALSE continue as normal.
439 (EFIAPI
*SHELLENV_GET_EXECUTION_BREAK
) (
444 This is an internal-shell function used to increment the shell nesting level.
449 (EFIAPI
*SHELLENV_INCREMENT_SHELL_NESTING_LEVEL
) (
454 This is an internal-shell function used to decrement the shell nesting level.
458 (EFIAPI
*SHELLENV_DECREMENT_SHELL_NESTING_LEVEL
) (
463 this function determins if the caller is running under the root shell.
465 @retval TRUE The caller is running under the root shell
466 @retval FALSE The caller is not running under the root shell
471 (EFIAPI
*SHELLENV_IS_ROOT_SHELL
) (
476 Close the console proxy to restore the original console.
478 This is an internal shell function to handle shell cascading. it restores the
479 original set of console protocols.
481 @param ConInHandle The handle of ConIn.
482 @param ConIn pointer to the location to return the pointer to
483 the original console input.
484 @param ConOutHandle The handle of ConOut
485 @param ConOut pointer to the location to return the pointer to
486 the original console output.
490 (EFIAPI
*SHELLENV_CLOSE_CONSOLE_PROXY
) (
491 IN EFI_HANDLE ConInHandle
,
492 IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL
**ConIn
,
493 IN EFI_HANDLE ConOutHandle
,
494 IN OUT EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
**ConOut
498 // declarations of handle enumerator
501 For ease of use the shell maps handle #'s to short numbers.
502 This is only done on request for various internal commands and the references
503 are immediately freed when the internal command completes.
507 (EFIAPI
*INIT_HANDLE_ENUMERATOR
) (
512 this is an internal shell function to enumerate the handle database.
514 this function gets the next handle in the handle database. if no handles are
515 found EFI_NOT_FOUND is returned. if the previous Handle was the last handle
516 it is set to NULL before returning.
518 this must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
520 @param Handle pointer to pointer to Handle. will be set
521 on a sucessful return.
523 @retval EFI_SUCCESS the next handle in the handle database is *Handle
524 @retval EFI_NOT_FOUND there is not another handle.
528 (EFIAPI
*NEXT_HANDLE
) (
529 IN OUT EFI_HANDLE
**Handle
533 this is an internal shell function to enumerate the handle database.
535 this function skips the next SkipNum handles in the handle database. If there
536 are not enough handles left to skip that many EFI_ACCESS_DENIED is returned and
537 no skip is performed.
539 this must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
541 @param SkipNum how many handles to skip
543 @retval EFI_SUCCESS the next handle in the handle database is *Handle
544 @retval EFI_ACCESS_DENIED there are not SkipNum handles left in the database
548 (EFIAPI
*SKIP_HANDLE
) (
553 this is an internal shell function to enumerate the handle database.
555 this function resets the the handle database so that NEXT_HANDLE and SKIP_HANDLE
556 will start from EnumIndex on the next call.
558 this must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
560 @param EnumIndex where to start.
562 @retval the number of handles either read out or skipped before this reset.
566 (EFIAPI
*RESET_HANDLE_ENUMERATOR
) (
571 this is an internal shell function to enumerate the handle database.
573 this must be called after INIT_HANDLE_ENUMERATOR.
575 this function releases all memory and resources associated with the handle database.
576 after this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will
581 (EFIAPI
*CLOSE_HANDLE_ENUMERATOR
) (
586 this is an internal shell function to enumerate the handle database.
588 this function returns the number of handles in the handle database.
590 this must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
592 @retval the number of handles in the handle database.
601 Handle Enumerator structure
604 INIT_HANDLE_ENUMERATOR Init
; ///< pointer to INIT_HANDLE_ENUMERATOR function
605 NEXT_HANDLE Next
; ///< pointer to NEXT_HANDLE function
606 SKIP_HANDLE Skip
; ///< pointer to SKIP_HANDLE function
607 RESET_HANDLE_ENUMERATOR Reset
; ///< pointer to RESET_HANDLE_ENUMERATOR function
608 CLOSE_HANDLE_ENUMERATOR Close
; ///< pointer to CLOSE_HANDLE_ENUMERATOR function
609 GET_NUM GetNum
; ///< pointer to GET_NUM function
612 signature for the PROTOCOL_INFO structure
614 #define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')
616 PROTOCOL_INFO structure for protocol enumerator functions.
620 UINTN Signature
; ///< PROTOCOL_INFO_SIGNATURE
621 LIST_ENTRY Link
; ///< standard lined list helper member
623 // parsing info for the protocol
625 EFI_GUID ProtocolId
; ///< GUID for the protocol
626 CHAR16
*IdString
; ///< Name of the protocol
627 SHELLENV_DUMP_PROTOCOL_INFO DumpToken
; ///< pointer to DumpToken function for the protocol
628 SHELLENV_DUMP_PROTOCOL_INFO DumpInfo
; ///< pointer to DumpInfo function for the protocol
630 // database info on which handles are supporting this protocol
632 UINTN NoHandles
; ///< how many handles produce this protocol
633 EFI_HANDLE
*Handles
; ///< array of handles
638 // declarations of protocol info enumerator
641 this is an internal shell function to initialize the protocol enumerator.
643 this must be called before NEXT_PROTOCOL_INFO, SKIP_PROTOCOL_INFO,
644 RESET_PROTOCOL_INFO_ENUMERATOR, and CLOSE_PROTOCOL_INFO_ENUMERATOR are
649 (EFIAPI
*INIT_PROTOCOL_INFO_ENUMERATOR
) (
654 this function is an internal shell function for enumeration of protocols.
656 This functiol will return the next protocol in the list. If this is called
657 immediately after initialization it will return the first. If this is called
658 immediately after reset it will return the protocol first again.
660 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
661 called after INIT_PROTOCOL_INFO_ENUMERATOR.
663 @param ProtocolInfo pointer to pointer to protocol information structure.
665 @retval EFI_SUCCESS the next protocol's information was sucessfully returned.
666 If there were no more protocols NULL was returned.
670 (EFIAPI
*NEXT_PROTOCOL_INFO
) (
671 IN OUT PROTOCOL_INFO
**ProtocolInfo
675 this function is an internal shell function for enumeration of protocols.
677 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
678 called after INIT_PROTOCOL_INFO_ENUMERATOR.
680 this function does nothing and always returns EFI_SUCCESS.
682 @retval EFI_SUCCESS always returned (see note).
686 (EFIAPI
*SKIP_PROTOCOL_INFO
) (
691 this function is an internal shell function for enumeration of protocols.
693 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
694 called after INIT_PROTOCOL_INFO_ENUMERATOR.
696 this function resets the list of protocols such that the next one in the
697 list is the begining of the list.
701 (EFIAPI
*RESET_PROTOCOL_INFO_ENUMERATOR
) (
707 this function is an internal shell function for enumeration of protocols.
709 This must be called after INIT_PROTOCOL_INFO_ENUMERATOR. After this call
710 no protocol enumerator calls except INIT_PROTOCOL_INFO_ENUMERATOR may be made.
712 this function frees any memory or resources associated with the protocol
717 (EFIAPI
*CLOSE_PROTOCOL_INFO_ENUMERATOR
) (
722 * protocol enumerator structure of function pointers.
725 INIT_PROTOCOL_INFO_ENUMERATOR Init
; ///< pointer to INIT_PROTOCOL_INFO_ENUMERATOR function
726 NEXT_PROTOCOL_INFO Next
; ///< pointer to NEXT_PROTOCOL_INFO function
727 SKIP_PROTOCOL_INFO Skip
; ///< pointer to SKIP_PROTOCOL_INFO function
728 RESET_PROTOCOL_INFO_ENUMERATOR Reset
; ///< pointer to RESET_PROTOCOL_INFO_ENUMERATOR function
729 CLOSE_PROTOCOL_INFO_ENUMERATOR Close
; ///< pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function
730 } PROTOCOL_INFO_ENUMERATOR
;
733 this function is used to retrieve a user-friendly display name for a handle.
735 If UseComponentName is TRUE then the component name protocol for this device
736 or it's parent device (if required) will be used to obtain the name of the
737 device. If UseDevicePath is TRUE it will get the human readable device path
738 and return that. If both are TRUE it will try to use component name first
739 and device path if that fails.
741 It will use either ComponentName or ComponentName2 protocol, depending on
744 This function will furthur verify whether the handle in question produced either
745 EFI_DRIVER_CONFIGRATION_PROTOCOL or EFI_DRIVER_CONFIGURATION2_PROTOCOL and also
746 whether the handle in question produced either EFI_DRIVER_DIAGNOSTICS_PROTOCOL or
747 EFI_DRIVER_DIAGNOSTICS2_PROTOCOL.
749 Upon sucessful return the memory for *BestDeviceName is up to the caller to free.
751 @param DeviceHandle the device handle whose name is desired
752 @param UseComponentName whether to use the ComponentName protocol at all
753 @param UseDevicePath whether to use the DevicePath protocol at all
754 @param Language pointer to language string to use
755 @param BestDeviceName pointer to pointer to string allocated with the name
756 @param ConfigurationStatus pointer to status for opening a Configuration protocol
757 @param DiagnosticsStatus pointer to status for opening a Diagnostics protocol
758 @param Display Whether to Print this out to default Print location
759 @param Indent how many characters to indent the printing
761 @retval EFI_SUCCESS this function always returns EFI_SUCCESS
765 (EFIAPI
*GET_DEVICE_NAME
) (
766 EFI_HANDLE DeviceHandle
,
767 BOOLEAN UseComponentName
,
768 BOOLEAN UseDevicePath
,
770 CHAR16
**BestDeviceName
,
771 EFI_STATUS
*ConfigurationStatus
,
772 EFI_STATUS
*DiagnosticsStatus
,
777 #define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< string for lowest version this shell supports
778 #define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< string for highest version this shell supports
781 this function gets the shell mode as stored in the shell environment
782 "efishellmode". it will not fail.
784 @param Mode returns a string representing one of the
785 2 supported modes of the shell.
787 @retval EFI_SUCCESS this function always returns success
791 (EFIAPI
*GET_SHELL_MODE
) (
796 Convert a file system style name to an file path
798 This function will convert a shell path name to a Device Path Protocol path.
799 This function will allocate any required memory for this operation and it
800 is the responsibility of the caller to free that memory when no longer required.
802 if anything prevents the complete conversion free any allocated memory and
805 @retval !NULL a pointer to the callee allocated Device Path
806 @retval NULL the operation could not be completed.
809 EFI_DEVICE_PATH_PROTOCOL
*
810 (EFIAPI
*SHELLENV_NAME_TO_PATH
) (
815 converts a device path into a file system map name.
817 if DevPath is NULL then ASSERT
818 This function looks through the shell environment map for a map whose device
819 path matches the DevPath parameter. If one is found the Name is returned via
820 Name parameter. If sucessful the caller must free the memory allocated for
823 this function will use the internal lock to prevent changes to the map during
824 the lookup operation.
826 @param DevPath The device path to search for a name for
827 @param ConsistMapping what state to verify map flag VAR_ID_CONSIST
828 @param Name on sucessful return the name of that device path
830 @retval EFI_SUCCESS the DevPath was found and the name returned
832 @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.
833 @retval EFI_UNSUPPORTED the DevPath was not found in the map
837 (EFIAPI
*SHELLENV_GET_FS_NAME
) (
838 IN EFI_DEVICE_PATH_PROTOCOL
* DevPath
,
839 IN BOOLEAN ConsistMapping
,
844 this function will open a group of files that match the Arg path, but will not
845 support the wildcard characters ('?' and '*') in the Arg path. if there are
846 any wildcard characters in the path this function will return
847 EFI_INVALID_PARAMETER. the return is a double linked list based on the
848 LIST_ENTRY linked list structure. use this in conjunction with the
849 SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.
850 The memory allocated by the callee for this list is freed by making a call to
851 SHELLENV_FREE_FILE_LIST.
853 @param Arg pointer Path to files to open
854 @param ListHead pointer to allocated and initialized list head
855 upon which to append all the opened file structures.
857 @retval EFI_SUCCESS 1 or more files was opened and a struct of each file's
858 information was appended to ListHead.
859 @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
860 @retval EFI_NOT_FOUND no matching files could be found.
861 @sa SHELLENV_FREE_FILE_LIST
865 (EFIAPI
*SHELLENV_FILE_META_ARG_NO_WILDCARD
) (
867 IN OUT LIST_ENTRY
*ListHead
871 this function removes duplicate file listings from lists.
873 this is a function for use with SHELLENV_FILE_META_ARG_NO_WILDCARD and
874 SHELLENV_FILE_META_ARG. this function will verify that there are no duplicate
875 files in the list of returned files. any file listed twice will have one of its
878 @param ListHead pointer to linked list head that was returned from
879 SHELLENV_FILE_META_ARG_NO_WILDCARD or
880 SHELLENV_FILE_META_ARG.
882 @retval EFI_SUCCESS this function always returns success.
887 (EFIAPI
*SHELLENV_DEL_DUP_FILE
) (
888 IN LIST_ENTRY
* ListHead
892 Converts a File System map name to a device path.
894 if DevPath is NULL then ASSERT()
896 This function looks through the shell environment map for a map whose Name
897 matches the Name parameter. If one is found the device path pointer is
898 updated to point to that file systems device path. the caller should not
899 free the memory from that device path.
901 this function will use the internal lock to prevent changes to the map during
902 the lookup operation.
904 @param Name pointer to NULL terminated UNICODE string of the
906 @param DevPath pointer to pointer to DevicePath. only valid on
909 @retval EFI_SUCCESS the conversion was successful and the device
911 @retval EFI_NOT_FOUND the file system could not be found in the map.
915 (EFIAPI
*SHELLENV_GET_FS_DEVICE_PATH
) (
917 OUT EFI_DEVICE_PATH_PROTOCOL
**DevPath
920 /// EFI_SHELL_ENVIRONMENT2 protocol structure
921 /// contains pointers to functions
923 SHELLENV_EXECUTE Execute
;
924 SHELLENV_GET_ENV GetEnv
;
925 SHELLENV_GET_MAP GetMap
;
926 SHELLENV_ADD_CMD AddCmd
;
927 SHELLENV_ADD_PROT AddProt
;
928 SHELLENV_GET_PROT GetProt
;
929 SHELLENV_CUR_DIR CurDir
;
930 SHELLENV_FILE_META_ARG FileMetaArg
;
931 SHELLENV_FREE_FILE_LIST FreeFileList
;
934 // The following services are only used by the shell itself
936 SHELLENV_NEW_SHELL NewShell
;
937 SHELLENV_BATCH_IS_ACTIVE BatchIsActive
;
939 SHELLENV_FREE_RESOURCES FreeResources
;
942 // GUID to differentiate ShellEnvironment2 from ShellEnvironment
946 // Major Version grows if shell environment interface has been changes
950 SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak
;
951 SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak
;
952 SHELLENV_GET_PAGE_BREAK GetPageBreak
;
954 SHELLENV_SET_KEY_FILTER SetKeyFilter
;
955 SHELLENV_GET_KEY_FILTER GetKeyFilter
;
957 SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak
;
958 SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel
;
959 SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel
;
960 SHELLENV_IS_ROOT_SHELL IsRootShell
;
962 SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy
;
963 HANDLE_ENUMERATOR HandleEnumerator
;
964 PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator
;
965 GET_DEVICE_NAME GetDeviceName
;
966 GET_SHELL_MODE GetShellMode
;
967 SHELLENV_NAME_TO_PATH NameToPath
;
968 SHELLENV_GET_FS_NAME GetFsName
;
969 SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard
;
970 SHELLENV_DEL_DUP_FILE DelDupFileArg
;
971 SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath
;
972 } EFI_SHELL_ENVIRONMENT2
;
974 extern EFI_GUID gEfiShellEnvironment2Guid
;
975 extern EFI_GUID gEfiShellEnvironment2ExtGuid
;
976 #endif // _SHELLENV_H_