]>
Commit | Line | Data |
---|---|---|
94b17fa1 | 1 | /** @file\r |
9b3bf083 | 2 | Defines for EFI shell environment 2 ported to EDK II build environment. (no spec)\r |
94b17fa1 | 3 | \r |
1e6e84c7 | 4 | Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r |
56ba3746 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
94b17fa1 | 6 | \r |
7 | **/\r | |
8 | \r | |
1e6e84c7 | 9 | \r |
a405b86d | 10 | #ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |
b3011f40 | 11 | #define _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |
94b17fa1 | 12 | \r |
13 | #define DEFAULT_INIT_ROW 1\r | |
14 | #define DEFAULT_AUTO_LF FALSE\r | |
15 | \r | |
94b17fa1 | 16 | /**\r |
1e6e84c7 | 17 | This function is a prototype for a function that dumps information on a protocol\r |
18 | to a given location. The location is dependant on the implementation. This is\r | |
94b17fa1 | 19 | used when programatically adding shell commands.\r |
20 | \r | |
a405b86d | 21 | @param[in] Handle The handle the protocol is on.\r |
22 | @param[in] Interface The interface to the protocol.\r | |
94b17fa1 | 23 | \r |
24 | **/\r | |
25 | typedef\r | |
26 | VOID\r | |
27 | (EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO) (\r | |
28 | IN EFI_HANDLE Handle,\r | |
29 | IN VOID *Interface\r | |
30 | );\r | |
31 | \r | |
32 | /**\r | |
1e6e84c7 | 33 | This function is a prototype for each command internal to the EFI shell\r |
34 | implementation. The specific command depends on the implementation. This is\r | |
94b17fa1 | 35 | used when programatically adding shell commands.\r |
36 | \r | |
a405b86d | 37 | @param[in] ImageHandle The handle to the binary shell.\r |
38 | @param[in] SystemTable The pointer to the system table.\r | |
94b17fa1 | 39 | \r |
a405b86d | 40 | @retval EFI_SUCCESS The command completed.\r |
41 | @retval other An error occurred. Any error is possible\r | |
1e6e84c7 | 42 | depending on the implementation of the shell\r |
94b17fa1 | 43 | command.\r |
44 | \r | |
45 | **/\r | |
46 | typedef\r | |
47 | EFI_STATUS\r | |
48 | (EFIAPI *SHELLENV_INTERNAL_COMMAND) (\r | |
49 | IN EFI_HANDLE ImageHandle,\r | |
50 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
51 | );\r | |
52 | \r | |
53 | /**\r | |
1e6e84c7 | 54 | This function is a prototype for one that gets a help string for a given command.\r |
55 | This is used when programatically adding shell commands. Upon successful return\r | |
94b17fa1 | 56 | the memory allocated is up to the caller to free.\r |
57 | \r | |
4ff7e37b | 58 | @param[in, out] Str Pointer to pointer to string to display for help.\r |
94b17fa1 | 59 | \r |
b3011f40 | 60 | @retval EFI_SUCCESS The help string is in the parameter Str.\r |
94b17fa1 | 61 | \r |
62 | **/\r | |
63 | typedef\r | |
64 | EFI_STATUS\r | |
65 | (EFIAPI *SHELLCMD_GET_LINE_HELP) (\r | |
66 | IN OUT CHAR16 **Str\r | |
67 | );\r | |
68 | \r | |
69 | /**\r | |
a31bd33c | 70 | Structure returned from functions that open multiple files.\r |
94b17fa1 | 71 | **/\r |
72 | typedef struct {\r | |
1e6e84c7 | 73 | UINT32 Signature; ///< SHELL_FILE_ARG_SIGNATURE.\r |
74 | LIST_ENTRY Link; ///< Linked list helper.\r | |
75 | EFI_STATUS Status; ///< File's status.\r | |
94b17fa1 | 76 | \r |
1e6e84c7 | 77 | EFI_FILE_HANDLE Parent; ///< What is the Parent file of this file.\r |
78 | UINT64 OpenMode; ///< How was the file opened.\r | |
79 | CHAR16 *ParentName; ///< String representation of parent.\r | |
80 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; ///< DevicePath for Parent.\r | |
94b17fa1 | 81 | \r |
1e6e84c7 | 82 | CHAR16 *FullName; ///< Path and file name for this file.\r |
83 | CHAR16 *FileName; ///< File name for this file.\r | |
94b17fa1 | 84 | \r |
1e6e84c7 | 85 | EFI_FILE_HANDLE Handle; ///< Handle to this file.\r |
86 | EFI_FILE_INFO *Info; ///< Pointer to file info for this file.\r | |
94b17fa1 | 87 | } SHELL_FILE_ARG;\r |
88 | \r | |
1e6e84c7 | 89 | /// Signature for SHELL_FILE_ARG.\r |
90 | #define SHELL_FILE_ARG_SIGNATURE SIGNATURE_32 ('g', 'r', 'a', 'f')\r | |
94b17fa1 | 91 | \r |
92 | /**\r | |
b3011f40 | 93 | GUID for the shell environment2 and shell environment.\r |
94b17fa1 | 94 | **/\r |
95 | #define SHELL_ENVIRONMENT_PROTOCOL_GUID \\r | |
96 | { \\r | |
55034088 | 97 | 0x47c7b221, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \\r |
94b17fa1 | 98 | }\r |
99 | \r | |
100 | /**\r | |
b3011f40 | 101 | GUID for the shell environment2 extension (main GUID above).\r |
94b17fa1 | 102 | **/\r |
103 | #define EFI_SE_EXT_SIGNATURE_GUID \\r | |
104 | { \\r | |
105 | 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \\r | |
106 | }\r | |
107 | \r | |
a405b86d | 108 | #define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.\r |
109 | #define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.\r | |
94b17fa1 | 110 | \r |
111 | /**\r | |
1e6e84c7 | 112 | Execute a command line.\r |
94b17fa1 | 113 | \r |
1e6e84c7 | 114 | This function will run the CommandLine. This includes loading any required images,\r |
115 | parsing any requires scripts, and if DebugOutput is TRUE printing errors\r | |
94b17fa1 | 116 | encountered directly to the screen.\r |
1e6e84c7 | 117 | \r |
a405b86d | 118 | @param[in] ParentImageHandle Handle of the image executing this operation.\r |
119 | @param[in] CommandLine The string command line to execute.\r | |
120 | @param[in] DebugOutput TRUE indicates that errors should be printed directly.\r | |
268d3445 | 121 | FALSE suppresses error messages.\r |
94b17fa1 | 122 | \r |
a31bd33c | 123 | @retval EFI_SUCCESS The command line executed and completed.\r |
a405b86d | 124 | @retval EFI_ABORTED The operation aborted.\r |
94b17fa1 | 125 | @retval EFI_INVALID_PARAMETER A parameter did not have a valid value.\r |
126 | @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.\r | |
127 | \r | |
128 | @sa HandleProtocol\r | |
129 | **/\r | |
130 | typedef\r | |
131 | EFI_STATUS\r | |
132 | (EFIAPI *SHELLENV_EXECUTE) (\r | |
133 | IN EFI_HANDLE *ParentImageHandle,\r | |
134 | IN CHAR16 *CommandLine,\r | |
135 | IN BOOLEAN DebugOutput\r | |
136 | );\r | |
137 | \r | |
138 | /**\r | |
b3011f40 | 139 | This function returns a shell environment variable value.\r |
94b17fa1 | 140 | \r |
a405b86d | 141 | @param[in] Name The pointer to the string with the shell environment\r |
b3011f40 | 142 | variable name.\r |
94b17fa1 | 143 | \r |
b3011f40 | 144 | @retval NULL The shell environment variable's value could not be found.\r |
1e6e84c7 | 145 | @retval !=NULL The value of the shell environment variable Name.\r |
94b17fa1 | 146 | \r |
147 | **/\r | |
1e6e84c7 | 148 | typedef\r |
149 | CHAR16 *\r | |
94b17fa1 | 150 | (EFIAPI *SHELLENV_GET_ENV) (\r |
151 | IN CHAR16 *Name\r | |
152 | );\r | |
153 | \r | |
154 | /**\r | |
b3011f40 | 155 | This function returns a shell environment map value.\r |
94b17fa1 | 156 | \r |
a405b86d | 157 | @param[in] Name The pointer to the string with the shell environment\r |
b3011f40 | 158 | map name.\r |
94b17fa1 | 159 | \r |
b3011f40 | 160 | @retval NULL The shell environment map's value could not be found.\r |
1e6e84c7 | 161 | @retval !=NULL The value of the shell environment map Name.\r |
94b17fa1 | 162 | \r |
163 | **/\r | |
1e6e84c7 | 164 | typedef\r |
165 | CHAR16 *\r | |
94b17fa1 | 166 | (EFIAPI *SHELLENV_GET_MAP) (\r |
167 | IN CHAR16 *Name\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | This function will add an internal command to the shell interface.\r | |
172 | \r | |
173 | This will allocate all required memory, put the new command on the command\r | |
174 | list in the correct location.\r | |
175 | \r | |
a405b86d | 176 | @param[in] Handler The handler function to call when the command gets called.\r |
177 | @param[in] Cmd The command name.\r | |
178 | @param[in] GetLineHelp The function to call of type "get help" for this command.\r | |
94b17fa1 | 179 | \r |
b3011f40 | 180 | @retval EFI_SUCCESS The command is now part of the command list.\r |
181 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
94b17fa1 | 182 | @sa SHELLENV_INTERNAL_COMMAND\r |
183 | @sa SHELLCMD_GET_LINE_HELP\r | |
184 | **/\r | |
185 | typedef\r | |
186 | EFI_STATUS\r | |
187 | (EFIAPI *SHELLENV_ADD_CMD) (\r | |
188 | IN SHELLENV_INTERNAL_COMMAND Handler,\r | |
189 | IN CHAR16 *Cmd,\r | |
190 | IN SHELLCMD_GET_LINE_HELP GetLineHelp\r | |
191 | );\r | |
192 | \r | |
193 | /**\r | |
194 | Internal interface to add protocol handlers.\r | |
195 | \r | |
196 | This function is for internal shell use only. This is how protocol handlers are added.\r | |
197 | This will get the current protocol info and add the new info or update existing info\r | |
198 | and then resave the info.\r | |
199 | \r | |
a405b86d | 200 | @param[in] Protocol The pointer to the protocol's GUID.\r |
201 | @param[in] DumpToken The function pointer to dump token function or\r | |
b3011f40 | 202 | NULL.\r |
a405b86d | 203 | @param[in] DumpInfo The function pointer to dump infomation function\r |
b3011f40 | 204 | or NULL.\r |
a405b86d | 205 | @param[in] IdString The English name of the protocol.\r |
94b17fa1 | 206 | **/\r |
207 | typedef\r | |
208 | VOID\r | |
209 | (EFIAPI *SHELLENV_ADD_PROT) (\r | |
210 | IN EFI_GUID *Protocol,\r | |
211 | IN SHELLENV_DUMP_PROTOCOL_INFO DumpToken OPTIONAL,\r | |
212 | IN SHELLENV_DUMP_PROTOCOL_INFO DumpInfo OPTIONAL,\r | |
213 | IN CHAR16 *IdString\r | |
214 | );\r | |
215 | \r | |
216 | /**\r | |
1e6e84c7 | 217 | This function finds a protocol handle by a GUID.\r |
94b17fa1 | 218 | \r |
1e6e84c7 | 219 | This function will check for already known protocols by GUID and if one is\r |
220 | found it will return the name of that protocol. If no name is found and\r | |
94b17fa1 | 221 | GenId is TRUE it will generate ths string.\r |
222 | \r | |
a405b86d | 223 | @param[in] Protocol The GUID of the protocol to look for.\r |
224 | @param[in] GenId Whether to generate a name string if it is not found.\r | |
94b17fa1 | 225 | \r |
a405b86d | 226 | @return !NULL The Name of the protocol.\r |
227 | @retval NULL The Name was not found, and GenId was not TRUE.\r | |
94b17fa1 | 228 | **/\r |
1e6e84c7 | 229 | typedef\r |
94b17fa1 | 230 | CHAR16*\r |
231 | (EFIAPI *SHELLENV_GET_PROT) (\r | |
1e6e84c7 | 232 | IN EFI_GUID *Protocol,\r |
94b17fa1 | 233 | IN BOOLEAN GenId\r |
234 | );\r | |
235 | \r | |
236 | /**\r | |
1e6e84c7 | 237 | This function returns a string array containing the current directory on\r |
238 | a given device.\r | |
94b17fa1 | 239 | \r |
1e6e84c7 | 240 | If DeviceName is specified, then return the current shell directory on that\r |
241 | device. If DeviceName is NULL, then return the current directory on the\r | |
94b17fa1 | 242 | current device. The caller us responsible to free the returned string when\r |
a405b86d | 243 | no longer required.\r |
94b17fa1 | 244 | \r |
a405b86d | 245 | @param[in] DeviceName The name of the device to get the current\r |
246 | directory on, or NULL for current device.\r | |
94b17fa1 | 247 | \r |
1e6e84c7 | 248 | @return String array with the current directory on the current or specified device.\r |
94b17fa1 | 249 | \r |
250 | **/\r | |
1e6e84c7 | 251 | typedef\r |
94b17fa1 | 252 | CHAR16*\r |
253 | (EFIAPI *SHELLENV_CUR_DIR) (\r | |
254 | IN CHAR16 *DeviceName OPTIONAL\r | |
255 | );\r | |
256 | \r | |
257 | /**\r | |
1e6e84c7 | 258 | This function will open a group of files that match the Arg path, including\r |
259 | support for wildcard characters ('?' and '*') in the Arg path. If there are\r | |
94b17fa1 | 260 | any wildcard characters in the path this function will find any and all files\r |
1e6e84c7 | 261 | that match the wildcards. It returns a double linked list based on the\r |
262 | LIST_ENTRY linked list structure. Use this in conjunction with the\r | |
94b17fa1 | 263 | SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.\r |
1e6e84c7 | 264 | The memory allocated by the callee for this list is freed by making a call to\r |
94b17fa1 | 265 | SHELLENV_FREE_FILE_LIST.\r |
266 | \r | |
4ff7e37b ED |
267 | @param[in] Arg The pointer Path to files to open.\r |
268 | @param[in, out] ListHead The pointer to the allocated and initialized list head\r | |
269 | upon which to append all opened file structures.\r | |
94b17fa1 | 270 | \r |
a405b86d | 271 | @retval EFI_SUCCESS One or more files was opened and a struct of each file's\r |
94b17fa1 | 272 | information was appended to ListHead.\r |
b3011f40 | 273 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r |
274 | @retval EFI_NOT_FOUND No matching files could be found.\r | |
94b17fa1 | 275 | @sa SHELLENV_FREE_FILE_LIST\r |
276 | **/typedef\r | |
277 | EFI_STATUS\r | |
278 | (EFIAPI *SHELLENV_FILE_META_ARG) (\r | |
279 | IN CHAR16 *Arg,\r | |
d2b4564b | 280 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 281 | );\r |
282 | \r | |
283 | /**\r | |
b3011f40 | 284 | This frees all of the nodes under the ListHead, but not ListHead itself.\r |
94b17fa1 | 285 | \r |
4ff7e37b | 286 | @param[in, out] ListHead Pointer to list to free all nodes of.\r |
94b17fa1 | 287 | \r |
a405b86d | 288 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r |
94b17fa1 | 289 | **/\r |
290 | typedef\r | |
291 | EFI_STATUS\r | |
292 | (EFIAPI *SHELLENV_FREE_FILE_LIST) (\r | |
d2b4564b | 293 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 294 | );\r |
295 | \r | |
296 | /**\r | |
1e6e84c7 | 297 | This function creates a new instance of the ShellInterface protocol for use on\r |
94b17fa1 | 298 | the ImageHandle.\r |
299 | \r | |
1e6e84c7 | 300 | This function is for internal shell usage. This will allocate and then populate\r |
301 | EFI_SHELL_INTERFACE protocol. It is the caller's responsibility to free the\r | |
94b17fa1 | 302 | memory.\r |
303 | \r | |
a405b86d | 304 | @param[in] ImageHandle The handle which will use the new ShellInterface\r |
94b17fa1 | 305 | protocol.\r |
306 | \r | |
a405b86d | 307 | @return The newly allocated shell interface protocol.\r |
94b17fa1 | 308 | \r |
309 | **/\r | |
1e6e84c7 | 310 | typedef\r |
311 | EFI_SHELL_INTERFACE*\r | |
94b17fa1 | 312 | (EFIAPI *SHELLENV_NEW_SHELL) (\r |
313 | IN EFI_HANDLE ImageHandle\r | |
314 | );\r | |
315 | \r | |
316 | /**\r | |
cceb4ebd | 317 | This function determines whether a script file is currently being processed.\r |
94b17fa1 | 318 | \r |
1e6e84c7 | 319 | A script file (.nsh file) can contain a series of commands and this is useful to\r |
320 | know for some shell commands whether they are being run manually or as part of a\r | |
94b17fa1 | 321 | script.\r |
322 | \r | |
b3011f40 | 323 | @retval TRUE A script file is being processed.\r |
324 | @retval FALSE A script file is not being processed.\r | |
94b17fa1 | 325 | **/\r |
326 | typedef\r | |
327 | BOOLEAN\r | |
328 | (EFIAPI *SHELLENV_BATCH_IS_ACTIVE) (\r | |
a405b86d | 329 | VOID\r |
94b17fa1 | 330 | );\r |
331 | \r | |
332 | /**\r | |
1e6e84c7 | 333 | This is an internal shell function to free any and all allocated resources.\r |
a405b86d | 334 | This should be called immediately prior to closing the shell.\r |
94b17fa1 | 335 | **/\r |
336 | typedef\r | |
337 | VOID\r | |
338 | (EFIAPI *SHELLENV_FREE_RESOURCES) (\r | |
339 | VOID\r | |
340 | );\r | |
341 | \r | |
342 | /**\r | |
343 | This function enables the page break mode.\r | |
344 | \r | |
1e6e84c7 | 345 | This mode causes the output to pause after each complete screen to enable a\r |
a405b86d | 346 | user to more easily read it. If AutoWrap is TRUE, then rows with too many\r |
347 | characters will be chopped and divided into 2 rows. If FALSE, then rows with\r | |
94b17fa1 | 348 | too many characters may not be fully visible to the user on the screen.\r |
349 | \r | |
a405b86d | 350 | @param[in] StartRow The row number to start this on.\r |
351 | @param[in] AutoWrap Whether to auto wrap rows that are too long.\r | |
94b17fa1 | 352 | **/\r |
353 | typedef\r | |
354 | VOID\r | |
355 | (EFIAPI *SHELLENV_ENABLE_PAGE_BREAK) (\r | |
356 | IN INT32 StartRow,\r | |
357 | IN BOOLEAN AutoWrap\r | |
358 | );\r | |
359 | \r | |
360 | /**\r | |
361 | This function disables the page break mode.\r | |
362 | \r | |
a405b86d | 363 | Disabling this causes the output to print out exactly as coded, with no breaks\r |
94b17fa1 | 364 | for readability.\r |
365 | **/\r | |
366 | typedef\r | |
367 | VOID\r | |
368 | (EFIAPI *SHELLENV_DISABLE_PAGE_BREAK) (\r | |
a405b86d | 369 | VOID\r |
94b17fa1 | 370 | );\r |
371 | \r | |
372 | /**\r | |
373 | Get the status of the page break output mode.\r | |
374 | \r | |
b3011f40 | 375 | @retval FALSE Page break output mode is not enabled.\r |
376 | @retval TRUE Page break output mode is enabled.\r | |
94b17fa1 | 377 | **/\r |
378 | typedef\r | |
379 | BOOLEAN\r | |
380 | (EFIAPI *SHELLENV_GET_PAGE_BREAK) (\r | |
a405b86d | 381 | VOID\r |
94b17fa1 | 382 | );\r |
383 | \r | |
384 | /**\r | |
1e6e84c7 | 385 | This function sets the keys to filter for for the console in. The valid\r |
94b17fa1 | 386 | values to set are:\r |
387 | \r | |
388 | #define EFI_OUTPUT_SCROLL 0x00000001\r | |
389 | #define EFI_OUTPUT_PAUSE 0x00000002\r | |
390 | #define EFI_EXECUTION_BREAK 0x00000004\r | |
391 | \r | |
a405b86d | 392 | @param[in] KeyFilter The new key filter to use.\r |
94b17fa1 | 393 | **/\r |
394 | typedef\r | |
395 | VOID\r | |
396 | (EFIAPI *SHELLENV_SET_KEY_FILTER) (\r | |
397 | IN UINT32 KeyFilter\r | |
398 | );\r | |
399 | \r | |
400 | /**\r | |
1e6e84c7 | 401 | This function gets the keys to filter for for the console in.\r |
94b17fa1 | 402 | \r |
b3011f40 | 403 | The valid values to get are:\r |
94b17fa1 | 404 | #define EFI_OUTPUT_SCROLL 0x00000001\r |
405 | #define EFI_OUTPUT_PAUSE 0x00000002\r | |
406 | #define EFI_EXECUTION_BREAK 0x00000004\r | |
407 | \r | |
a405b86d | 408 | @retval The current filter mask.\r |
94b17fa1 | 409 | **/\r |
410 | typedef\r | |
411 | UINT32\r | |
412 | (EFIAPI *SHELLENV_GET_KEY_FILTER) (\r | |
a405b86d | 413 | VOID\r |
94b17fa1 | 414 | );\r |
415 | \r | |
416 | /**\r | |
cceb4ebd | 417 | This function determines if the shell application should break.\r |
94b17fa1 | 418 | \r |
1e6e84c7 | 419 | This is used to inform a shell application that a break condition has been\r |
b3011f40 | 420 | initiated. Long loops should check this to prevent delays to the break.\r |
94b17fa1 | 421 | \r |
a405b86d | 422 | @retval TRUE A break has been signaled. The application\r |
94b17fa1 | 423 | should exit with EFI_ABORTED as soon as possible.\r |
b3011f40 | 424 | @retval FALSE Continue as normal.\r |
94b17fa1 | 425 | **/\r |
426 | typedef\r | |
427 | BOOLEAN\r | |
428 | (EFIAPI *SHELLENV_GET_EXECUTION_BREAK) (\r | |
a405b86d | 429 | VOID\r |
94b17fa1 | 430 | );\r |
431 | \r | |
432 | /**\r | |
a405b86d | 433 | This is an internal shell function used to increment the shell nesting level.\r |
94b17fa1 | 434 | \r |
435 | **/\r | |
436 | typedef\r | |
437 | VOID\r | |
438 | (EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL) (\r | |
a405b86d | 439 | VOID\r |
94b17fa1 | 440 | );\r |
441 | \r | |
442 | /**\r | |
a405b86d | 443 | This is an internal shell function used to decrement the shell nesting level.\r |
94b17fa1 | 444 | **/\r |
445 | typedef\r | |
446 | VOID\r | |
447 | (EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL) (\r | |
a405b86d | 448 | VOID\r |
94b17fa1 | 449 | );\r |
450 | \r | |
451 | /**\r | |
cceb4ebd | 452 | This function determines if the caller is running under the root shell.\r |
94b17fa1 | 453 | \r |
b3011f40 | 454 | @retval TRUE The caller is running under the root shell.\r |
455 | @retval FALSE The caller is not running under the root shell.\r | |
94b17fa1 | 456 | \r |
457 | **/\r | |
458 | typedef\r | |
459 | BOOLEAN\r | |
460 | (EFIAPI *SHELLENV_IS_ROOT_SHELL) (\r | |
a405b86d | 461 | VOID\r |
94b17fa1 | 462 | );\r |
463 | \r | |
464 | /**\r | |
465 | Close the console proxy to restore the original console.\r | |
466 | \r | |
1e6e84c7 | 467 | This is an internal shell function to handle shell cascading. It restores the\r |
94b17fa1 | 468 | original set of console protocols.\r |
1e6e84c7 | 469 | \r |
4ff7e37b ED |
470 | @param[in] ConInHandle The handle of ConIn.\r |
471 | @param[in, out] ConIn The pointer to the location to return the pointer to\r | |
472 | the original console input.\r | |
473 | @param[in] ConOutHandle The handle of ConOut\r | |
474 | @param[in, out] ConOut The pointer to the location to return the pointer to\r | |
475 | the original console output.\r | |
94b17fa1 | 476 | **/\r |
477 | typedef\r | |
478 | VOID\r | |
479 | (EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY) (\r | |
480 | IN EFI_HANDLE ConInHandle,\r | |
481 | IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL **ConIn,\r | |
482 | IN EFI_HANDLE ConOutHandle,\r | |
483 | IN OUT EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL **ConOut\r | |
484 | );\r | |
485 | \r | |
486 | //\r | |
487 | // declarations of handle enumerator\r | |
488 | //\r | |
489 | /**\r | |
490 | For ease of use the shell maps handle #'s to short numbers.\r | |
1e6e84c7 | 491 | This is only done on request for various internal commands and the references\r |
94b17fa1 | 492 | are immediately freed when the internal command completes.\r |
493 | **/\r | |
494 | typedef\r | |
495 | VOID\r | |
496 | (EFIAPI *INIT_HANDLE_ENUMERATOR) (\r | |
497 | VOID\r | |
498 | );\r | |
499 | \r | |
500 | /**\r | |
b3011f40 | 501 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 502 | \r |
1e6e84c7 | 503 | This function gets the next handle in the handle database. If no handles are\r |
a405b86d | 504 | found, EFI_NOT_FOUND is returned. If the previous Handle was the last handle,\r |
94b17fa1 | 505 | it is set to NULL before returning.\r |
506 | \r | |
b3011f40 | 507 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 508 | \r |
4ff7e37b ED |
509 | @param[in, out] Handle The pointer to pointer to Handle. It is set\r |
510 | on a sucessful return.\r | |
94b17fa1 | 511 | \r |
b3011f40 | 512 | @retval EFI_SUCCESS The next handle in the handle database is *Handle.\r |
513 | @retval EFI_NOT_FOUND There is not another handle.\r | |
94b17fa1 | 514 | **/\r |
515 | typedef\r | |
516 | EFI_STATUS\r | |
517 | (EFIAPI *NEXT_HANDLE) (\r | |
518 | IN OUT EFI_HANDLE **Handle\r | |
519 | );\r | |
520 | \r | |
521 | /**\r | |
b3011f40 | 522 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 523 | \r |
1e6e84c7 | 524 | This function skips the next SkipNum handles in the handle database. If there\r |
525 | are not enough handles left to skip that many EFI_ACCESS_DENIED is returned and\r | |
94b17fa1 | 526 | no skip is performed.\r |
527 | \r | |
b3011f40 | 528 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 529 | \r |
a405b86d | 530 | @param[in] SkipNum How many handles to skip\r |
94b17fa1 | 531 | \r |
a405b86d | 532 | @retval EFI_SUCCESS The next handle in the handle database is *Handle\r |
533 | @retval EFI_ACCESS_DENIED There are not SkipNum handles left in the database\r | |
94b17fa1 | 534 | **/\r |
535 | typedef\r | |
536 | EFI_STATUS\r | |
537 | (EFIAPI *SKIP_HANDLE) (\r | |
538 | IN UINTN SkipNum\r | |
539 | );\r | |
540 | \r | |
541 | /**\r | |
b3011f40 | 542 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 543 | \r |
1e6e84c7 | 544 | This function resets the the handle database so that NEXT_HANDLE and SKIP_HANDLE\r |
545 | will start from EnumIndex on the next call.\r | |
546 | \r | |
b3011f40 | 547 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 548 | \r |
a405b86d | 549 | @param[in] EnumIndex Where to start.\r |
94b17fa1 | 550 | \r |
a405b86d | 551 | @return The number of handles either read out or skipped before this reset.\r |
94b17fa1 | 552 | **/\r |
553 | typedef\r | |
554 | UINTN\r | |
555 | (EFIAPI *RESET_HANDLE_ENUMERATOR) (\r | |
556 | IN UINTN EnumIndex\r | |
557 | );\r | |
558 | \r | |
559 | /**\r | |
b3011f40 | 560 | This is an internal shell function to enumerate the handle database.\r |
1e6e84c7 | 561 | \r |
b3011f40 | 562 | This must be called after INIT_HANDLE_ENUMERATOR.\r |
94b17fa1 | 563 | \r |
b3011f40 | 564 | This function releases all memory and resources associated with the handle database.\r |
a405b86d | 565 | After this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will\r |
94b17fa1 | 566 | function properly.\r |
567 | **/\r | |
568 | typedef\r | |
569 | VOID\r | |
570 | (EFIAPI *CLOSE_HANDLE_ENUMERATOR) (\r | |
571 | VOID\r | |
572 | );\r | |
573 | \r | |
574 | /**\r | |
b3011f40 | 575 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 576 | \r |
b3011f40 | 577 | This function returns the number of handles in the handle database.\r |
1e6e84c7 | 578 | \r |
b3011f40 | 579 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 580 | \r |
a405b86d | 581 | @return The number of handles in the handle database.\r |
94b17fa1 | 582 | **/\r |
583 | typedef\r | |
584 | UINTN\r | |
585 | (EFIAPI *GET_NUM) (\r | |
586 | VOID\r | |
587 | );\r | |
588 | \r | |
589 | /**\r | |
b3011f40 | 590 | Handle Enumerator structure.\r |
94b17fa1 | 591 | **/\r |
592 | typedef struct {\r | |
a405b86d | 593 | INIT_HANDLE_ENUMERATOR Init; ///< The pointer to INIT_HANDLE_ENUMERATOR function.\r |
594 | NEXT_HANDLE Next; ///< The pointer to NEXT_HANDLE function.\r | |
595 | SKIP_HANDLE Skip; ///< The pointer to SKIP_HANDLE function.\r | |
596 | RESET_HANDLE_ENUMERATOR Reset; ///< The pointer to RESET_HANDLE_ENUMERATOR function.\r | |
597 | CLOSE_HANDLE_ENUMERATOR Close; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.\r | |
598 | GET_NUM GetNum; ///< The pointer to GET_NUM function.\r | |
94b17fa1 | 599 | } HANDLE_ENUMERATOR;\r |
b3011f40 | 600 | \r |
94b17fa1 | 601 | /**\r |
b3011f40 | 602 | Signature for the PROTOCOL_INFO structure.\r |
94b17fa1 | 603 | **/\r |
604 | #define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')\r | |
b3011f40 | 605 | \r |
94b17fa1 | 606 | /**\r |
607 | PROTOCOL_INFO structure for protocol enumerator functions.\r | |
94b17fa1 | 608 | **/\r |
609 | typedef struct {\r | |
b3011f40 | 610 | UINTN Signature; ///< PROTOCOL_INFO_SIGNATURE.\r |
a405b86d | 611 | LIST_ENTRY Link; ///< Standard linked list helper member.\r |
94b17fa1 | 612 | //\r |
b3011f40 | 613 | // The parsing info for the protocol.\r |
94b17fa1 | 614 | //\r |
a405b86d | 615 | EFI_GUID ProtocolId; ///< The GUID for the protocol.\r |
616 | CHAR16 *IdString; ///< The name of the protocol.\r | |
617 | SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< The pointer to DumpToken function for the protocol.\r | |
618 | SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< The pointer to DumpInfo function for the protocol.\r | |
94b17fa1 | 619 | //\r |
b3011f40 | 620 | // Patabase info on which handles are supporting this protocol.\r |
94b17fa1 | 621 | //\r |
a405b86d | 622 | UINTN NoHandles; ///< The number of handles producing this protocol.\r |
b3011f40 | 623 | EFI_HANDLE *Handles; ///< The array of handles.\r |
94b17fa1 | 624 | \r |
625 | } PROTOCOL_INFO;\r | |
626 | \r | |
627 | //\r | |
b3011f40 | 628 | // Declarations of protocol info enumerator.\r |
94b17fa1 | 629 | //\r |
630 | /**\r | |
b3011f40 | 631 | This is an internal shell function to initialize the protocol enumerator.\r |
94b17fa1 | 632 | \r |
1e6e84c7 | 633 | This must be called before NEXT_PROTOCOL_INFO, SKIP_PROTOCOL_INFO,\r |
94b17fa1 | 634 | RESET_PROTOCOL_INFO_ENUMERATOR, and CLOSE_PROTOCOL_INFO_ENUMERATOR are\r |
635 | called.\r | |
636 | **/\r | |
637 | typedef\r | |
638 | VOID\r | |
639 | (EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR) (\r | |
640 | VOID\r | |
641 | );\r | |
642 | \r | |
643 | /**\r | |
1e6e84c7 | 644 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 645 | \r |
a405b86d | 646 | This function returns the next protocol on the list. If this is called\r |
647 | immediately after initialization, it will return the first protocol on the list.\r | |
648 | If this is called immediately after reset, it will return the first protocol again.\r | |
94b17fa1 | 649 | \r |
1e6e84c7 | 650 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 651 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
652 | \r | |
4ff7e37b | 653 | @param[in, out] ProtocolInfo The pointer to pointer to protocol information structure.\r |
94b17fa1 | 654 | \r |
b3011f40 | 655 | @retval EFI_SUCCESS The next protocol's information was sucessfully returned.\r |
656 | @retval NULL There are no more protocols.\r | |
94b17fa1 | 657 | **/\r |
658 | typedef\r | |
659 | EFI_STATUS\r | |
660 | (EFIAPI *NEXT_PROTOCOL_INFO) (\r | |
661 | IN OUT PROTOCOL_INFO **ProtocolInfo\r | |
662 | );\r | |
663 | \r | |
664 | /**\r | |
1e6e84c7 | 665 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 666 | \r |
1e6e84c7 | 667 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 668 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
669 | \r | |
b3011f40 | 670 | This function does nothing and always returns EFI_SUCCESS.\r |
94b17fa1 | 671 | \r |
a405b86d | 672 | @retval EFI_SUCCESS Always returned (see above).\r |
94b17fa1 | 673 | **/\r |
674 | typedef\r | |
675 | EFI_STATUS\r | |
676 | (EFIAPI *SKIP_PROTOCOL_INFO) (\r | |
677 | IN UINTN SkipNum\r | |
678 | );\r | |
679 | \r | |
680 | /**\r | |
1e6e84c7 | 681 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 682 | \r |
1e6e84c7 | 683 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 684 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
685 | \r | |
1e6e84c7 | 686 | This function resets the list of protocols such that the next one in the\r |
94b17fa1 | 687 | list is the begining of the list.\r |
688 | **/\r | |
689 | typedef\r | |
690 | VOID\r | |
691 | (EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR) (\r | |
692 | VOID\r | |
693 | );\r | |
694 | \r | |
695 | \r | |
696 | /**\r | |
1e6e84c7 | 697 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 698 | \r |
699 | This must be called after INIT_PROTOCOL_INFO_ENUMERATOR. After this call\r | |
700 | no protocol enumerator calls except INIT_PROTOCOL_INFO_ENUMERATOR may be made.\r | |
701 | \r | |
b3011f40 | 702 | This function frees any memory or resources associated with the protocol\r |
94b17fa1 | 703 | enumerator.\r |
704 | **/\r | |
705 | typedef\r | |
706 | VOID\r | |
707 | (EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR) (\r | |
708 | VOID\r | |
709 | );\r | |
710 | \r | |
711 | /**\r | |
b3011f40 | 712 | Protocol enumerator structure of function pointers.\r |
94b17fa1 | 713 | **/\r |
714 | typedef struct {\r | |
a405b86d | 715 | INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.\r |
716 | NEXT_PROTOCOL_INFO Next; ///< The pointer to NEXT_PROTOCOL_INFO function.\r | |
717 | SKIP_PROTOCOL_INFO Skip; ///< The pointer to SKIP_PROTOCOL_INFO function.\r | |
718 | RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.\r | |
719 | CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.\r | |
94b17fa1 | 720 | } PROTOCOL_INFO_ENUMERATOR;\r |
721 | \r | |
722 | /**\r | |
1e6e84c7 | 723 | This function is used to retrieve a user-friendly display name for a handle.\r |
94b17fa1 | 724 | \r |
1e6e84c7 | 725 | If UseComponentName is TRUE then the component name protocol for this device\r |
726 | or it's parent device (if required) will be used to obtain the name of the\r | |
94b17fa1 | 727 | device. If UseDevicePath is TRUE it will get the human readable device path\r |
728 | and return that. If both are TRUE it will try to use component name first\r | |
1e6e84c7 | 729 | and device path if that fails.\r |
94b17fa1 | 730 | \r |
1e6e84c7 | 731 | It will use either ComponentName or ComponentName2 protocol, depending on\r |
94b17fa1 | 732 | what is present.\r |
733 | \r | |
734 | This function will furthur verify whether the handle in question produced either\r | |
1e6e84c7 | 735 | EFI_DRIVER_CONFIGRATION_PROTOCOL or EFI_DRIVER_CONFIGURATION2_PROTOCOL and also\r |
736 | whether the handle in question produced either EFI_DRIVER_DIAGNOSTICS_PROTOCOL or\r | |
94b17fa1 | 737 | EFI_DRIVER_DIAGNOSTICS2_PROTOCOL.\r |
1e6e84c7 | 738 | \r |
a405b86d | 739 | Upon successful return, the memory for *BestDeviceName is up to the caller to free.\r |
94b17fa1 | 740 | \r |
4ff7e37b ED |
741 | @param[in] DeviceHandle The device handle whose name is desired.\r |
742 | @param[in] UseComponentName Whether to use the ComponentName protocol at all.\r | |
743 | @param[in] UseDevicePath Whether to use the DevicePath protocol at all.\r | |
744 | @param[in] Language The pointer to the language string to use.\r | |
745 | @param[in, out] BestDeviceName The pointer to pointer to string allocated with the name.\r | |
746 | @param[out] ConfigurationStatus The pointer to status for opening a Configuration protocol.\r | |
747 | @param[out] DiagnosticsStatus The pointer to status for opening a Diagnostics protocol.\r | |
748 | @param[in] Display Whether to Print this out to default Print location.\r | |
749 | @param[in] Indent How many characters to indent the printing.\r | |
94b17fa1 | 750 | \r |
b3011f40 | 751 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r |
94b17fa1 | 752 | **/\r |
753 | typedef\r | |
754 | EFI_STATUS\r | |
755 | (EFIAPI *GET_DEVICE_NAME) (\r | |
a405b86d | 756 | IN EFI_HANDLE DeviceHandle,\r |
757 | IN BOOLEAN UseComponentName,\r | |
758 | IN BOOLEAN UseDevicePath,\r | |
759 | IN CHAR8 *Language,\r | |
760 | IN OUT CHAR16 **BestDeviceName,\r | |
761 | OUT EFI_STATUS *ConfigurationStatus,\r | |
762 | OUT EFI_STATUS *DiagnosticsStatus,\r | |
763 | IN BOOLEAN Display,\r | |
764 | IN UINTN Indent\r | |
94b17fa1 | 765 | );\r |
766 | \r | |
a405b86d | 767 | #define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.\r |
768 | #define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.\r | |
94b17fa1 | 769 | \r |
770 | /**\r | |
1e6e84c7 | 771 | This function gets the shell mode as stored in the shell environment\r |
b3011f40 | 772 | "efishellmode". It will not fail.\r |
94b17fa1 | 773 | \r |
a405b86d | 774 | @param[out] Mode Returns a string representing one of the\r |
94b17fa1 | 775 | 2 supported modes of the shell.\r |
776 | \r | |
b3011f40 | 777 | @retval EFI_SUCCESS This function always returns success.\r |
94b17fa1 | 778 | **/\r |
779 | typedef\r | |
780 | EFI_STATUS\r | |
781 | (EFIAPI *GET_SHELL_MODE) (\r | |
782 | OUT CHAR16 **Mode\r | |
783 | );\r | |
784 | \r | |
785 | /**\r | |
b3011f40 | 786 | Convert a file system style name to a device path.\r |
94b17fa1 | 787 | \r |
788 | This function will convert a shell path name to a Device Path Protocol path.\r | |
1e6e84c7 | 789 | This function will allocate any required memory for this operation and it\r |
94b17fa1 | 790 | is the responsibility of the caller to free that memory when no longer required.\r |
791 | \r | |
1e6e84c7 | 792 | If anything prevents the complete conversion free any allocated memory and\r |
94b17fa1 | 793 | return NULL.\r |
794 | \r | |
a405b86d | 795 | @param[in] Path The path to convert.\r |
796 | \r | |
b3011f40 | 797 | @retval !NULL A pointer to the callee allocated Device Path.\r |
798 | @retval NULL The operation could not be completed.\r | |
94b17fa1 | 799 | **/\r |
1e6e84c7 | 800 | typedef\r |
801 | EFI_DEVICE_PATH_PROTOCOL*\r | |
94b17fa1 | 802 | (EFIAPI *SHELLENV_NAME_TO_PATH) (\r |
803 | IN CHAR16 *Path\r | |
804 | );\r | |
805 | \r | |
806 | /**\r | |
b3011f40 | 807 | Converts a device path into a file system map name.\r |
808 | \r | |
809 | If DevPath is NULL, then ASSERT.\r | |
94b17fa1 | 810 | \r |
94b17fa1 | 811 | This function looks through the shell environment map for a map whose device\r |
1e6e84c7 | 812 | path matches the DevPath parameter. If one is found the Name is returned via\r |
94b17fa1 | 813 | Name parameter. If sucessful the caller must free the memory allocated for\r |
814 | Name.\r | |
815 | \r | |
1e6e84c7 | 816 | This function will use the internal lock to prevent changes to the map during\r |
94b17fa1 | 817 | the lookup operation.\r |
1e6e84c7 | 818 | \r |
a405b86d | 819 | @param[in] DevPath The device path to search for a name for.\r |
820 | @param[in] ConsistMapping What state to verify map flag VAR_ID_CONSIST.\r | |
821 | @param[out] Name On sucessful return the name of that device path.\r | |
94b17fa1 | 822 | \r |
b3011f40 | 823 | @retval EFI_SUCCESS The DevPath was found and the name returned\r |
1e6e84c7 | 824 | in Name.\r |
94b17fa1 | 825 | @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.\r |
b3011f40 | 826 | @retval EFI_UNSUPPORTED The DevPath was not found in the map.\r |
94b17fa1 | 827 | **/\r |
828 | typedef\r | |
829 | EFI_STATUS\r | |
830 | (EFIAPI *SHELLENV_GET_FS_NAME) (\r | |
831 | IN EFI_DEVICE_PATH_PROTOCOL * DevPath,\r | |
832 | IN BOOLEAN ConsistMapping,\r | |
833 | OUT CHAR16 **Name\r | |
834 | );\r | |
835 | \r | |
836 | /**\r | |
1e6e84c7 | 837 | This function will open a group of files that match the Arg path, but will not\r |
838 | support the wildcard characters ('?' and '*') in the Arg path. If there are\r | |
839 | any wildcard characters in the path this function will return\r | |
840 | EFI_INVALID_PARAMETER. The return is a double linked list based on the\r | |
841 | LIST_ENTRY linked list structure. Use this in conjunction with the\r | |
94b17fa1 | 842 | SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.\r |
1e6e84c7 | 843 | The memory allocated by the callee for this list is freed by making a call to\r |
94b17fa1 | 844 | SHELLENV_FREE_FILE_LIST.\r |
845 | \r | |
4ff7e37b ED |
846 | @param[in] Arg The pointer to the path of the files to be opened.\r |
847 | @param[in, out] ListHead The pointer to allocated and initialized list head\r | |
848 | upon which to append all the opened file structures.\r | |
94b17fa1 | 849 | \r |
a405b86d | 850 | @retval EFI_SUCCESS One or more files was opened and a struct of each file's\r |
94b17fa1 | 851 | information was appended to ListHead.\r |
b3011f40 | 852 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r |
853 | @retval EFI_NOT_FOUND No matching files could be found.\r | |
94b17fa1 | 854 | @sa SHELLENV_FREE_FILE_LIST\r |
855 | **/\r | |
856 | typedef\r | |
857 | EFI_STATUS\r | |
858 | (EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD) (\r | |
859 | IN CHAR16 *Arg,\r | |
d2b4564b | 860 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 861 | );\r |
862 | \r | |
863 | /**\r | |
b3011f40 | 864 | This function removes duplicate file listings from lists.\r |
94b17fa1 | 865 | \r |
1e6e84c7 | 866 | This is a function for use with SHELLENV_FILE_META_ARG_NO_WILDCARD and\r |
b3011f40 | 867 | SHELLENV_FILE_META_ARG. This function will verify that there are no duplicate\r |
868 | files in the list of returned files. Any file listed twice will have one of its\r | |
94b17fa1 | 869 | instances removed.\r |
870 | \r | |
a405b86d | 871 | @param[in] ListHead The pointer to linked list head that was returned from\r |
94b17fa1 | 872 | SHELLENV_FILE_META_ARG_NO_WILDCARD or\r |
873 | SHELLENV_FILE_META_ARG.\r | |
874 | \r | |
b3011f40 | 875 | @retval EFI_SUCCESS This function always returns success.\r |
94b17fa1 | 876 | \r |
877 | **/\r | |
878 | typedef\r | |
879 | EFI_STATUS\r | |
880 | (EFIAPI *SHELLENV_DEL_DUP_FILE) (\r | |
d2b4564b | 881 | IN LIST_ENTRY * ListHead\r |
94b17fa1 | 882 | );\r |
883 | \r | |
884 | /**\r | |
885 | Converts a File System map name to a device path.\r | |
886 | \r | |
a405b86d | 887 | If DevPath is NULL, then ASSERT().\r |
94b17fa1 | 888 | \r |
1e6e84c7 | 889 | This function looks through the shell environment map for a map whose Name\r |
a405b86d | 890 | matches the Name parameter. If one is found, the device path pointer is\r |
1e6e84c7 | 891 | updated to point to that file systems device path. The caller should not\r |
94b17fa1 | 892 | free the memory from that device path.\r |
893 | \r | |
1e6e84c7 | 894 | This function will use the internal lock to prevent changes to the map during\r |
94b17fa1 | 895 | the lookup operation.\r |
896 | \r | |
a405b86d | 897 | @param[in] Name The pointer to the NULL terminated UNICODE string of the\r |
b3011f40 | 898 | file system name.\r |
a405b86d | 899 | @param[out] DevPath The pointer to pointer to DevicePath. Only valid on\r |
900 | successful return.\r | |
94b17fa1 | 901 | \r |
a405b86d | 902 | @retval EFI_SUCCESS The conversion was successful, and the device\r |
94b17fa1 | 903 | path was returned.\r |
b3011f40 | 904 | @retval EFI_NOT_FOUND The file system could not be found in the map.\r |
94b17fa1 | 905 | **/\r |
906 | typedef\r | |
907 | EFI_STATUS\r | |
908 | (EFIAPI *SHELLENV_GET_FS_DEVICE_PATH) (\r | |
909 | IN CHAR16 *Name,\r | |
910 | OUT EFI_DEVICE_PATH_PROTOCOL **DevPath\r | |
911 | );\r | |
912 | \r | |
b3011f40 | 913 | /// EFI_SHELL_ENVIRONMENT2 protocol structure.\r |
94b17fa1 | 914 | typedef struct {\r |
915 | SHELLENV_EXECUTE Execute;\r | |
916 | SHELLENV_GET_ENV GetEnv;\r | |
917 | SHELLENV_GET_MAP GetMap;\r | |
918 | SHELLENV_ADD_CMD AddCmd;\r | |
919 | SHELLENV_ADD_PROT AddProt;\r | |
920 | SHELLENV_GET_PROT GetProt;\r | |
921 | SHELLENV_CUR_DIR CurDir;\r | |
922 | SHELLENV_FILE_META_ARG FileMetaArg;\r | |
923 | SHELLENV_FREE_FILE_LIST FreeFileList;\r | |
924 | \r | |
925 | //\r | |
b3011f40 | 926 | // The following services are only used by the shell itself.\r |
94b17fa1 | 927 | //\r |
928 | SHELLENV_NEW_SHELL NewShell;\r | |
929 | SHELLENV_BATCH_IS_ACTIVE BatchIsActive;\r | |
930 | \r | |
931 | SHELLENV_FREE_RESOURCES FreeResources;\r | |
932 | \r | |
933 | //\r | |
b3011f40 | 934 | // GUID to differentiate ShellEnvironment2 from ShellEnvironment.\r |
94b17fa1 | 935 | //\r |
936 | EFI_GUID SESGuid;\r | |
937 | //\r | |
b3011f40 | 938 | // Major Version grows if shell environment interface has been changes.\r |
94b17fa1 | 939 | //\r |
940 | UINT32 MajorVersion;\r | |
941 | UINT32 MinorVersion;\r | |
942 | SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak;\r | |
943 | SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak;\r | |
944 | SHELLENV_GET_PAGE_BREAK GetPageBreak;\r | |
945 | \r | |
946 | SHELLENV_SET_KEY_FILTER SetKeyFilter;\r | |
947 | SHELLENV_GET_KEY_FILTER GetKeyFilter;\r | |
948 | \r | |
949 | SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak;\r | |
950 | SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel;\r | |
951 | SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel;\r | |
952 | SHELLENV_IS_ROOT_SHELL IsRootShell;\r | |
953 | \r | |
954 | SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy;\r | |
955 | HANDLE_ENUMERATOR HandleEnumerator;\r | |
956 | PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator;\r | |
957 | GET_DEVICE_NAME GetDeviceName;\r | |
958 | GET_SHELL_MODE GetShellMode;\r | |
959 | SHELLENV_NAME_TO_PATH NameToPath;\r | |
960 | SHELLENV_GET_FS_NAME GetFsName;\r | |
961 | SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard;\r | |
962 | SHELLENV_DEL_DUP_FILE DelDupFileArg;\r | |
963 | SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath;\r | |
964 | } EFI_SHELL_ENVIRONMENT2;\r | |
965 | \r | |
966 | extern EFI_GUID gEfiShellEnvironment2Guid;\r | |
967 | extern EFI_GUID gEfiShellEnvironment2ExtGuid;\r | |
b3011f40 | 968 | \r |
969 | #endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |