/** @file\r
EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r
- \r
- Copyright (c) 2006 - 2009, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
-**/\r
-\r
-#ifndef __EFI_SHELL_PROTOCOL__\r
-#define __EFI_SHELL_PROTOCOL__\r
-\r
-#include <Protocol/SimpleFileSystem.h>\r
-#include <Guid/FileInfo.h>\r
-\r
-#define EFI_SHELL_PROTOCOL_GUID \\r
- { \\r
- 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \\r
- }\r
-\r
-// replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.\r
-// they are identical outside of the name.\r
-typedef struct {\r
- LIST_ENTRY Link; ///< Linked list members.\r
- EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.\r
- CONST CHAR16 *FullName; ///< Fully qualified filename.\r
- CONST CHAR16 *FileName; ///< name of this file.\r
- EFI_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.\r
- EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.\r
-} EFI_SHELL_FILE_INFO;\r
-\r
-/**\r
- Returns whether any script files are currently being processed.\r
-\r
- @retval TRUE There is at least one script file active.\r
- @retval FALSE No script files are active now.\r
-\r
-**/\r
-typedef\r
-BOOLEAN\r
-(EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (\r
- VOID\r
- );\r
-\r
-/**\r
- Closes the file handle.\r
-\r
- This function closes a specified file handle. All 'dirty' cached file data is \r
- flushed to the device, and the file is closed. In all cases, the handle is \r
- closed.\r
-\r
- @param[in] FileHandle The file handle to be closed\r
-\r
- @retval EFI_SUCCESS The file closed sucessfully.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_CLOSE_FILE)(\r
- IN EFI_FILE_HANDLE FileHandle\r
- );\r
-\r
-/**\r
- Creates a file or directory by name.\r
-\r
- This function creates an empty new file or directory with the specified attributes and\r
- returns the new file's handle. If the file already exists and is read-only, then\r
- EFI_INVALID_PARAMETER will be returned.\r
- \r
- If the file already existed, it is truncated and its attributes updated. If the file is\r
- created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.\r
- \r
- If the file name begins with >v, then the file handle which is returned refers to the\r
- shell environment variable with the specified name. If the shell environment variable\r
- already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.\r
-\r
- @param[in] FileName Pointer to null-terminated file path.\r
- @param[in] FileAttribs The new file's attrbiutes. the different attributes are\r
- described in EFI_FILE_PROTOCOL.Open().\r
- @param[out] FileHandle On return, points to the created file handle or directory's handle\r
-\r
- @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_UNSUPPORTED could not open the file path\r
- @retval EFI_NOT_FOUND The specified file could not be found on the device, or could not\r
- file the file system on the device.\r
- @retval EFI_NO_MEDIA The device has no medium.\r
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
- longer supported.\r
- @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r
- the DirName.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
- @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
- when the media is write-protected.\r
- @retval EFI_ACCESS_DENIED The service denied access to the file.\r
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.\r
- @retval EFI_VOLUME_FULL The volume is full.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_CREATE_FILE)(\r
- IN CONST CHAR16 *FileName,\r
- IN UINT64 FileAttribs,\r
- OUT EFI_FILE_HANDLE *FileHandle\r
- );\r
-\r
-/**\r
- Deletes the file specified by the file handle.\r
-\r
- This function closes and deletes a file. In all cases, the file handle is closed. If the file\r
- cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the\r
- handle is still closed.\r
-\r
- @param[in] FileHandle The file handle to delete.\r
-\r
- @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.\r
- @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_DELETE_FILE)(\r
- IN EFI_FILE_HANDLE FileHandle\r
- );\r
-\r
-/**\r
- Deletes the file specified by the file name.\r
-\r
- This function deletes a file.\r
-\r
- @param[in] FileName Points to the null-terminated file name.\r
-\r
- @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.\r
- @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME)(\r
- IN CONST CHAR16 *FileName\r
- );\r
-\r
-/**\r
- Disables the page break output mode.\r
-**/\r
-typedef\r
-VOID\r
-(EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (\r
-VOID\r
-);\r
-\r
-/**\r
- Enables the page break output mode.\r
-**/\r
-typedef\r
-VOID\r
-(EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (\r
-VOID\r
-);\r
-\r
-/**\r
- Execute the command line.\r
-\r
- This function creates a nested instance of the shell and executes the specified\r
- command (CommandLine) with the specified environment (Environment). Upon return,\r
- the status code returned by the specified command is placed in StatusCode.\r
- \r
- If Environment is NULL, then the current environment is used and all changes made\r
- by the commands executed will be reflected in the current environment. If the\r
- Environment is non-NULL, then the changes made will be discarded.\r
- \r
- The CommandLine is executed from the current working directory on the current\r
- device.\r
-\r
- @param[in] ParentImageHandle A handle of the image that is executing the specified \r
- command line. \r
- @param[in] CommandLine Points to the null-terminated UCS-2 encoded string \r
- containing the command line. If NULL then the command-\r
- line will be empty.\r
- @param[in] Environment Points to a null-terminated array of environment \r
- variables with the format 'x=y', where x is the \r
- environment variable name and y is the value. If this\r
- is NULL, then the current shell environment is used.\r
- @param[out] ErrorCode Points to the status code returned by the command.\r
-\r
- @retval EFI_SUCCESS The command executed successfully. The status code \r
- returned by the command is pointed to by StatusCode.\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
- @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_EXECUTE) (\r
- IN EFI_HANDLE *ParentImageHandle,\r
- IN CHAR16 *CommandLine OPTIONAL,\r
- IN CHAR16 **Environment OPTIONAL,\r
- OUT EFI_STATUS *StatusCode OPTIONAL\r
- );\r
-\r
-/**\r
- Find files that match a specified pattern.\r
-\r
- This function searches for all files and directories that match the specified\r
- FilePattern. The FilePattern can contain wild-card characters. The resulting file\r
- information is placed in the file list FileList.\r
-\r
- The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo\r
- field is set to NULL.\r
-\r
- @param[in] FilePattern Points to a null-terminated shell file path, including wildcards.\r
- @param[out] FileList On return, points to the start of a file list containing the names \r
- of all matching files or else points to NULL if no matching files \r
- were found.\r
-\r
- @retval EFI_SUCCESS Files found.\r
- @retval EFI_NOT_FOUND No files found.\r
- @retval EFI_NO_MEDIA The device has no media.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_FIND_FILES)(\r
- IN CONST CHAR16 *FilePattern,\r
- OUT EFI_SHELL_FILE_INFO **FileList\r
- );\r
-\r
-/**\r
- Find all files in a specified directory.\r
-\r
- @param[in] FileDirHandle Handle of the directory to search.\r
- @param[out] FileList On return, points to the list of files in the directory \r
- or NULL if there are no files in the directory.\r
-\r
- @retval EFI_SUCCESS File information was returned successfully.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_NO_MEDIA The device media is not present.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(\r
-IN EFI_FILE_HANDLE FileDirHandle,\r
-OUT EFI_SHELL_FILE_INFO **FileList\r
-);\r
-\r
-/**\r
- Flushes data back to a device.\r
- \r
- This function flushes all modified data associated with a file to a device.\r
-\r
- @param[in] FileHandle The handle of the file to flush\r
-\r
- @retval EFI_SUCCESS The data was flushed.\r
- @retval EFI_NO_MEDIA The device has no medium.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
- @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
- @retval EFI_ACCESS_DENIED The file was opened read-only.\r
- @retval EFI_VOLUME_FULL The volume is full.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_FLUSH_FILE)(\r
- IN EFI_FILE_HANDLE FileHandle\r
- );\r
-\r
-/**\r
- Frees the file list.\r
- \r
- This function cleans up the file list and any related data structures. It has no\r
- impact on the files themselves.\r
-\r
- @param[in] FileList The file list to free. Type EFI_SHELL_FILE_INFO is \r
- defined in OpenFileList()\r
-\r
- @retval EFI_SUCCESS Free the file list successfully.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_FREE_FILE_LIST) (\r
- IN EFI_SHELL_FILE_INFO **FileList\r
- );\r
-\r
-/**\r
- Returns the current directory on the specified device.\r
-\r
- If FileSystemMapping is NULL, it returns the current working directory. If the\r
- FileSystemMapping is not NULL, it returns the current directory associated with the\r
- FileSystemMapping. In both cases, the returned name includes the file system\r
- mapping (i.e. fs0:\current-dir).\r
-\r
- @param[in] FileSystemMapping A pointer to the file system mapping. If NULL, \r
- then the current working directory is returned.\r
- \r
- @retval !=NULL The current directory.\r
- @retval NULL Current directory does not exist.\r
-**/\r
-typedef\r
-CONST CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_CUR_DIR) (\r
- IN CONST CHAR16 *FileSystemMapping OPTIONAL\r
- );\r
-\r
-typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;\r
-#define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001\r
-#define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002\r
-\r
-/**\r
- Gets the name of the device specified by the device handle.\r
-\r
- This function gets the user-readable name of the device specified by the device\r
- handle. If no user-readable name could be generated, then *BestDeviceName will be\r
- NULL and EFI_NOT_FOUND will be returned.\r
-\r
- If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the\r
- device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on\r
- DeviceHandle.\r
-\r
- If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the\r
- device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle.\r
- If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and\r
- EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then\r
- EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.\r
-\r
- @param[in] DeviceHandle The handle of the device.\r
- @param[in] Flags Determines the possible sources of component names. \r
- @param[in] Language A pointer to the language specified for the device \r
- name, in the same format as described in the UEFI \r
- specification, Appendix M.\r
- @param[out] BestDeviceName On return, points to the callee-allocated null-\r
- terminated name of the device. If no device name \r
- could be found, points to NULL. The name must be \r
- freed by the caller...\r
-\r
- @retval EFI_SUCCESS Get the name successfully.\r
- @retval EFI_NOT_FOUND Fail to get the device name.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(*EFI_SHELL_GET_DEVICE_NAME) (\r
- IN EFI_HANDLE DeviceHandle,\r
- IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **BestDeviceName\r
- );\r
-\r
-/**\r
- Gets the device path from the mapping.\r
-\r
- This function gets the device path associated with a mapping.\r
-\r
- @param[in] Mapping A pointer to the mapping\r
-\r
- @retval !=NULL Pointer to the device path that corresponds to the \r
- device mapping. The returned pointer does not need \r
- to be freed.\r
- @retval NULL There is no device path associated with the \r
- specified mapping.\r
-**/\r
-typedef\r
-CONST EFI_DEVICE_PATH_PROTOCOL *\r
-(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (\r
- IN CONST CHAR16 *Mapping\r
- );\r
-\r
-/**\r
- Converts a file system style name to a device path.\r
-\r
- This function converts a file system style name to a device path, by replacing any\r
- mapping references to the associated device path.\r
-\r
- @param[in] Path The pointer to the path.\r
-\r
- @return The pointer of the file path. The file path is callee \r
- allocated and should be freed by the caller.\r
-**/\r
-typedef\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (\r
- IN CONST CHAR16 *Path\r
- );\r
-\r
-/**\r
- This function updated with errata.\r
-\r
- Gets either a single or list of environment variables.\r
-\r
- If name is not NULL then this function returns the current value of the specified \r
- environment variable.\r
-\r
- If Name is NULL than a list of all environment variable names is returned. Each a \r
- NULL terminated string with a double NULL terminating the list.\r
-\r
- @param[in] Name A pointer to the environment variable name. If \r
- Name is NULL, then the function will return all \r
- of the defined shell environment variables. In \r
- the case where multiple environment variables are \r
- being returned, each variable will be terminated by \r
- a NULL, and the list will be terminated by a double \r
- NULL.\r
-\r
- @return !=NULL A pointer to the returned string.\r
- The returned pointer does not need to be freed by the caller.\r
-\r
- @retval NULL The environment variable doesn't exist or there are \r
- no environment variables.\r
-**/\r
-typedef\r
-CONST CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_ENV) (\r
- IN CONST CHAR16 *Name OPTIONAL\r
- );\r
-\r
-/**\r
- Gets the file information from an open file handle.\r
-\r
- This function allocates a buffer to store the file's information. It's the caller's\r
- responsibility to free the buffer.\r
-\r
- @param[in] FileHandle A File Handle.\r
-\r
- @return !=NULL Cannot get the file info.\r
- @return NULL A pointer to a buffer with file information.\r
-**/\r
-typedef\r
-EFI_FILE_INFO *\r
-(EFIAPI *EFI_SHELL_GET_FILE_INFO)(\r
- IN EFI_FILE_HANDLE FileHandle\r
- );\r
-\r
-/**\r
- Converts a device path to a file system-style path.\r
-\r
- This function converts a device path to a file system path by replacing part, or all, of\r
- the device path with the file-system mapping. If there are more than one application\r
- file system mappings, the one that most closely matches Path will be used.\r
-\r
- @param[in] Path The pointer to the device path\r
-\r
- @return all The pointer of the null-terminated file path. The path \r
- is callee-allocated and should be freed by the caller.\r
-**/\r
-typedef\r
-CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (\r
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Path\r
- );\r
-\r
-/**\r
- Gets a file's current position.\r
-\r
- This function returns the current file position for the file handle. For directories, the\r
- current file position has no meaning outside of the file system driver and as such, the\r
- operation is not supported.\r
-\r
- @param[in] FileHandle The file handle on which to get the current position.\r
- @paramp[out] Position Byte position from the start of the file.\r
-\r
- @retval EFI_SUCCESS Data was accessed.\r
- @retval EFI_UNSUPPORTED The request is not valid on open directories.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_GET_FILE_POSITION)(\r
- IN EFI_FILE_HANDLE FileHandle,\r
- OUT UINT64 *Position\r
- );\r
-\r
-/**\r
- Gets the size of a file.\r
-\r
- This function returns the size of the file specified by FileHandle.\r
-\r
- @param[in] FileHandle The handle of the file.\r
- @param[out] Size The size of this file.\r
-\r
- @retval EFI_SUCCESS Get the file's size.\r
- @retval EFI_DEVICE_ERROR Can't access the file.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_GET_FILE_SIZE)(\r
- IN EFI_FILE_HANDLE FileHandle,\r
- OUT UINT64 *Size\r
- );\r
-\r
-/**\r
- Return help information about a specific command.\r
-\r
- This function returns the help information for the specified command. The help text\r
- can be internal to the shell or can be from a UEFI Shell manual page.\r
- \r
- If Sections is specified, then each section name listed will be compared in a casesensitive\r
- manner, to the section names described in Appendix B. If the section exists,\r
- it will be appended to the returned help text. If the section does not exist, no\r
- information will be returned. If Sections is NULL, then all help text information\r
- available will be returned.\r
-\r
- @param[in] Command Points to the null-terminated UEFI Shell command name.\r
- @param[in] Sections Points to the null-terminated comma-delimited \r
- section names to return. If NULL, then all \r
- sections will be returned.\r
- @param[out] HelpText On return, points to a callee-allocated buffer \r
- containing all specified help text.\r
-\r
- @retval EFI_SUCCESS The help text was returned.\r
- @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the \r
- returned help text.\r
- @retval EFI_INVALID_PARAMETER HelpText is NULL.\r
- @retval EFI_NOT_FOUND There is no help text available for Command.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_GET_HELP_TEXT) (\r
- IN CONST CHAR16 *Command,\r
- IN CONST CHAR16 *Sections OPTIONAL,\r
- OUT CHAR16 **HelpText\r
- );\r
-\r
-/**\r
- This funciton is updated with Errata.\r
-\r
- Gets the mapping(s) that most closely matches the device path.\r
-\r
- This function gets the mapping which corresponds to the device path *DevicePath. If\r
- there is no exact match, then the mapping which most closely matches *DevicePath\r
- is returned, and *DevicePath is updated to point to the remaining portion of the\r
- device path. If there is an exact match, the mapping is returned and *DevicePath\r
- points to the end-of-device-path node.\r
-\r
- If there are multiple map names they will be semi-colon seperated in the \r
- NULL-terminated string.\r
-\r
- @param[in,out] DevicePath On entry, points to a device path pointer. On \r
- exit, updates the pointer to point to the \r
- portion of the device path after the mapping.\r
-\r
- @retval NULL No mapping was found.\r
- @retval !=NULL Pointer to null-terminated mapping. The buffer \r
- is callee allocated and should be freed by the caller.\r
-**/\r
-typedef\r
-CONST CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (\r
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
- );\r
-\r
-/**\r
- Gets the enable status of the page break output mode.\r
-\r
- User can use this function to determine current page break mode.\r
-\r
- @retval TRUE The page break output mode is enabled.\r
- @retval FALSE The page break output mode is disabled.\r
-**/\r
-typedef\r
-BOOLEAN\r
-(EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (\r
- VOID\r
- );\r
-\r
-/**\r
- Judges whether the active shell is the root shell.\r
-\r
- This function makes the user to know that whether the active Shell is the root shell.\r
-\r
- @retval TRUE The active Shell is the root Shell.\r
- @retval FALSE The active Shell is NOT the root Shell.\r
-**/\r
-typedef\r
-BOOLEAN\r
-(EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (\r
-VOID\r
-);\r
-\r
-/**\r
- Opens a file or a directory by file name.\r
-\r
- This function opens the specified file in the specified OpenMode and returns a file\r
- handle.\r
- If the file name begins with >v, then the file handle which is returned refers to the\r
- shell environment variable with the specified name. If the shell environment variable\r
- exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then\r
- EFI_INVALID_PARAMETER is returned.\r
-\r
- If the file name is >i, then the file handle which is returned refers to the standard\r
- input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER\r
- is returned.\r
-\r
- If the file name is >o, then the file handle which is returned refers to the standard\r
- output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r
- is returned.\r
-\r
- If the file name is >e, then the file handle which is returned refers to the standard\r
- error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r
- is returned.\r
-\r
- If the file name is NUL, then the file handle that is returned refers to the standard NUL\r
- file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is\r
- returned.\r
-\r
- If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the\r
- FileHandle is NULL.\r
-\r
- @param[in] FileName Points to the null-terminated UCS-2 encoded file name.\r
- @param[out] FileHandle On return, points to the file handle.\r
- @param[in] OpenMode File open mode. Either EFI_FILE_MODE_READ or \r
- EFI_FILE_MODE_WRITE from section 12.4 of the UEFI \r
- Specification.\r
- @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL.\r
- @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL.\r
- @retval EFI_NOT_FOUND The specified file could not be found on the device or the file\r
- system could not be found on the device. FileHandle is NULL.\r
- @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL.\r
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
- longer supported. FileHandle is NULL.\r
- @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r
- the FileName. FileHandle is NULL.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL.\r
- @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
- when the media is write-protected. FileHandle is NULL.\r
- @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL.\r
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle\r
- is NULL.\r
- @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (\r
- IN CONST CHAR16 *FileName,\r
- OUT EFI_FILE_HANDLE *FileHandle,\r
- IN UINT64 OpenMode\r
- );\r
-\r
-/**\r
- Opens the files that match the path specified.\r
-\r
- This function opens all of the files specified by Path. Wildcards are processed\r
- according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each \r
- matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.\r
-\r
- @param[in] Path A pointer to the path string.\r
- @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or\r
- EFI_FILE_MODE_WRITE.\r
- @param[in,out] FileList Points to the start of a list of files opened.\r
-\r
- @retval EFI_SUCCESS Create the file list successfully.\r
- @return Can't create the file list.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (\r
- IN CHAR16 *Path,\r
- IN UINT64 OpenMode,\r
- IN OUT EFI_SHELL_FILE_INFO **FileList\r
- );\r
-\r
-/**\r
- Opens the root directory of a device.\r
-\r
- This function opens the root directory of a device and returns a file handle to it.\r
-\r
- @param[in] DevicePath Points to the device path corresponding to the device where the\r
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.\r
- @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r
- device.\r
-\r
- @retval EFI_SUCCESS Root opened successfully.\r
- @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r
- could not be opened.\r
- @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r
- @retval EFI_DEVICE_ERROR The device had an error.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_OPEN_ROOT)(\r
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
- OUT EFI_FILE_HANDLE *FileHandle\r
- );\r
-\r
-/**\r
- Opens the root directory of a device on a handle.\r
-\r
- This function opens the root directory of a device and returns a file handle to it.\r
-\r
- @param[in] DeviceHandle The handle of the device that contains the volume.\r
- @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r
- device.\r
-\r
- @retval EFI_SUCCESS Root opened successfully.\r
- @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r
- could not be opened.\r
- @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r
- @retval EFI_DEVICE_ERROR The device had an error.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(\r
- IN EFI_HANDLE DeviceHandle,\r
- OUT EFI_FILE_HANDLE *FileHandle\r
- );\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-/**\r
- Reads data from the file.\r
-\r
- If FileHandle is not a directory, the function reads the requested number of bytes\r
- from the file at the file's current position and returns them in Buffer. If the read goes\r
- beyond the end of the file, the read length is truncated to the end of the file. The file's\r
- current position is increased by the number of bytes returned.\r
- If FileHandle is a directory, then an error is returned.\r
-\r
- @param[in] FileHandle The opened file handle for read.\r
- @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.\r
- @param[in,out] Buffer The buffer in which data is read.\r
-\r
- @retval EFI_SUCCESS Data was read.\r
- @retval EFI_NO_MEDIA The device has no media.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
- @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required size.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_READ_FILE) (\r
- IN EFI_FILE_HANDLE FileHandle,\r
- IN OUT UINTN *ReadSize,\r
- IN OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- Deletes the duplicate file names files in the given file list.\r
-\r
- @param[in] FileList A pointer to the first entry in the file list.\r
-\r
- @retval EFI_SUCCESS Always success.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (\r
- IN EFI_SHELL_FILE_INFO **FileList\r
- );\r
-\r
-//\r
-// The SetAlias and GetAlias functions were affected by errata. \r
-// They are not UEFI Shell 2.0 (no errata) compliant.\r
-//\r
-\r
-/**\r
- Changes a shell command alias.\r
-\r
- This function creates an alias for a shell command.\r
-\r
- @param[in] Command Points to the null-terminated shell command or existing alias.\r
- @param[in] Alias Points to the null-terminated alias for the shell command. If this is NULL, and\r
- Command refers to an alias, that alias will be deleted.\r
- @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If\r
- FALSE and the alias already exists, then the existing alias is unchanged and\r
- EFI_ACCESS_DENIED is returned.\r
- @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the \r
- Alias being set will be stored in a non-volatile fashion.\r
-\r
- @retval EFI_SUCCESS Alias created or deleted successfully.\r
- @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to\r
- FALSE.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_ALIAS)(\r
- IN CONST CHAR16 *Command,\r
- IN CONST CHAR16 *Alias,\r
- IN BOOLEAN Replace,\r
- IN BOOLEAN Volatile\r
- );\r
-\r
-/**\r
- This function returns the command associated with a alias or a list of all\r
- alias'.\r
-\r
- @param[in] Alias Points to the null-terminated shell alias. \r
- If this parameter is NULL, then all \r
- aliases will be returned in ReturnedData.\r
- @param[out] Volatile Upon return of a single command if TRUE indicates\r
- this is stored in a volatile fashion. FALSE otherwise.\r
- @return If Alias is not NULL, it will return a pointer to \r
- the null-terminated command for that alias. \r
- If Alias is NULL, ReturnedData points to a \91;\92 \r
- delimited list of alias (e.g. \r
- ReturnedData = \93dir;del;copy;mfp\94) that is null-terminated. \r
- @retval NULL An error ocurred.\r
- @retval NULL Alias was not a valid Alias.\r
-**/\r
-typedef \r
-CONST CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_ALIAS)(\r
- IN CONST CHAR16 *Alias,\r
- OUT BOOLEAN *Volatile OPTIONAL\r
- );\r
-\r
-/**\r
- Changes the current directory on the specified device.\r
-\r
- If the FileSystem is NULL, and the directory Dir does not contain a file system's\r
- mapped name, this function changes the current working directory. If FileSystem is\r
- NULL and the directory Dir contains a mapped name, then the current file system and\r
- the current directory on that file system are changed.\r
-\r
- If FileSystem is not NULL, and Dir is NULL, then this changes the current working file\r
- system.\r
-\r
- If FileSystem is not NULL and Dir is not NULL, then this function changes the current\r
- directory on the specified file system.\r
-\r
- If the current working directory or the current working file system is changed then the\r
- %cwd% environment variable will be updated\r
-\r
- @param[in] FileSystem A pointer to the file system's mapped name. If NULL, then the current working\r
- directory is changed.\r
- @param[in] Dir Points to the null-terminated directory on the device specified by FileSystem.\r
-\r
- @return !=NULL The current directory.\r
- @retval NULL Current directory does not exist.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_CUR_DIR) (\r
- IN CONST CHAR16 *FileSystem OPTIONAL,\r
- IN CONST CHAR16 *Dir\r
- );\r
-\r
-/**\r
- Sets the environment variable.\r
-\r
- This function changes the current value of the specified environment variable. If the\r
- environment variable exists and the Value is an empty string, then the environment\r
- variable is deleted. If the environment variable exists and the Value is not an empty\r
- string, then the value of the environment variable is changed. If the environment\r
- variable does not exist and the Value is an empty string, there is no action. If the\r
- environment variable does not exist and the Value is a non-empty string, then the\r
- environment variable is created and assigned the specified value.\r
- \r
- For a description of volatile and non-volatile environment variables, see UEFI Shell \r
- 2.0 specification section 3.6.1.\r
-\r
- @param[in] Name Points to the null-terminated environment variable name.\r
- @param[in] Value Points to the null-terminated environment variable value. If the value is an\r
- empty string then the environment variable is deleted.\r
- @param[in] Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r
-\r
- @retval EFI_SUCCESS The environment variable was successfully updated.\r
**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_ENV) (\r
- IN CONST CHAR16 *Name,\r
- IN CONST CHAR16 *Value,\r
- IN BOOLEAN Volatile\r
- );\r
-\r
-/**\r
- Sets the file information to an opened file handle.\r
-\r
- This function changes file information.\r
-\r
- @param[in] FileHandle A file handle\r
- @param[in] FileInfo Points to new file information.\r
-\r
- @retval EFI_SUCCESS The information was set.\r
- @retval EFI_NO_MEDIA The device has no medium.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
- @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
- @retval EFI_ACCESS_DENIED The file was opened read-only.\r
- @retval EFI_VOLUME_FULL The volume is full.\r
- @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of EFI_FILE_INFO.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_FILE_INFO)(\r
- IN EFI_FILE_HANDLE FileHandle,\r
- IN CONST EFI_FILE_INFO *FileInfo\r
- );\r
-\r
-/**\r
- Sets a file's current position.\r
-\r
- This function sets the current file position for the handle to the position supplied. With\r
- the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only absolute positioning is\r
- supported, and seeking past the end of the file is allowed (a subsequent write would\r
- grow the file). Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position\r
- to be set to the end of the file.\r
-\r
- @param[in] FileHandle The file handle on which requested position will be set.\r
- @param[in] Position Byte position from the start of the file.\r
-\r
- @retval EFI_SUCCESS Data was written.\r
- @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open directories.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_FILE_POSITION)(\r
- IN EFI_FILE_HANDLE FileHandle,\r
- IN UINT64 Position\r
- );\r
-\r
-/**\r
- This function creates a mapping for a device path.\r
-\r
- @param[in] DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping,\r
- then the mapping will be deleted.\r
- @param[in] Mapping Points to the null-terminated mapping for the device path.\r
-\r
- @retval EFI_SUCCESS Mapping created or deleted successfully.\r
- @retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the\r
- boot service function LocateDevicePath().\r
- @retval EFI_ACCESS_DENIED The mapping is a built-in alias.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_SET_MAP)(\r
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
- IN CONST CHAR16 *Mapping\r
- );\r
-\r
-/**\r
- Writes data to the file.\r
-\r
- This function writes the specified number of bytes to the file at the current file position.\r
- The current file position is advanced the actual number of bytes written, which is\r
- returned in BufferSize. Partial writes only occur when there has been a data error\r
- during the write attempt (such as "volume space full"). The file automatically grows to\r
- hold the data, if required.\r
-\r
- Direct writes to opened directories are not supported.\r
-\r
- @param[in] FileHandle The opened file handle for writing.\r
- @param[in,out] BufferSize On input, size of Buffer.\r
- @param[in] Buffer The buffer in which data to write.\r
-\r
- @retval EFI_SUCCESS Data was written.\r
- @retval EFI_UNSUPPORTED Writes to open directory are not supported.\r
- @retval EFI_NO_MEDIA The device has no media.\r
- @retval EFI_DEVICE_ERROR The device reported an error.\r
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
- @retval EFI_WRITE_PROTECTED The device is write-protected.\r
- @retval EFI_ACCESS_DENIED The file was open for read only.\r
- @retval EFI_VOLUME_FULL The volume is full.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_WRITE_FILE)(\r
- IN EFI_FILE_HANDLE FileHandle,\r
- IN OUT UINTN *BufferSize,\r
- IN VOID *Buffer\r
- );\r
-\r
-typedef struct _EFI_SHELL_PROTOCOL {\r
- EFI_SHELL_EXECUTE Execute;\r
- EFI_SHELL_GET_ENV GetEnv;\r
- EFI_SHELL_SET_ENV SetEnv;\r
- EFI_SHELL_GET_ALIAS GetAlias;\r
- EFI_SHELL_SET_ALIAS SetAlias;\r
- EFI_SHELL_GET_HELP_TEXT GetHelpText;\r
- EFI_SHELL_GET_DEVICE_PATH_FROM_MAP GetDevicePathFromMap;\r
- EFI_SHELL_GET_MAP_FROM_DEVICE_PATH GetMapFromDevicePath;\r
- EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH GetDevicePathFromFilePath;\r
- EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH GetFilePathFromDevicePath;\r
- EFI_SHELL_SET_MAP SetMap;\r
- EFI_SHELL_GET_CUR_DIR GetCurDir;\r
- EFI_SHELL_SET_CUR_DIR SetCurDir;\r
- EFI_SHELL_OPEN_FILE_LIST OpenFileList;\r
- EFI_SHELL_FREE_FILE_LIST FreeFileList;\r
- EFI_SHELL_REMOVE_DUP_IN_FILE_LIST RemoveDupInFileList;\r
- EFI_SHELL_BATCH_IS_ACTIVE BatchIsActive;\r
- EFI_SHELL_IS_ROOT_SHELL IsRootShell;\r
- EFI_SHELL_ENABLE_PAGE_BREAK EnablePageBreak;\r
- EFI_SHELL_DISABLE_PAGE_BREAK DisablePageBreak;\r
- EFI_SHELL_GET_PAGE_BREAK GetPageBreak;\r
- EFI_SHELL_GET_DEVICE_NAME GetDeviceName;\r
- EFI_SHELL_GET_FILE_INFO GetFileInfo;\r
- EFI_SHELL_SET_FILE_INFO SetFileInfo;\r
- EFI_SHELL_OPEN_FILE_BY_NAME OpenFileByName;\r
- EFI_SHELL_CLOSE_FILE CloseFile;\r
- EFI_SHELL_CREATE_FILE CreateFile;\r
- EFI_SHELL_READ_FILE ReadFile;\r
- EFI_SHELL_WRITE_FILE WriteFile;\r
- EFI_SHELL_DELETE_FILE DeleteFile;\r
- EFI_SHELL_DELETE_FILE_BY_NAME DeleteFileByName;\r
- EFI_SHELL_GET_FILE_POSITION GetFilePosition;\r
- EFI_SHELL_SET_FILE_POSITION SetFilePosition;\r
- EFI_SHELL_FLUSH_FILE FlushFile;\r
- EFI_SHELL_FIND_FILES FindFiles;\r
- EFI_SHELL_FIND_FILES_IN_DIR FindFilesInDir;\r
- EFI_SHELL_GET_FILE_SIZE GetFileSize;\r
- EFI_SHELL_OPEN_ROOT OpenRoot;\r
- EFI_SHELL_OPEN_ROOT_BY_HANDLE OpenRootByHandle;\r
- EFI_EVENT ExecutionBreak;\r
- UINT32 MajorVersion;\r
- UINT32 MinorVersion;\r
-} EFI_SHELL_PROTOCOL;\r
\r
-extern EFI_GUID gEfiShellProtocolGuid;\r
+#ifndef __EFI_SHELL_PROTOCOL_H__WRAPPER__\r
+#define __EFI_SHELL_PROTOCOL_H__WRAPPER__\r
\r
-enum ShellVersion {\r
- SHELL_MAJOR_VERSION = 2,\r
- SHELL_MINOR_VERSION = 0\r
-};\r
+#include <Protocol/Shell.h>\r
\r
#endif\r