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