]>
Commit | Line | Data |
---|---|---|
94b17fa1 | 1 | /** @file\r |
941b3569 | 2 | EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r |
94b17fa1 | 3 | \r |
c011b6c9 | 4 | (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r |
9095d37b | 5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
94b17fa1 | 7 | \r |
8 | **/\r | |
9 | \r | |
51a09860 RN |
10 | #ifndef __EFI_SHELL_PROTOCOL_H__\r |
11 | #define __EFI_SHELL_PROTOCOL_H__\r | |
94b17fa1 | 12 | \r |
94b17fa1 | 13 | #include <Guid/FileInfo.h>\r |
14 | \r | |
15 | #define EFI_SHELL_PROTOCOL_GUID \\r | |
16 | { \\r | |
17 | 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \\r | |
18 | }\r | |
51a09860 RN |
19 | typedef VOID *SHELL_FILE_HANDLE;\r |
20 | \r | |
21 | typedef enum {\r | |
22 | ///\r | |
23 | /// The operation completed successfully.\r | |
24 | ///\r | |
25 | SHELL_SUCCESS = 0,\r | |
26 | \r | |
27 | ///\r | |
28 | /// The image failed to load.\r | |
29 | ///\r | |
30 | SHELL_LOAD_ERROR = 1,\r | |
31 | \r | |
32 | ///\r | |
33 | /// The parameter was incorrect.\r | |
34 | ///\r | |
35 | SHELL_INVALID_PARAMETER = 2,\r | |
36 | \r | |
37 | ///\r | |
38 | /// The operation is not supported.\r | |
39 | ///\r | |
40 | SHELL_UNSUPPORTED = 3,\r | |
41 | \r | |
42 | ///\r | |
43 | /// The buffer was not the proper size for the request.\r | |
44 | ///\r | |
45 | SHELL_BAD_BUFFER_SIZE = 4,\r | |
46 | \r | |
47 | ///\r | |
48 | /// The buffer was not large enough to hold the requested data.\r | |
49 | /// The required buffer size is returned in the appropriate\r | |
50 | /// parameter when this error occurs.\r | |
51 | ///\r | |
52 | SHELL_BUFFER_TOO_SMALL = 5,\r | |
53 | \r | |
54 | ///\r | |
55 | /// There is no data pending upon return.\r | |
56 | ///\r | |
57 | SHELL_NOT_READY = 6,\r | |
58 | \r | |
59 | ///\r | |
60 | /// The physical device reported an error while attempting the\r | |
61 | /// operation.\r | |
62 | ///\r | |
63 | SHELL_DEVICE_ERROR = 7,\r | |
64 | \r | |
65 | ///\r | |
66 | /// The device cannot be written to.\r | |
67 | ///\r | |
68 | SHELL_WRITE_PROTECTED = 8,\r | |
69 | \r | |
70 | ///\r | |
71 | /// The resource has run out.\r | |
72 | ///\r | |
73 | SHELL_OUT_OF_RESOURCES = 9,\r | |
74 | \r | |
75 | ///\r | |
76 | /// An inconsistency was detected on the file system causing the\r | |
77 | /// operation to fail.\r | |
78 | ///\r | |
79 | SHELL_VOLUME_CORRUPTED = 10,\r | |
80 | \r | |
81 | ///\r | |
82 | /// There is no more space on the file system.\r | |
83 | ///\r | |
84 | SHELL_VOLUME_FULL = 11,\r | |
85 | \r | |
86 | ///\r | |
87 | /// The device does not contain any medium to perform the\r | |
88 | /// operation.\r | |
89 | ///\r | |
90 | SHELL_NO_MEDIA = 12,\r | |
91 | \r | |
92 | ///\r | |
93 | /// The medium in the device has changed since the last\r | |
94 | /// access.\r | |
95 | ///\r | |
96 | SHELL_MEDIA_CHANGED = 13,\r | |
97 | \r | |
98 | ///\r | |
99 | /// The item was not found.\r | |
100 | ///\r | |
101 | SHELL_NOT_FOUND = 14,\r | |
102 | \r | |
103 | ///\r | |
104 | /// Access was denied.\r | |
105 | ///\r | |
106 | SHELL_ACCESS_DENIED = 15,\r | |
107 | \r | |
108 | // note the skipping of 16 and 17\r | |
109 | \r | |
110 | ///\r | |
111 | /// A timeout time expired.\r | |
112 | ///\r | |
113 | SHELL_TIMEOUT = 18,\r | |
114 | \r | |
115 | ///\r | |
116 | /// The protocol has not been started.\r | |
117 | ///\r | |
118 | SHELL_NOT_STARTED = 19,\r | |
119 | \r | |
120 | ///\r | |
121 | /// The protocol has already been started.\r | |
122 | ///\r | |
123 | SHELL_ALREADY_STARTED = 20,\r | |
124 | \r | |
125 | ///\r | |
126 | /// The operation was aborted.\r | |
127 | ///\r | |
128 | SHELL_ABORTED = 21,\r | |
129 | \r | |
130 | // note the skipping of 22, 23, and 24\r | |
131 | \r | |
132 | ///\r | |
133 | /// A function encountered an internal version that was\r | |
134 | /// incompatible with a version requested by the caller.\r | |
135 | ///\r | |
136 | SHELL_INCOMPATIBLE_VERSION = 25,\r | |
137 | \r | |
138 | ///\r | |
139 | /// The function was not performed due to a security violation.\r | |
140 | ///\r | |
141 | SHELL_SECURITY_VIOLATION = 26,\r | |
142 | \r | |
143 | ///\r | |
144 | /// The function was performed and resulted in an unequal\r | |
145 | /// comparison..\r | |
146 | ///\r | |
147 | SHELL_NOT_EQUAL = 27\r | |
148 | } SHELL_STATUS;\r | |
149 | \r | |
94b17fa1 | 150 | \r |
d2b4564b | 151 | // replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.\r |
152 | // they are identical outside of the name.\r | |
94b17fa1 | 153 | typedef struct {\r |
a405b86d | 154 | LIST_ENTRY Link; ///< Linked list members.\r |
155 | EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.\r | |
156 | CONST CHAR16 *FullName; ///< Fully qualified filename.\r | |
157 | CONST CHAR16 *FileName; ///< name of this file.\r | |
158 | SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.\r | |
159 | EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.\r | |
94b17fa1 | 160 | } EFI_SHELL_FILE_INFO;\r |
a31bd33c | 161 | \r |
94b17fa1 | 162 | /**\r |
163 | Returns whether any script files are currently being processed.\r | |
164 | \r | |
165 | @retval TRUE There is at least one script file active.\r | |
166 | @retval FALSE No script files are active now.\r | |
167 | \r | |
168 | **/\r | |
169 | typedef\r | |
170 | BOOLEAN\r | |
171 | (EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (\r | |
172 | VOID\r | |
173 | );\r | |
174 | \r | |
175 | /**\r | |
176 | Closes the file handle.\r | |
177 | \r | |
1e6e84c7 | 178 | This function closes a specified file handle. All 'dirty' cached file data is\r |
179 | flushed to the device, and the file is closed. In all cases, the handle is\r | |
94b17fa1 | 180 | closed.\r |
181 | \r | |
1e6e84c7 | 182 | @param[in] FileHandle The file handle to be closed.\r |
94b17fa1 | 183 | \r |
a31bd33c | 184 | @retval EFI_SUCCESS The file closed sucessfully.\r |
94b17fa1 | 185 | **/\r |
186 | typedef\r | |
187 | EFI_STATUS\r | |
188 | (EFIAPI *EFI_SHELL_CLOSE_FILE)(\r | |
a405b86d | 189 | IN SHELL_FILE_HANDLE FileHandle\r |
94b17fa1 | 190 | );\r |
191 | \r | |
192 | /**\r | |
193 | Creates a file or directory by name.\r | |
194 | \r | |
195 | This function creates an empty new file or directory with the specified attributes and\r | |
196 | returns the new file's handle. If the file already exists and is read-only, then\r | |
197 | EFI_INVALID_PARAMETER will be returned.\r | |
1e6e84c7 | 198 | \r |
94b17fa1 | 199 | If the file already existed, it is truncated and its attributes updated. If the file is\r |
200 | created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.\r | |
1e6e84c7 | 201 | \r |
94b17fa1 | 202 | If the file name begins with >v, then the file handle which is returned refers to the\r |
203 | shell environment variable with the specified name. If the shell environment variable\r | |
204 | already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.\r | |
205 | \r | |
1e6e84c7 | 206 | @param[in] FileName Pointer to NULL-terminated file path.\r |
a405b86d | 207 | @param[in] FileAttribs The new file's attrbiutes. The different attributes are\r |
a31bd33c | 208 | described in EFI_FILE_PROTOCOL.Open().\r |
a405b86d | 209 | @param[out] FileHandle On return, points to the created file handle or directory's handle.\r |
94b17fa1 | 210 | \r |
a31bd33c | 211 | @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.\r |
94b17fa1 | 212 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r |
1e6e84c7 | 213 | @retval EFI_UNSUPPORTED The file path could not be opened.\r |
a31bd33c | 214 | @retval EFI_NOT_FOUND The specified file could not be found on the device, or could not\r |
215 | file the file system on the device.\r | |
216 | @retval EFI_NO_MEDIA The device has no medium.\r | |
217 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r | |
218 | longer supported.\r | |
219 | @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r | |
220 | the DirName.\r | |
221 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
222 | @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r | |
223 | when the media is write-protected.\r | |
224 | @retval EFI_ACCESS_DENIED The service denied access to the file.\r | |
225 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.\r | |
226 | @retval EFI_VOLUME_FULL The volume is full.\r | |
94b17fa1 | 227 | **/\r |
228 | typedef\r | |
229 | EFI_STATUS\r | |
230 | (EFIAPI *EFI_SHELL_CREATE_FILE)(\r | |
a405b86d | 231 | IN CONST CHAR16 *FileName,\r |
232 | IN UINT64 FileAttribs,\r | |
233 | OUT SHELL_FILE_HANDLE *FileHandle\r | |
94b17fa1 | 234 | );\r |
235 | \r | |
236 | /**\r | |
237 | Deletes the file specified by the file handle.\r | |
238 | \r | |
239 | This function closes and deletes a file. In all cases, the file handle is closed. If the file\r | |
240 | cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the\r | |
241 | handle is still closed.\r | |
242 | \r | |
941b3569 | 243 | @param[in] FileHandle The file handle to delete.\r |
94b17fa1 | 244 | \r |
1e6e84c7 | 245 | @retval EFI_SUCCESS The file was closed and deleted and the handle was closed.\r |
94b17fa1 | 246 | @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r |
247 | **/\r | |
248 | typedef\r | |
249 | EFI_STATUS\r | |
250 | (EFIAPI *EFI_SHELL_DELETE_FILE)(\r | |
a405b86d | 251 | IN SHELL_FILE_HANDLE FileHandle\r |
94b17fa1 | 252 | );\r |
253 | \r | |
254 | /**\r | |
255 | Deletes the file specified by the file name.\r | |
256 | \r | |
257 | This function deletes a file.\r | |
258 | \r | |
1e6e84c7 | 259 | @param[in] FileName Points to the NULL-terminated file name.\r |
94b17fa1 | 260 | \r |
1e6e84c7 | 261 | @retval EFI_SUCCESS The file was deleted.\r |
94b17fa1 | 262 | @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r |
263 | **/\r | |
264 | typedef\r | |
265 | EFI_STATUS\r | |
266 | (EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME)(\r | |
267 | IN CONST CHAR16 *FileName\r | |
268 | );\r | |
269 | \r | |
270 | /**\r | |
271 | Disables the page break output mode.\r | |
272 | **/\r | |
273 | typedef\r | |
274 | VOID\r | |
275 | (EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (\r | |
1e6e84c7 | 276 | VOID\r |
277 | );\r | |
94b17fa1 | 278 | \r |
279 | /**\r | |
280 | Enables the page break output mode.\r | |
281 | **/\r | |
282 | typedef\r | |
283 | VOID\r | |
284 | (EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (\r | |
1e6e84c7 | 285 | VOID\r |
286 | );\r | |
94b17fa1 | 287 | \r |
288 | /**\r | |
289 | Execute the command line.\r | |
290 | \r | |
291 | This function creates a nested instance of the shell and executes the specified\r | |
292 | command (CommandLine) with the specified environment (Environment). Upon return,\r | |
293 | the status code returned by the specified command is placed in StatusCode.\r | |
1e6e84c7 | 294 | \r |
94b17fa1 | 295 | If Environment is NULL, then the current environment is used and all changes made\r |
296 | by the commands executed will be reflected in the current environment. If the\r | |
297 | Environment is non-NULL, then the changes made will be discarded.\r | |
1e6e84c7 | 298 | \r |
94b17fa1 | 299 | The CommandLine is executed from the current working directory on the current\r |
300 | device.\r | |
301 | \r | |
1e6e84c7 | 302 | @param[in] ParentImageHandle A handle of the image that is executing the specified\r |
303 | command line.\r | |
304 | @param[in] CommandLine Points to the NULL-terminated UCS-2 encoded string\r | |
941b3569 | 305 | containing the command line. If NULL then the command-\r |
306 | line will be empty.\r | |
1e6e84c7 | 307 | @param[in] Environment Points to a NULL-terminated array of environment\r |
308 | variables with the format 'x=y', where x is the\r | |
941b3569 | 309 | environment variable name and y is the value. If this\r |
310 | is NULL, then the current shell environment is used.\r | |
311 | @param[out] ErrorCode Points to the status code returned by the command.\r | |
312 | \r | |
1e6e84c7 | 313 | @retval EFI_SUCCESS The command executed successfully. The status code\r |
941b3569 | 314 | returned by the command is pointed to by StatusCode.\r |
94b17fa1 | 315 | @retval EFI_INVALID_PARAMETER The parameters are invalid.\r |
941b3569 | 316 | @retval EFI_OUT_OF_RESOURCES Out of resources.\r |
317 | @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.\r | |
94b17fa1 | 318 | **/\r |
319 | typedef\r | |
320 | EFI_STATUS\r | |
321 | (EFIAPI *EFI_SHELL_EXECUTE) (\r | |
a405b86d | 322 | IN EFI_HANDLE *ParentImageHandle,\r |
323 | IN CHAR16 *CommandLine OPTIONAL,\r | |
324 | IN CHAR16 **Environment OPTIONAL,\r | |
325 | OUT EFI_STATUS *StatusCode OPTIONAL\r | |
94b17fa1 | 326 | );\r |
327 | \r | |
328 | /**\r | |
329 | Find files that match a specified pattern.\r | |
330 | \r | |
331 | This function searches for all files and directories that match the specified\r | |
332 | FilePattern. The FilePattern can contain wild-card characters. The resulting file\r | |
333 | information is placed in the file list FileList.\r | |
334 | \r | |
335 | The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo\r | |
336 | field is set to NULL.\r | |
337 | \r | |
1e6e84c7 | 338 | @param[in] FilePattern Points to a NULL-terminated shell file path, including wildcards.\r |
339 | @param[out] FileList On return, points to the start of a file list containing the names\r | |
340 | of all matching files or else points to NULL if no matching files\r | |
941b3569 | 341 | were found.\r |
94b17fa1 | 342 | \r |
941b3569 | 343 | @retval EFI_SUCCESS Files found.\r |
344 | @retval EFI_NOT_FOUND No files found.\r | |
a31bd33c | 345 | @retval EFI_NO_MEDIA The device has no media.\r |
346 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
347 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
94b17fa1 | 348 | **/\r |
349 | typedef\r | |
350 | EFI_STATUS\r | |
351 | (EFIAPI *EFI_SHELL_FIND_FILES)(\r | |
a405b86d | 352 | IN CONST CHAR16 *FilePattern,\r |
353 | OUT EFI_SHELL_FILE_INFO **FileList\r | |
94b17fa1 | 354 | );\r |
355 | \r | |
356 | /**\r | |
357 | Find all files in a specified directory.\r | |
358 | \r | |
941b3569 | 359 | @param[in] FileDirHandle Handle of the directory to search.\r |
1e6e84c7 | 360 | @param[out] FileList On return, points to the list of files in the directory\r |
941b3569 | 361 | or NULL if there are no files in the directory.\r |
94b17fa1 | 362 | \r |
941b3569 | 363 | @retval EFI_SUCCESS File information was returned successfully.\r |
364 | @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted.\r | |
365 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
366 | @retval EFI_NO_MEDIA The device media is not present.\r | |
94b17fa1 | 367 | **/\r |
368 | typedef\r | |
369 | EFI_STATUS\r | |
370 | (EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(\r | |
a405b86d | 371 | IN SHELL_FILE_HANDLE FileDirHandle,\r |
372 | OUT EFI_SHELL_FILE_INFO **FileList\r | |
94b17fa1 | 373 | );\r |
374 | \r | |
375 | /**\r | |
a31bd33c | 376 | Flushes data back to a device.\r |
1e6e84c7 | 377 | \r |
94b17fa1 | 378 | This function flushes all modified data associated with a file to a device.\r |
379 | \r | |
1e6e84c7 | 380 | @param[in] FileHandle The handle of the file to flush.\r |
94b17fa1 | 381 | \r |
382 | @retval EFI_SUCCESS The data was flushed.\r | |
383 | @retval EFI_NO_MEDIA The device has no medium.\r | |
384 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
385 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
386 | @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r | |
387 | @retval EFI_ACCESS_DENIED The file was opened read-only.\r | |
388 | @retval EFI_VOLUME_FULL The volume is full.\r | |
389 | **/\r | |
390 | typedef\r | |
391 | EFI_STATUS\r | |
392 | (EFIAPI *EFI_SHELL_FLUSH_FILE)(\r | |
a405b86d | 393 | IN SHELL_FILE_HANDLE FileHandle\r |
94b17fa1 | 394 | );\r |
395 | \r | |
396 | /**\r | |
397 | Frees the file list.\r | |
1e6e84c7 | 398 | \r |
94b17fa1 | 399 | This function cleans up the file list and any related data structures. It has no\r |
400 | impact on the files themselves.\r | |
401 | \r | |
1e6e84c7 | 402 | @param[in] FileList The file list to free. Type EFI_SHELL_FILE_INFO is\r |
403 | defined in OpenFileList().\r | |
94b17fa1 | 404 | \r |
405 | @retval EFI_SUCCESS Free the file list successfully.\r | |
406 | **/\r | |
407 | typedef\r | |
408 | EFI_STATUS\r | |
409 | (EFIAPI *EFI_SHELL_FREE_FILE_LIST) (\r | |
410 | IN EFI_SHELL_FILE_INFO **FileList\r | |
411 | );\r | |
412 | \r | |
413 | /**\r | |
414 | Returns the current directory on the specified device.\r | |
415 | \r | |
416 | If FileSystemMapping is NULL, it returns the current working directory. If the\r | |
417 | FileSystemMapping is not NULL, it returns the current directory associated with the\r | |
418 | FileSystemMapping. In both cases, the returned name includes the file system\r | |
419 | mapping (i.e. fs0:\current-dir).\r | |
420 | \r | |
fbd2dfad QS |
421 | Note that the current directory string should exclude the tailing backslash character.\r |
422 | \r | |
1e6e84c7 | 423 | @param[in] FileSystemMapping A pointer to the file system mapping. If NULL,\r |
94b17fa1 | 424 | then the current working directory is returned.\r |
1e6e84c7 | 425 | \r |
94b17fa1 | 426 | @retval !=NULL The current directory.\r |
427 | @retval NULL Current directory does not exist.\r | |
428 | **/\r | |
429 | typedef\r | |
430 | CONST CHAR16 *\r | |
431 | (EFIAPI *EFI_SHELL_GET_CUR_DIR) (\r | |
432 | IN CONST CHAR16 *FileSystemMapping OPTIONAL\r | |
433 | );\r | |
434 | \r | |
435 | typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;\r | |
436 | #define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001\r | |
437 | #define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002\r | |
a31bd33c | 438 | \r |
94b17fa1 | 439 | /**\r |
440 | Gets the name of the device specified by the device handle.\r | |
441 | \r | |
442 | This function gets the user-readable name of the device specified by the device\r | |
443 | handle. If no user-readable name could be generated, then *BestDeviceName will be\r | |
444 | NULL and EFI_NOT_FOUND will be returned.\r | |
445 | \r | |
d2b4564b | 446 | If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the\r |
69817bf8 | 447 | device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on\r |
d2b4564b | 448 | DeviceHandle.\r |
449 | \r | |
450 | If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the\r | |
69817bf8 | 451 | device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle.\r |
d2b4564b | 452 | If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and\r |
453 | EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then\r | |
454 | EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.\r | |
455 | \r | |
941b3569 | 456 | @param[in] DeviceHandle The handle of the device.\r |
1e6e84c7 | 457 | @param[in] Flags Determines the possible sources of component names.\r |
458 | @param[in] Language A pointer to the language specified for the device\r | |
459 | name, in the same format as described in the UEFI\r | |
a31bd33c | 460 | specification, Appendix M.\r |
1e6e84c7 | 461 | @param[out] BestDeviceName On return, points to the callee-allocated NULL-\r |
462 | terminated name of the device. If no device name\r | |
463 | could be found, points to NULL. The name must be\r | |
94b17fa1 | 464 | freed by the caller...\r |
465 | \r | |
466 | @retval EFI_SUCCESS Get the name successfully.\r | |
467 | @retval EFI_NOT_FOUND Fail to get the device name.\r | |
468 | **/\r | |
469 | typedef\r | |
470 | EFI_STATUS\r | |
e26d7b59 | 471 | (EFIAPI *EFI_SHELL_GET_DEVICE_NAME) (\r |
a405b86d | 472 | IN EFI_HANDLE DeviceHandle,\r |
473 | IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,\r | |
474 | IN CHAR8 *Language,\r | |
475 | OUT CHAR16 **BestDeviceName\r | |
94b17fa1 | 476 | );\r |
477 | \r | |
478 | /**\r | |
479 | Gets the device path from the mapping.\r | |
480 | \r | |
481 | This function gets the device path associated with a mapping.\r | |
482 | \r | |
941b3569 | 483 | @param[in] Mapping A pointer to the mapping\r |
94b17fa1 | 484 | \r |
1e6e84c7 | 485 | @retval !=NULL Pointer to the device path that corresponds to the\r |
486 | device mapping. The returned pointer does not need\r | |
94b17fa1 | 487 | to be freed.\r |
1e6e84c7 | 488 | @retval NULL There is no device path associated with the\r |
94b17fa1 | 489 | specified mapping.\r |
490 | **/\r | |
491 | typedef\r | |
492 | CONST EFI_DEVICE_PATH_PROTOCOL *\r | |
493 | (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (\r | |
494 | IN CONST CHAR16 *Mapping\r | |
495 | );\r | |
496 | \r | |
497 | /**\r | |
498 | Converts a file system style name to a device path.\r | |
499 | \r | |
500 | This function converts a file system style name to a device path, by replacing any\r | |
501 | mapping references to the associated device path.\r | |
502 | \r | |
a31bd33c | 503 | @param[in] Path The pointer to the path.\r |
94b17fa1 | 504 | \r |
1e6e84c7 | 505 | @return The pointer of the file path. The file path is callee\r |
94b17fa1 | 506 | allocated and should be freed by the caller.\r |
507 | **/\r | |
508 | typedef\r | |
509 | EFI_DEVICE_PATH_PROTOCOL *\r | |
510 | (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (\r | |
511 | IN CONST CHAR16 *Path\r | |
512 | );\r | |
513 | \r | |
514 | /**\r | |
941b3569 | 515 | Gets either a single or list of environment variables.\r |
516 | \r | |
1e6e84c7 | 517 | If name is not NULL then this function returns the current value of the specified\r |
941b3569 | 518 | environment variable.\r |
94b17fa1 | 519 | \r |
1e6e84c7 | 520 | If Name is NULL than a list of all environment variable names is returned. Each a\r |
941b3569 | 521 | NULL terminated string with a double NULL terminating the list.\r |
94b17fa1 | 522 | \r |
1e6e84c7 | 523 | @param[in] Name A pointer to the environment variable name. If\r |
524 | Name is NULL, then the function will return all\r | |
525 | of the defined shell environment variables. In\r | |
526 | the case where multiple environment variables are\r | |
527 | being returned, each variable will be terminated by\r | |
528 | a NULL, and the list will be terminated by a double\r | |
941b3569 | 529 | NULL.\r |
94b17fa1 | 530 | \r |
1e6e84c7 | 531 | @return A pointer to the returned string.\r |
941b3569 | 532 | The returned pointer does not need to be freed by the caller.\r |
533 | \r | |
1e6e84c7 | 534 | @retval NULL The environment variable doesn't exist or there are\r |
941b3569 | 535 | no environment variables.\r |
94b17fa1 | 536 | **/\r |
537 | typedef\r | |
538 | CONST CHAR16 *\r | |
539 | (EFIAPI *EFI_SHELL_GET_ENV) (\r | |
941b3569 | 540 | IN CONST CHAR16 *Name OPTIONAL\r |
94b17fa1 | 541 | );\r |
542 | \r | |
044ea4e5 | 543 | /**\r |
9095d37b | 544 | Gets the environment variable and Attributes, or list of environment variables. Can be\r |
044ea4e5 JC |
545 | used instead of GetEnv().\r |
546 | \r | |
547 | This function returns the current value of the specified environment variable and\r | |
548 | the Attributes. If no variable name was specified, then all of the known\r | |
549 | variables will be returned.\r | |
550 | \r | |
551 | @param[in] Name A pointer to the environment variable name. If Name is NULL,\r | |
9095d37b | 552 | then the function will return all of the defined shell\r |
044ea4e5 | 553 | environment variables. In the case where multiple environment\r |
9095d37b | 554 | variables are being returned, each variable will be terminated\r |
044ea4e5 JC |
555 | by a NULL, and the list will be terminated by a double NULL.\r |
556 | @param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for\r | |
557 | the environment variable. In the case where Name is NULL, and\r | |
558 | multiple environment variables are being returned, Attributes\r | |
559 | is undefined.\r | |
560 | \r | |
9095d37b LG |
561 | @retval NULL The environment variable doesn't exist.\r |
562 | @return The environment variable's value. The returned pointer does not\r | |
563 | need to be freed by the caller.\r | |
044ea4e5 JC |
564 | **/\r |
565 | typedef\r | |
566 | CONST CHAR16 *\r | |
567 | (EFIAPI *EFI_SHELL_GET_ENV_EX) (\r | |
568 | IN CONST CHAR16 *Name,\r | |
569 | OUT UINT32 *Attributes OPTIONAL\r | |
570 | );\r | |
571 | \r | |
94b17fa1 | 572 | /**\r |
573 | Gets the file information from an open file handle.\r | |
574 | \r | |
575 | This function allocates a buffer to store the file's information. It's the caller's\r | |
576 | responsibility to free the buffer.\r | |
577 | \r | |
a31bd33c | 578 | @param[in] FileHandle A File Handle.\r |
94b17fa1 | 579 | \r |
1e6e84c7 | 580 | @retval NULL Cannot get the file info.\r |
581 | @return A pointer to a buffer with file information.\r | |
94b17fa1 | 582 | **/\r |
583 | typedef\r | |
584 | EFI_FILE_INFO *\r | |
585 | (EFIAPI *EFI_SHELL_GET_FILE_INFO)(\r | |
a405b86d | 586 | IN SHELL_FILE_HANDLE FileHandle\r |
94b17fa1 | 587 | );\r |
588 | \r | |
589 | /**\r | |
590 | Converts a device path to a file system-style path.\r | |
591 | \r | |
592 | This function converts a device path to a file system path by replacing part, or all, of\r | |
593 | the device path with the file-system mapping. If there are more than one application\r | |
594 | file system mappings, the one that most closely matches Path will be used.\r | |
595 | \r | |
1e6e84c7 | 596 | @param[in] Path The pointer to the device path.\r |
94b17fa1 | 597 | \r |
1e6e84c7 | 598 | @return The pointer of the NULL-terminated file path. The path\r |
94b17fa1 | 599 | is callee-allocated and should be freed by the caller.\r |
600 | **/\r | |
601 | typedef\r | |
602 | CHAR16 *\r | |
603 | (EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (\r | |
604 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Path\r | |
605 | );\r | |
606 | \r | |
607 | /**\r | |
a31bd33c | 608 | Gets a file's current position.\r |
94b17fa1 | 609 | \r |
610 | This function returns the current file position for the file handle. For directories, the\r | |
611 | current file position has no meaning outside of the file system driver and as such, the\r | |
612 | operation is not supported.\r | |
613 | \r | |
941b3569 | 614 | @param[in] FileHandle The file handle on which to get the current position.\r |
1e6e84c7 | 615 | @param[out] Position Byte position from the start of the file.\r |
94b17fa1 | 616 | \r |
617 | @retval EFI_SUCCESS Data was accessed.\r | |
618 | @retval EFI_UNSUPPORTED The request is not valid on open directories.\r | |
619 | **/\r | |
620 | typedef\r | |
621 | EFI_STATUS\r | |
622 | (EFIAPI *EFI_SHELL_GET_FILE_POSITION)(\r | |
a405b86d | 623 | IN SHELL_FILE_HANDLE FileHandle,\r |
94b17fa1 | 624 | OUT UINT64 *Position\r |
625 | );\r | |
626 | \r | |
627 | /**\r | |
628 | Gets the size of a file.\r | |
629 | \r | |
630 | This function returns the size of the file specified by FileHandle.\r | |
631 | \r | |
941b3569 | 632 | @param[in] FileHandle The handle of the file.\r |
633 | @param[out] Size The size of this file.\r | |
94b17fa1 | 634 | \r |
635 | @retval EFI_SUCCESS Get the file's size.\r | |
636 | @retval EFI_DEVICE_ERROR Can't access the file.\r | |
637 | **/\r | |
638 | typedef\r | |
639 | EFI_STATUS\r | |
640 | (EFIAPI *EFI_SHELL_GET_FILE_SIZE)(\r | |
a405b86d | 641 | IN SHELL_FILE_HANDLE FileHandle,\r |
94b17fa1 | 642 | OUT UINT64 *Size\r |
643 | );\r | |
644 | \r | |
044ea4e5 JC |
645 | /**\r |
646 | Get the GUID value from a human readable name.\r | |
647 | \r | |
648 | If GuidName is a known GUID name, then update Guid to have the correct value for\r | |
649 | that GUID.\r | |
650 | \r | |
651 | This function is only available when the major and minor versions in the\r | |
652 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r | |
653 | \r | |
654 | @param[in] GuidName A pointer to the localized name for the GUID being queried.\r | |
655 | @param[out] Guid A pointer to the GUID structure to be filled in.\r | |
656 | \r | |
657 | @retval EFI_SUCCESS The operation was successful.\r | |
658 | @retval EFI_INVALID_PARAMETER Guid was NULL.\r | |
659 | @retval EFI_INVALID_PARAMETER GuidName was NULL.\r | |
660 | @retval EFI_NOT_FOUND GuidName is not a known GUID Name.\r | |
661 | **/\r | |
662 | typedef\r | |
663 | EFI_STATUS\r | |
664 | (EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(\r | |
665 | IN CONST CHAR16 *GuidName,\r | |
666 | OUT EFI_GUID *Guid\r | |
667 | );\r | |
668 | \r | |
669 | /**\r | |
670 | Get the human readable name for a GUID from the value.\r | |
671 | \r | |
672 | If Guid is assigned a name, then update *GuidName to point to the name. The callee\r | |
673 | should not modify the value.\r | |
674 | \r | |
675 | This function is only available when the major and minor versions in the\r | |
676 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r | |
677 | \r | |
678 | @param[in] Guid A pointer to the GUID being queried.\r | |
679 | @param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested\r | |
680 | \r | |
681 | @retval EFI_SUCCESS The operation was successful.\r | |
682 | @retval EFI_INVALID_PARAMETER Guid was NULL.\r | |
683 | @retval EFI_INVALID_PARAMETER GuidName was NULL.\r | |
684 | @retval EFI_NOT_FOUND Guid is not assigned a name.\r | |
685 | **/\r | |
686 | typedef\r | |
687 | EFI_STATUS\r | |
688 | (EFIAPI *EFI_SHELL_GET_GUID_NAME)(\r | |
689 | IN CONST EFI_GUID *Guid,\r | |
690 | OUT CONST CHAR16 **GuidName\r | |
691 | );\r | |
692 | \r | |
94b17fa1 | 693 | /**\r |
694 | Return help information about a specific command.\r | |
695 | \r | |
696 | This function returns the help information for the specified command. The help text\r | |
697 | can be internal to the shell or can be from a UEFI Shell manual page.\r | |
1e6e84c7 | 698 | \r |
94b17fa1 | 699 | If Sections is specified, then each section name listed will be compared in a casesensitive\r |
700 | manner, to the section names described in Appendix B. If the section exists,\r | |
701 | it will be appended to the returned help text. If the section does not exist, no\r | |
702 | information will be returned. If Sections is NULL, then all help text information\r | |
703 | available will be returned.\r | |
704 | \r | |
1e6e84c7 | 705 | @param[in] Command Points to the NULL-terminated UEFI Shell command name.\r |
706 | @param[in] Sections Points to the NULL-terminated comma-delimited\r | |
707 | section names to return. If NULL, then all\r | |
94b17fa1 | 708 | sections will be returned.\r |
1e6e84c7 | 709 | @param[out] HelpText On return, points to a callee-allocated buffer\r |
94b17fa1 | 710 | containing all specified help text.\r |
711 | \r | |
712 | @retval EFI_SUCCESS The help text was returned.\r | |
1e6e84c7 | 713 | @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the\r |
94b17fa1 | 714 | returned help text.\r |
a31bd33c | 715 | @retval EFI_INVALID_PARAMETER HelpText is NULL.\r |
94b17fa1 | 716 | @retval EFI_NOT_FOUND There is no help text available for Command.\r |
717 | **/\r | |
718 | typedef\r | |
719 | EFI_STATUS\r | |
720 | (EFIAPI *EFI_SHELL_GET_HELP_TEXT) (\r | |
721 | IN CONST CHAR16 *Command,\r | |
b1f95a06 | 722 | IN CONST CHAR16 *Sections OPTIONAL,\r |
94b17fa1 | 723 | OUT CHAR16 **HelpText\r |
724 | );\r | |
725 | \r | |
726 | /**\r | |
941b3569 | 727 | Gets the mapping(s) that most closely matches the device path.\r |
94b17fa1 | 728 | \r |
729 | This function gets the mapping which corresponds to the device path *DevicePath. If\r | |
730 | there is no exact match, then the mapping which most closely matches *DevicePath\r | |
731 | is returned, and *DevicePath is updated to point to the remaining portion of the\r | |
732 | device path. If there is an exact match, the mapping is returned and *DevicePath\r | |
733 | points to the end-of-device-path node.\r | |
734 | \r | |
1e6e84c7 | 735 | If there are multiple map names they will be semi-colon seperated in the\r |
941b3569 | 736 | NULL-terminated string.\r |
737 | \r | |
4ff7e37b ED |
738 | @param[in, out] DevicePath On entry, points to a device path pointer. On\r |
739 | exit, updates the pointer to point to the\r | |
740 | portion of the device path after the mapping.\r | |
94b17fa1 | 741 | \r |
742 | @retval NULL No mapping was found.\r | |
1e6e84c7 | 743 | @retval !=NULL Pointer to NULL-terminated mapping. The buffer\r |
94b17fa1 | 744 | is callee allocated and should be freed by the caller.\r |
745 | **/\r | |
746 | typedef\r | |
747 | CONST CHAR16 *\r | |
748 | (EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (\r | |
749 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r | |
750 | );\r | |
751 | \r | |
752 | /**\r | |
753 | Gets the enable status of the page break output mode.\r | |
754 | \r | |
755 | User can use this function to determine current page break mode.\r | |
756 | \r | |
a31bd33c | 757 | @retval TRUE The page break output mode is enabled.\r |
758 | @retval FALSE The page break output mode is disabled.\r | |
94b17fa1 | 759 | **/\r |
760 | typedef\r | |
761 | BOOLEAN\r | |
762 | (EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (\r | |
763 | VOID\r | |
764 | );\r | |
765 | \r | |
766 | /**\r | |
767 | Judges whether the active shell is the root shell.\r | |
768 | \r | |
769 | This function makes the user to know that whether the active Shell is the root shell.\r | |
770 | \r | |
771 | @retval TRUE The active Shell is the root Shell.\r | |
772 | @retval FALSE The active Shell is NOT the root Shell.\r | |
773 | **/\r | |
774 | typedef\r | |
775 | BOOLEAN\r | |
776 | (EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (\r | |
777 | VOID\r | |
778 | );\r | |
779 | \r | |
780 | /**\r | |
781 | Opens a file or a directory by file name.\r | |
782 | \r | |
783 | This function opens the specified file in the specified OpenMode and returns a file\r | |
784 | handle.\r | |
1e6e84c7 | 785 | If the file name begins with '>v', then the file handle which is returned refers to the\r |
94b17fa1 | 786 | shell environment variable with the specified name. If the shell environment variable\r |
787 | exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then\r | |
788 | EFI_INVALID_PARAMETER is returned.\r | |
789 | \r | |
1e6e84c7 | 790 | If the file name is '>i', then the file handle which is returned refers to the standard\r |
94b17fa1 | 791 | input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER\r |
792 | is returned.\r | |
793 | \r | |
1e6e84c7 | 794 | If the file name is '>o', then the file handle which is returned refers to the standard\r |
94b17fa1 | 795 | output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r |
796 | is returned.\r | |
797 | \r | |
1e6e84c7 | 798 | If the file name is '>e', then the file handle which is returned refers to the standard\r |
94b17fa1 | 799 | error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r |
800 | is returned.\r | |
801 | \r | |
1e6e84c7 | 802 | If the file name is 'NUL', then the file handle that is returned refers to the standard NUL\r |
94b17fa1 | 803 | file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is\r |
804 | returned.\r | |
805 | \r | |
806 | If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the\r | |
807 | FileHandle is NULL.\r | |
808 | \r | |
1e6e84c7 | 809 | @param[in] FileName Points to the NULL-terminated UCS-2 encoded file name.\r |
941b3569 | 810 | @param[out] FileHandle On return, points to the file handle.\r |
1e6e84c7 | 811 | @param[in] OpenMode File open mode. Either EFI_FILE_MODE_READ or\r |
812 | EFI_FILE_MODE_WRITE from section 12.4 of the UEFI\r | |
94b17fa1 | 813 | Specification.\r |
814 | @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle.\r | |
815 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL.\r | |
816 | @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL.\r | |
817 | @retval EFI_NOT_FOUND The specified file could not be found on the device or the file\r | |
818 | system could not be found on the device. FileHandle is NULL.\r | |
819 | @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL.\r | |
820 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r | |
821 | longer supported. FileHandle is NULL.\r | |
822 | @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r | |
823 | the FileName. FileHandle is NULL.\r | |
824 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL.\r | |
825 | @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r | |
826 | when the media is write-protected. FileHandle is NULL.\r | |
827 | @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL.\r | |
828 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle\r | |
829 | is NULL.\r | |
830 | @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL.\r | |
831 | **/\r | |
832 | typedef\r | |
833 | EFI_STATUS\r | |
834 | (EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (\r | |
835 | IN CONST CHAR16 *FileName,\r | |
a405b86d | 836 | OUT SHELL_FILE_HANDLE *FileHandle,\r |
94b17fa1 | 837 | IN UINT64 OpenMode\r |
838 | );\r | |
839 | \r | |
840 | /**\r | |
841 | Opens the files that match the path specified.\r | |
842 | \r | |
843 | This function opens all of the files specified by Path. Wildcards are processed\r | |
1e6e84c7 | 844 | according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each\r |
94b17fa1 | 845 | matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.\r |
846 | \r | |
4ff7e37b ED |
847 | @param[in] Path A pointer to the path string.\r |
848 | @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or\r | |
849 | EFI_FILE_MODE_WRITE.\r | |
850 | @param[in, out] FileList Points to the start of a list of files opened.\r | |
94b17fa1 | 851 | \r |
852 | @retval EFI_SUCCESS Create the file list successfully.\r | |
a31bd33c | 853 | @return Can't create the file list.\r |
94b17fa1 | 854 | **/\r |
855 | typedef\r | |
856 | EFI_STATUS\r | |
857 | (EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (\r | |
858 | IN CHAR16 *Path,\r | |
859 | IN UINT64 OpenMode,\r | |
860 | IN OUT EFI_SHELL_FILE_INFO **FileList\r | |
861 | );\r | |
862 | \r | |
863 | /**\r | |
864 | Opens the root directory of a device.\r | |
865 | \r | |
866 | This function opens the root directory of a device and returns a file handle to it.\r | |
867 | \r | |
941b3569 | 868 | @param[in] DevicePath Points to the device path corresponding to the device where the\r |
94b17fa1 | 869 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.\r |
941b3569 | 870 | @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r |
94b17fa1 | 871 | device.\r |
872 | \r | |
873 | @retval EFI_SUCCESS Root opened successfully.\r | |
874 | @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r | |
875 | could not be opened.\r | |
876 | @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r | |
a31bd33c | 877 | @retval EFI_DEVICE_ERROR The device had an error.\r |
94b17fa1 | 878 | **/\r |
879 | typedef\r | |
880 | EFI_STATUS\r | |
881 | (EFIAPI *EFI_SHELL_OPEN_ROOT)(\r | |
882 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
a405b86d | 883 | OUT SHELL_FILE_HANDLE *FileHandle\r |
94b17fa1 | 884 | );\r |
885 | \r | |
886 | /**\r | |
a31bd33c | 887 | Opens the root directory of a device on a handle.\r |
94b17fa1 | 888 | \r |
889 | This function opens the root directory of a device and returns a file handle to it.\r | |
890 | \r | |
941b3569 | 891 | @param[in] DeviceHandle The handle of the device that contains the volume.\r |
892 | @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r | |
94b17fa1 | 893 | device.\r |
894 | \r | |
895 | @retval EFI_SUCCESS Root opened successfully.\r | |
896 | @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r | |
897 | could not be opened.\r | |
898 | @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r | |
a31bd33c | 899 | @retval EFI_DEVICE_ERROR The device had an error.\r |
94b17fa1 | 900 | **/\r |
901 | typedef\r | |
902 | EFI_STATUS\r | |
903 | (EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(\r | |
904 | IN EFI_HANDLE DeviceHandle,\r | |
a405b86d | 905 | OUT SHELL_FILE_HANDLE *FileHandle\r |
94b17fa1 | 906 | );\r |
907 | \r | |
908 | /**\r | |
909 | Reads data from the file.\r | |
910 | \r | |
911 | If FileHandle is not a directory, the function reads the requested number of bytes\r | |
912 | from the file at the file's current position and returns them in Buffer. If the read goes\r | |
913 | beyond the end of the file, the read length is truncated to the end of the file. The file's\r | |
914 | current position is increased by the number of bytes returned.\r | |
915 | If FileHandle is a directory, then an error is returned.\r | |
916 | \r | |
4ff7e37b ED |
917 | @param[in] FileHandle The opened file handle for read.\r |
918 | @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.\r | |
919 | @param[in, out] Buffer The buffer in which data is read.\r | |
94b17fa1 | 920 | \r |
921 | @retval EFI_SUCCESS Data was read.\r | |
a31bd33c | 922 | @retval EFI_NO_MEDIA The device has no media.\r |
923 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
924 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
925 | @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required size.\r | |
94b17fa1 | 926 | **/\r |
927 | typedef\r | |
928 | EFI_STATUS\r | |
929 | (EFIAPI *EFI_SHELL_READ_FILE) (\r | |
a405b86d | 930 | IN SHELL_FILE_HANDLE FileHandle,\r |
94b17fa1 | 931 | IN OUT UINTN *ReadSize,\r |
941b3569 | 932 | IN OUT VOID *Buffer\r |
94b17fa1 | 933 | );\r |
934 | \r | |
044ea4e5 JC |
935 | /**\r |
936 | Register a GUID and a localized human readable name for it.\r | |
937 | \r | |
938 | If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID\r | |
939 | names must be used whenever a shell command outputs GUID information.\r | |
940 | \r | |
941 | This function is only available when the major and minor versions in the\r | |
942 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r | |
943 | \r | |
944 | @param[in] Guid A pointer to the GUID being registered.\r | |
945 | @param[in] GuidName A pointer to the localized name for the GUID being registered.\r | |
946 | \r | |
947 | @retval EFI_SUCCESS The operation was successful.\r | |
948 | @retval EFI_INVALID_PARAMETER Guid was NULL.\r | |
949 | @retval EFI_INVALID_PARAMETER GuidName was NULL.\r | |
950 | @retval EFI_ACCESS_DENIED Guid already is assigned a name.\r | |
951 | **/\r | |
952 | typedef\r | |
953 | EFI_STATUS\r | |
954 | (EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(\r | |
955 | IN CONST EFI_GUID *Guid,\r | |
956 | IN CONST CHAR16 *GuidName\r | |
957 | );\r | |
958 | \r | |
94b17fa1 | 959 | /**\r |
960 | Deletes the duplicate file names files in the given file list.\r | |
961 | \r | |
941b3569 | 962 | @param[in] FileList A pointer to the first entry in the file list.\r |
94b17fa1 | 963 | \r |
964 | @retval EFI_SUCCESS Always success.\r | |
965 | **/\r | |
966 | typedef\r | |
967 | EFI_STATUS\r | |
968 | (EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (\r | |
969 | IN EFI_SHELL_FILE_INFO **FileList\r | |
970 | );\r | |
971 | \r | |
972 | /**\r | |
973 | Changes a shell command alias.\r | |
974 | \r | |
975 | This function creates an alias for a shell command.\r | |
976 | \r | |
1e6e84c7 | 977 | @param[in] Command Points to the NULL-terminated shell command or existing alias.\r |
978 | @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and\r | |
94b17fa1 | 979 | Command refers to an alias, that alias will be deleted.\r |
941b3569 | 980 | @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If\r |
94b17fa1 | 981 | FALSE and the alias already exists, then the existing alias is unchanged and\r |
982 | EFI_ACCESS_DENIED is returned.\r | |
1e6e84c7 | 983 | @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the\r |
941b3569 | 984 | Alias being set will be stored in a non-volatile fashion.\r |
94b17fa1 | 985 | \r |
986 | @retval EFI_SUCCESS Alias created or deleted successfully.\r | |
987 | @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to\r | |
988 | FALSE.\r | |
989 | **/\r | |
990 | typedef\r | |
991 | EFI_STATUS\r | |
992 | (EFIAPI *EFI_SHELL_SET_ALIAS)(\r | |
993 | IN CONST CHAR16 *Command,\r | |
994 | IN CONST CHAR16 *Alias,\r | |
941b3569 | 995 | IN BOOLEAN Replace,\r |
996 | IN BOOLEAN Volatile\r | |
997 | );\r | |
998 | \r | |
999 | /**\r | |
369d5f2e | 1000 | This function returns the command associated with a alias or a list of all\r |
1001 | alias'.\r | |
941b3569 | 1002 | \r |
1e6e84c7 | 1003 | @param[in] Alias Points to the NULL-terminated shell alias.\r |
1004 | If this parameter is NULL, then all\r | |
941b3569 | 1005 | aliases will be returned in ReturnedData.\r |
a31bd33c | 1006 | @param[out] Volatile Upon return of a single command if TRUE indicates\r |
369d5f2e | 1007 | this is stored in a volatile fashion. FALSE otherwise.\r |
9095d37b | 1008 | @return If Alias is not NULL, it will return a pointer to\r |
1e6e84c7 | 1009 | the NULL-terminated command for that alias.\r |
1010 | If Alias is NULL, ReturnedData points to a ';'\r | |
1011 | delimited list of alias (e.g.\r | |
1012 | ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.\r | |
36a9d672 | 1013 | @retval NULL An error ocurred.\r |
a31bd33c | 1014 | @retval NULL Alias was not a valid Alias.\r |
941b3569 | 1015 | **/\r |
1e6e84c7 | 1016 | typedef\r |
ea109f6b | 1017 | CONST CHAR16 *\r |
941b3569 | 1018 | (EFIAPI *EFI_SHELL_GET_ALIAS)(\r |
369d5f2e | 1019 | IN CONST CHAR16 *Alias,\r |
1020 | OUT BOOLEAN *Volatile OPTIONAL\r | |
94b17fa1 | 1021 | );\r |
1022 | \r | |
1023 | /**\r | |
1024 | Changes the current directory on the specified device.\r | |
1025 | \r | |
1026 | If the FileSystem is NULL, and the directory Dir does not contain a file system's\r | |
1027 | mapped name, this function changes the current working directory. If FileSystem is\r | |
1028 | NULL and the directory Dir contains a mapped name, then the current file system and\r | |
1029 | the current directory on that file system are changed.\r | |
1030 | \r | |
1031 | If FileSystem is not NULL, and Dir is NULL, then this changes the current working file\r | |
1032 | system.\r | |
1033 | \r | |
1034 | If FileSystem is not NULL and Dir is not NULL, then this function changes the current\r | |
1035 | directory on the specified file system.\r | |
1036 | \r | |
1037 | If the current working directory or the current working file system is changed then the\r | |
1e6e84c7 | 1038 | %cwd% environment variable will be updated.\r |
94b17fa1 | 1039 | \r |
941b3569 | 1040 | @param[in] FileSystem A pointer to the file system's mapped name. If NULL, then the current working\r |
94b17fa1 | 1041 | directory is changed.\r |
1e6e84c7 | 1042 | @param[in] Dir Points to the NULL-terminated directory on the device specified by FileSystem.\r |
94b17fa1 | 1043 | \r |
94b17fa1 | 1044 | @retval NULL Current directory does not exist.\r |
1e6e84c7 | 1045 | @return The current directory.\r |
94b17fa1 | 1046 | **/\r |
1047 | typedef\r | |
1048 | EFI_STATUS\r | |
1049 | (EFIAPI *EFI_SHELL_SET_CUR_DIR) (\r | |
1050 | IN CONST CHAR16 *FileSystem OPTIONAL,\r | |
1051 | IN CONST CHAR16 *Dir\r | |
1052 | );\r | |
1053 | \r | |
1054 | /**\r | |
1055 | Sets the environment variable.\r | |
1056 | \r | |
1057 | This function changes the current value of the specified environment variable. If the\r | |
1058 | environment variable exists and the Value is an empty string, then the environment\r | |
1059 | variable is deleted. If the environment variable exists and the Value is not an empty\r | |
1060 | string, then the value of the environment variable is changed. If the environment\r | |
1061 | variable does not exist and the Value is an empty string, there is no action. If the\r | |
1062 | environment variable does not exist and the Value is a non-empty string, then the\r | |
1063 | environment variable is created and assigned the specified value.\r | |
1e6e84c7 | 1064 | \r |
1065 | For a description of volatile and non-volatile environment variables, see UEFI Shell\r | |
94b17fa1 | 1066 | 2.0 specification section 3.6.1.\r |
1067 | \r | |
1e6e84c7 | 1068 | @param[in] Name Points to the NULL-terminated environment variable name.\r |
1069 | @param[in] Value Points to the NULL-terminated environment variable value. If the value is an\r | |
94b17fa1 | 1070 | empty string then the environment variable is deleted.\r |
125c2cf4 | 1071 | @param[in] Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r |
94b17fa1 | 1072 | \r |
1073 | @retval EFI_SUCCESS The environment variable was successfully updated.\r | |
1074 | **/\r | |
1075 | typedef\r | |
1076 | EFI_STATUS\r | |
1077 | (EFIAPI *EFI_SHELL_SET_ENV) (\r | |
1078 | IN CONST CHAR16 *Name,\r | |
1079 | IN CONST CHAR16 *Value,\r | |
1080 | IN BOOLEAN Volatile\r | |
1081 | );\r | |
1082 | \r | |
1083 | /**\r | |
1084 | Sets the file information to an opened file handle.\r | |
1085 | \r | |
1e6e84c7 | 1086 | This function changes file information. All file information in the EFI_FILE_INFO\r |
1087 | struct will be updated to the passed in data.\r | |
94b17fa1 | 1088 | \r |
1e6e84c7 | 1089 | @param[in] FileHandle A file handle.\r |
a31bd33c | 1090 | @param[in] FileInfo Points to new file information.\r |
94b17fa1 | 1091 | \r |
1092 | @retval EFI_SUCCESS The information was set.\r | |
1093 | @retval EFI_NO_MEDIA The device has no medium.\r | |
1094 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
1095 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
1096 | @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r | |
1097 | @retval EFI_ACCESS_DENIED The file was opened read-only.\r | |
1098 | @retval EFI_VOLUME_FULL The volume is full.\r | |
1099 | @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of EFI_FILE_INFO.\r | |
1100 | **/\r | |
1101 | typedef\r | |
1102 | EFI_STATUS\r | |
1103 | (EFIAPI *EFI_SHELL_SET_FILE_INFO)(\r | |
a405b86d | 1104 | IN SHELL_FILE_HANDLE FileHandle,\r |
94b17fa1 | 1105 | IN CONST EFI_FILE_INFO *FileInfo\r |
1106 | );\r | |
1107 | \r | |
1108 | /**\r | |
a31bd33c | 1109 | Sets a file's current position.\r |
94b17fa1 | 1110 | \r |
1111 | This function sets the current file position for the handle to the position supplied. With\r | |
1112 | the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only absolute positioning is\r | |
1113 | supported, and seeking past the end of the file is allowed (a subsequent write would\r | |
1114 | grow the file). Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position\r | |
1115 | to be set to the end of the file.\r | |
1116 | \r | |
a31bd33c | 1117 | @param[in] FileHandle The file handle on which requested position will be set.\r |
1118 | @param[in] Position Byte position from the start of the file.\r | |
94b17fa1 | 1119 | \r |
1120 | @retval EFI_SUCCESS Data was written.\r | |
1121 | @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open directories.\r | |
1122 | **/\r | |
1123 | typedef\r | |
1124 | EFI_STATUS\r | |
1125 | (EFIAPI *EFI_SHELL_SET_FILE_POSITION)(\r | |
a405b86d | 1126 | IN SHELL_FILE_HANDLE FileHandle,\r |
94b17fa1 | 1127 | IN UINT64 Position\r |
1128 | );\r | |
1129 | \r | |
1130 | /**\r | |
1131 | This function creates a mapping for a device path.\r | |
1132 | \r | |
a31bd33c | 1133 | @param[in] DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping,\r |
94b17fa1 | 1134 | then the mapping will be deleted.\r |
1e6e84c7 | 1135 | @param[in] Mapping Points to the NULL-terminated mapping for the device path.\r |
94b17fa1 | 1136 | \r |
1137 | @retval EFI_SUCCESS Mapping created or deleted successfully.\r | |
1138 | @retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the\r | |
1139 | boot service function LocateDevicePath().\r | |
1140 | @retval EFI_ACCESS_DENIED The mapping is a built-in alias.\r | |
1141 | **/\r | |
1142 | typedef\r | |
1143 | EFI_STATUS\r | |
1144 | (EFIAPI *EFI_SHELL_SET_MAP)(\r | |
1145 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
1146 | IN CONST CHAR16 *Mapping\r | |
1147 | );\r | |
1148 | \r | |
1149 | /**\r | |
1150 | Writes data to the file.\r | |
1151 | \r | |
1152 | This function writes the specified number of bytes to the file at the current file position.\r | |
1153 | The current file position is advanced the actual number of bytes written, which is\r | |
1154 | returned in BufferSize. Partial writes only occur when there has been a data error\r | |
1155 | during the write attempt (such as "volume space full"). The file automatically grows to\r | |
1156 | hold the data, if required.\r | |
1157 | \r | |
1158 | Direct writes to opened directories are not supported.\r | |
1159 | \r | |
4ff7e37b ED |
1160 | @param[in] FileHandle The opened file handle for writing.\r |
1161 | @param[in, out] BufferSize On input, size of Buffer.\r | |
1162 | @param[in] Buffer The buffer in which data to write.\r | |
94b17fa1 | 1163 | \r |
a31bd33c | 1164 | @retval EFI_SUCCESS Data was written.\r |
1165 | @retval EFI_UNSUPPORTED Writes to open directory are not supported.\r | |
1166 | @retval EFI_NO_MEDIA The device has no media.\r | |
1167 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
1168 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
1169 | @retval EFI_WRITE_PROTECTED The device is write-protected.\r | |
1170 | @retval EFI_ACCESS_DENIED The file was open for read only.\r | |
1171 | @retval EFI_VOLUME_FULL The volume is full.\r | |
94b17fa1 | 1172 | **/\r |
1173 | typedef\r | |
1174 | EFI_STATUS\r | |
1175 | (EFIAPI *EFI_SHELL_WRITE_FILE)(\r | |
a405b86d | 1176 | IN SHELL_FILE_HANDLE FileHandle,\r |
08d7f8e8 | 1177 | IN OUT UINTN *BufferSize,\r |
1178 | IN VOID *Buffer\r | |
94b17fa1 | 1179 | );\r |
1180 | \r | |
044ea4e5 | 1181 | //\r |
838b31a6 CP |
1182 | // EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0\r |
1183 | // Usage of this protocol will require version checking before attempting\r | |
1184 | // to use any new members. There is no need to check the version for\r | |
1185 | // members that existed in UEFI Shell Spec 2.0.\r | |
1186 | //\r | |
1187 | // Update below for any future UEFI Shell spec changes to this protocol.\r | |
044ea4e5 | 1188 | //\r |
838b31a6 CP |
1189 | // Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:\r |
1190 | // if ((2 == gEfiShellProtocol->MajorVersion) &&\r | |
1191 | // (0 == gEfiShellProtocol->MinorVersion)) {\r | |
1192 | // //\r | |
1193 | // // Cannot call:\r | |
1194 | // // RegisterGuidName - UEFI Shell 2.1\r | |
1195 | // // GetGuidName - UEFI Shell 2.1\r | |
1196 | // // GetGuidFromName - UEFI Shell 2.1\r | |
1197 | // // GetEnvEx - UEFI Shell 2.1\r | |
1198 | // //\r | |
1199 | // } else {\r | |
1200 | // //\r | |
1201 | // // Can use all members\r | |
1202 | // //\r | |
1203 | // }\r | |
1204 | //\r | |
1205 | typedef struct _EFI_SHELL_PROTOCOL {\r | |
044ea4e5 JC |
1206 | EFI_SHELL_EXECUTE Execute;\r |
1207 | EFI_SHELL_GET_ENV GetEnv;\r | |
1208 | EFI_SHELL_SET_ENV SetEnv;\r | |
1209 | EFI_SHELL_GET_ALIAS GetAlias;\r | |
1210 | EFI_SHELL_SET_ALIAS SetAlias;\r | |
1211 | EFI_SHELL_GET_HELP_TEXT GetHelpText;\r | |
1212 | EFI_SHELL_GET_DEVICE_PATH_FROM_MAP GetDevicePathFromMap;\r | |
1213 | EFI_SHELL_GET_MAP_FROM_DEVICE_PATH GetMapFromDevicePath;\r | |
1214 | EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH GetDevicePathFromFilePath;\r | |
1215 | EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH GetFilePathFromDevicePath;\r | |
1216 | EFI_SHELL_SET_MAP SetMap;\r | |
1217 | EFI_SHELL_GET_CUR_DIR GetCurDir;\r | |
1218 | EFI_SHELL_SET_CUR_DIR SetCurDir;\r | |
1219 | EFI_SHELL_OPEN_FILE_LIST OpenFileList;\r | |
1220 | EFI_SHELL_FREE_FILE_LIST FreeFileList;\r | |
1221 | EFI_SHELL_REMOVE_DUP_IN_FILE_LIST RemoveDupInFileList;\r | |
1222 | EFI_SHELL_BATCH_IS_ACTIVE BatchIsActive;\r | |
1223 | EFI_SHELL_IS_ROOT_SHELL IsRootShell;\r | |
1224 | EFI_SHELL_ENABLE_PAGE_BREAK EnablePageBreak;\r | |
1225 | EFI_SHELL_DISABLE_PAGE_BREAK DisablePageBreak;\r | |
1226 | EFI_SHELL_GET_PAGE_BREAK GetPageBreak;\r | |
1227 | EFI_SHELL_GET_DEVICE_NAME GetDeviceName;\r | |
1228 | EFI_SHELL_GET_FILE_INFO GetFileInfo;\r | |
1229 | EFI_SHELL_SET_FILE_INFO SetFileInfo;\r | |
1230 | EFI_SHELL_OPEN_FILE_BY_NAME OpenFileByName;\r | |
1231 | EFI_SHELL_CLOSE_FILE CloseFile;\r | |
1232 | EFI_SHELL_CREATE_FILE CreateFile;\r | |
1233 | EFI_SHELL_READ_FILE ReadFile;\r | |
1234 | EFI_SHELL_WRITE_FILE WriteFile;\r | |
1235 | EFI_SHELL_DELETE_FILE DeleteFile;\r | |
1236 | EFI_SHELL_DELETE_FILE_BY_NAME DeleteFileByName;\r | |
1237 | EFI_SHELL_GET_FILE_POSITION GetFilePosition;\r | |
1238 | EFI_SHELL_SET_FILE_POSITION SetFilePosition;\r | |
1239 | EFI_SHELL_FLUSH_FILE FlushFile;\r | |
1240 | EFI_SHELL_FIND_FILES FindFiles;\r | |
1241 | EFI_SHELL_FIND_FILES_IN_DIR FindFilesInDir;\r | |
1242 | EFI_SHELL_GET_FILE_SIZE GetFileSize;\r | |
1243 | EFI_SHELL_OPEN_ROOT OpenRoot;\r | |
1244 | EFI_SHELL_OPEN_ROOT_BY_HANDLE OpenRootByHandle;\r | |
1245 | EFI_EVENT ExecutionBreak;\r | |
1246 | UINT32 MajorVersion;\r | |
1247 | UINT32 MinorVersion;\r | |
1248 | // Added for Shell 2.1\r | |
838b31a6 CP |
1249 | EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName;\r |
1250 | EFI_SHELL_GET_GUID_NAME GetGuidName;\r | |
1251 | EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName;\r | |
1252 | EFI_SHELL_GET_ENV_EX GetEnvEx;\r | |
1253 | } EFI_SHELL_PROTOCOL;\r | |
044ea4e5 | 1254 | \r |
94b17fa1 | 1255 | extern EFI_GUID gEfiShellProtocolGuid;\r |
1256 | \r | |
d2b4564b | 1257 | enum ShellVersion {\r |
1258 | SHELL_MAJOR_VERSION = 2,\r | |
45f87893 | 1259 | SHELL_MINOR_VERSION = 2\r |
d2b4564b | 1260 | };\r |
1261 | \r | |
94b17fa1 | 1262 | #endif\r |