2 Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation,
3 manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
11 #define _SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
21 } SHELL_OPERATION_TYPES
;
24 creates a new EFI_SHELL_PARAMETERS_PROTOCOL instance and populates it and then
25 installs it on our handle and if there is an existing version of the protocol
26 that one is cached for removal later.
28 @param[in, out] NewShellParameters on a successful return, a pointer to pointer
29 to the newly installed interface.
30 @param[in, out] RootShellInstance on a successful return, pointer to boolean.
31 TRUE if this is the root shell instance.
33 @retval EFI_SUCCESS the operation completed successfully.
34 @return other the operation failed.
35 @sa ReinstallProtocolInterface
36 @sa InstallProtocolInterface
37 @sa ParseCommandLineToArgs
40 CreatePopulateInstallShellParametersProtocol (
41 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
**NewShellParameters
,
42 IN OUT BOOLEAN
*RootShellInstance
46 frees all memory used by creation and installation of shell parameters protocol
47 and if there was an old version installed it will restore that one.
49 @param NewShellParameters the interface of EFI_SHELL_PARAMETERS_PROTOCOL that is
52 @retval EFI_SUCCESS the cleanup was successful
53 @return other the cleanup failed
54 @sa ReinstallProtocolInterface
55 @sa UninstallProtocolInterface
58 CleanUpShellParametersProtocol (
59 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
*NewShellParameters
63 Function will replace the current Argc and Argv in the ShellParameters protocol
64 structure by parsing NewCommandLine. The current values are returned to the
67 @param[in, out] ShellParameters pointer to parameter structure to modify
68 @param[in] NewCommandLine the new command line to parse and use
69 @param[in] Type the type of operation.
70 @param[out] OldArgv pointer to old list of parameters
71 @param[out] OldArgc pointer to old number of items in Argv list
73 @retval EFI_SUCCESS operation was successful, Argv and Argc are valid
74 @return EFI_INVALID_PARAMETER some parameters are invalid
75 @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
79 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
80 IN CONST CHAR16
*NewCommandLine
,
81 IN SHELL_OPERATION_TYPES Type
,
82 OUT CHAR16
***OldArgv
,
87 Function will replace the current Argc and Argv in the ShellParameters protocol
88 structure with Argv and Argc. The current values are de-allocated and the
89 OldArgv must not be deallocated by the caller.
91 @param[in, out] ShellParameters pointer to parameter structure to modify
92 @param[in] OldArgv pointer to old list of parameters
93 @param[in] OldArgc pointer to old number of items in Argv list
97 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
103 EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*ConIn
;
104 EFI_HANDLE ConInHandle
;
105 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ConOut
;
106 EFI_HANDLE ConOutHandle
;
107 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ErrOut
;
108 EFI_HANDLE ErrOutHandle
;
112 Function will replace the current StdIn and StdOut in the ShellParameters protocol
113 structure by parsing NewCommandLine. The current values are returned to the
116 This will also update the system table.
118 @param[in, out] ShellParameters Pointer to parameter structure to modify.
119 @param[in] NewCommandLine The new command line to parse and use.
120 @param[out] OldStdIn Pointer to old StdIn.
121 @param[out] OldStdOut Pointer to old StdOut.
122 @param[out] OldStdErr Pointer to old StdErr.
123 @param[out] SystemTableInfo Pointer to old system table information.
125 @retval EFI_SUCCESS Operation was successful, Argv and Argc are valid.
126 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
129 UpdateStdInStdOutStdErr(
130 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
131 IN CHAR16
*NewCommandLine
,
132 OUT SHELL_FILE_HANDLE
*OldStdIn
,
133 OUT SHELL_FILE_HANDLE
*OldStdOut
,
134 OUT SHELL_FILE_HANDLE
*OldStdErr
,
135 OUT SYSTEM_TABLE_INFO
*SystemTableInfo
139 Function will replace the current StdIn and StdOut in the ShellParameters protocol
140 structure with StdIn and StdOut. The current values are de-allocated.
142 @param[in, out] ShellParameters Pointer to parameter structure to modify.
143 @param[in] OldStdIn Pointer to old StdIn.
144 @param[in] OldStdOut Pointer to old StdOut.
145 @param[in] OldStdErr Pointer to old StdErr.
146 @param[in] SystemTableInfo Pointer to old system table information.
149 RestoreStdInStdOutStdErr (
150 IN OUT EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
151 IN SHELL_FILE_HANDLE
*OldStdIn
,
152 IN SHELL_FILE_HANDLE
*OldStdOut
,
153 IN SHELL_FILE_HANDLE
*OldStdErr
,
154 IN SYSTEM_TABLE_INFO
*SystemTableInfo
158 function to populate Argc and Argv.
160 This function parses the CommandLine and divides it into standard C style Argc/Argv
161 parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space
162 delimited and quote surrounded parameter definition.
164 @param[in] CommandLine String of command line to parse
165 @param[in] StripQuotation if TRUE then strip the quotation marks surrounding
167 @param[in, out] Argv pointer to array of strings; one for each parameter
168 @param[in, out] Argc pointer to number of strings in Argv array
170 @return EFI_SUCCESS the operation was successful
171 @return EFI_INVALID_PARAMETER some parameters are invalid
172 @return EFI_OUT_OF_RESOURCES a memory allocation failed.
175 ParseCommandLineToArgs(
176 IN CONST CHAR16
*CommandLine
,
177 IN BOOLEAN StripQuotation
,
178 IN OUT CHAR16
***Argv
,
183 return the next parameter from a command line string;
185 This function moves the next parameter from Walker into TempParameter and moves
186 Walker up past that parameter for recursive calling. When the final parameter
187 is moved *Walker will be set to NULL;
189 Temp Parameter must be large enough to hold the parameter before calling this
192 @param[in, out] Walker pointer to string of command line. Adjusted to
193 remaining command line on return
194 @param[in, out] TempParameter pointer to string of command line item extracted.
195 @param[in] Length Length of (*TempParameter) in bytes
196 @param[in] StripQuotation if TRUE then strip the quotation marks surrounding
199 @return EFI_INVALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
200 @return EFI_NOT_FOUND A closing " could not be found on the specified string
204 IN OUT CHAR16
**Walker
,
205 IN OUT CHAR16
**TempParameter
,
206 IN CONST UINTN Length
,
207 IN BOOLEAN StripQuotation
210 #endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_