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