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