+++ /dev/null
-/** @file\r
- EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r
-\r
- (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2006 - 2015, 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
- 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
-\r
-#ifndef __EFI_SHELL_PROTOCOL__\r
-#define __EFI_SHELL_PROTOCOL__\r
-\r
-#include <ShellBase.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
- SHELL_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 SHELL_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 The file path could not be opened.\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 SHELL_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 SHELL_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 deleted.\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 SHELL_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 SHELL_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
- Note that the current directory string should exclude the tailing backslash character.\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
-(EFIAPI *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
- 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 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 environment variable and Attributes, or list of environment variables. Can be \r
- used instead of GetEnv().\r
-\r
- This function returns the current value of the specified environment variable and\r
- the Attributes. If no variable name was specified, then all of the known\r
- variables will be returned.\r
-\r
- @param[in] Name A pointer to the environment variable name. If Name is NULL,\r
- then the function will return all of the defined shell \r
- environment variables. In the case where multiple environment\r
- variables are being returned, each variable will be terminated \r
- by a NULL, and the list will be terminated by a double NULL.\r
- @param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for\r
- the environment variable. In the case where Name is NULL, and\r
- multiple environment variables are being returned, Attributes\r
- is undefined.\r
-\r
- @retval NULL The environment variable doesn't exist. \r
- @return The environment variable's value. The returned pointer does not \r
- need to be freed by the caller. \r
-**/\r
-typedef\r
-CONST CHAR16 *\r
-(EFIAPI *EFI_SHELL_GET_ENV_EX) (\r
- IN CONST CHAR16 *Name,\r
- OUT UINT32 *Attributes 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
- @retval NULL Cannot get the file info.\r
- @return A pointer to a buffer with file information.\r
-**/\r
-typedef\r
-EFI_FILE_INFO *\r
-(EFIAPI *EFI_SHELL_GET_FILE_INFO)(\r
- IN SHELL_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 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
- @param[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 SHELL_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 SHELL_FILE_HANDLE FileHandle,\r
- OUT UINT64 *Size\r
- );\r
-\r
-/**\r
- Get the GUID value from a human readable name.\r
-\r
- If GuidName is a known GUID name, then update Guid to have the correct value for\r
- that GUID.\r
-\r
- This function is only available when the major and minor versions in the\r
- EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
-\r
- @param[in] GuidName A pointer to the localized name for the GUID being queried.\r
- @param[out] Guid A pointer to the GUID structure to be filled in.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_INVALID_PARAMETER Guid was NULL.\r
- @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
- @retval EFI_NOT_FOUND GuidName is not a known GUID Name.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(\r
- IN CONST CHAR16 *GuidName,\r
- OUT EFI_GUID *Guid\r
- );\r
-\r
-/**\r
- Get the human readable name for a GUID from the value.\r
-\r
- If Guid is assigned a name, then update *GuidName to point to the name. The callee\r
- should not modify the value.\r
-\r
- This function is only available when the major and minor versions in the\r
- EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
-\r
- @param[in] Guid A pointer to the GUID being queried.\r
- @param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_INVALID_PARAMETER Guid was NULL.\r
- @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
- @retval EFI_NOT_FOUND Guid is not assigned a name.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_GET_GUID_NAME)(\r
- IN CONST EFI_GUID *Guid,\r
- OUT CONST CHAR16 **GuidName\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
- 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 SHELL_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 SHELL_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 SHELL_FILE_HANDLE *FileHandle\r
- );\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 SHELL_FILE_HANDLE FileHandle,\r
- IN OUT UINTN *ReadSize,\r
- IN OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- Register a GUID and a localized human readable name for it.\r
-\r
- If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID\r
- names must be used whenever a shell command outputs GUID information.\r
-\r
- This function is only available when the major and minor versions in the\r
- EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
-\r
- @param[in] Guid A pointer to the GUID being registered.\r
- @param[in] GuidName A pointer to the localized name for the GUID being registered.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_INVALID_PARAMETER Guid was NULL.\r
- @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
- @retval EFI_ACCESS_DENIED Guid already is assigned a name.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(\r
- IN CONST EFI_GUID *Guid,\r
- IN CONST CHAR16 *GuidName\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
- 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 ';'\r
- delimited list of alias (e.g.\r
- ReturnedData = "dir;del;copy;mfp") 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
- @retval NULL Current directory does not exist.\r
- @return The current directory.\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. All file information in the EFI_FILE_INFO\r
- struct will be updated to the passed in data.\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 SHELL_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 SHELL_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 SHELL_FILE_HANDLE FileHandle,\r
- IN OUT UINTN *BufferSize,\r
- IN VOID *Buffer\r
- );\r
-\r
-//\r
-// EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0\r
-// Usage of this protocol will require version checking before attempting\r
-// to use any new members. There is no need to check the version for\r
-// members that existed in UEFI Shell Spec 2.0.\r
-//\r
-// Update below for any future UEFI Shell spec changes to this protocol.\r
-//\r
-// Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:\r
-// if ((2 == gEfiShellProtocol->MajorVersion) &&\r
-// (0 == gEfiShellProtocol->MinorVersion)) {\r
-// //\r
-// // Cannot call:\r
-// // RegisterGuidName - UEFI Shell 2.1\r
-// // GetGuidName - UEFI Shell 2.1\r
-// // GetGuidFromName - UEFI Shell 2.1\r
-// // GetEnvEx - UEFI Shell 2.1\r
-// //\r
-// } else {\r
-// //\r
-// // Can use all members\r
-// //\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
- // Added for Shell 2.1\r
- EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName;\r
- EFI_SHELL_GET_GUID_NAME GetGuidName;\r
- EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName;\r
- EFI_SHELL_GET_ENV_EX GetEnvEx;\r
-} EFI_SHELL_PROTOCOL;\r
-\r
-extern EFI_GUID gEfiShellProtocolGuid;\r
-\r
-enum ShellVersion {\r
- SHELL_MAJOR_VERSION = 2,\r
- SHELL_MINOR_VERSION = 1\r
-};\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- EFI Shell Dynamic Command registration protocol\r
-\r
- (C) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.<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
- 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
-\r
-#ifndef __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL__\r
-#define __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL__\r
-\r
-#include <ShellBase.h>\r
-#include <Protocol/EfiShellParameters.h>\r
-#include <Protocol/EfiShell.h>\r
-\r
-\r
-// {3C7200E9-005F-4EA4-87DE-A3DFAC8A27C3}\r
-#define EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID \\r
- { \\r
- 0x3c7200e9, 0x005f, 0x4ea4, { 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 } \\r
- }\r
-\r
-\r
-//\r
-// Define for forward reference.\r
-//\r
-typedef struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL;\r
-\r
-\r
-/**\r
- This is the shell command handler function pointer callback type. This\r
- function handles the command when it is invoked in the shell.\r
-\r
- @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
- @param[in] SystemTable The pointer to the system table.\r
- @param[in] ShellParameters The parameters associated with the command.\r
- @param[in] Shell The instance of the shell protocol used in the context\r
- of processing this command.\r
-\r
- @return EFI_SUCCESS the operation was sucessful\r
- @return other the operation failed.\r
-**/\r
-typedef\r
-SHELL_STATUS\r
-(EFIAPI * SHELL_COMMAND_HANDLER)(\r
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
- IN EFI_SYSTEM_TABLE *SystemTable,\r
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,\r
- IN EFI_SHELL_PROTOCOL *Shell\r
- );\r
-\r
-/**\r
- This is the command help handler function pointer callback type. This\r
- function is responsible for displaying help information for the associated\r
- command.\r
-\r
- @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
- @param[in] Language The pointer to the language string to use.\r
-\r
- @return string Pool allocated help string, must be freed by caller\r
-**/\r
-typedef\r
-CHAR16*\r
-(EFIAPI * SHELL_COMMAND_GETHELP)(\r
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
- IN CONST CHAR8 *Language\r
- );\r
-\r
-/// EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL protocol structure.\r
-struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL {\r
- \r
- CONST CHAR16 *CommandName;\r
- SHELL_COMMAND_HANDLER Handler;\r
- SHELL_COMMAND_GETHELP GetHelp;\r
-\r
-};\r
-\r
-extern EFI_GUID gEfiShellDynamicCommandProtocolGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- EFI Shell protocol as defined in the UEFI Shell 2.0 specification.\r
-\r
- Copyright (c) 2006 - 2011, 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
- 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
-\r
-#ifndef __EFI_SHELL_PARAMETERS_PROTOCOL__\r
-#define __EFI_SHELL_PARAMETERS_PROTOCOL__\r
-\r
-#include <ShellBase.h>\r
-\r
-#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \\r
- { \\r
- 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } \\r
- }\r
-\r
-typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {\r
- ///\r
- /// Points to an Argc-element array of points to NULL-terminated strings containing\r
- /// the command-line parameters. The first entry in the array is always the full file\r
- /// path of the executable. Any quotation marks that were used to preserve\r
- /// whitespace have been removed.\r
- ///\r
- CHAR16 **Argv;\r
-\r
- ///\r
- /// The number of elements in the Argv array.\r
- ///\r
- UINTN Argc;\r
-\r
- ///\r
- /// The file handle for the standard input for this executable. This may be different\r
- /// from the ConInHandle in EFI_SYSTEM_TABLE.\r
- ///\r
- SHELL_FILE_HANDLE StdIn;\r
-\r
- ///\r
- /// The file handle for the standard output for this executable. This may be different\r
- /// from the ConOutHandle in EFI_SYSTEM_TABLE.\r
- ///\r
- SHELL_FILE_HANDLE StdOut;\r
-\r
- ///\r
- /// The file handle for the standard error output for this executable. This may be\r
- /// different from the StdErrHandle in EFI_SYSTEM_TABLE.\r
- ///\r
- SHELL_FILE_HANDLE StdErr;\r
-} EFI_SHELL_PARAMETERS_PROTOCOL;\r
-\r
-extern EFI_GUID gEfiShellParametersProtocolGuid;\r
-\r
-#endif\r
--- /dev/null
+/** @file\r
+ EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r
+\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
+ 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
+\r
+#ifndef __EFI_SHELL_PROTOCOL_H__\r
+#define __EFI_SHELL_PROTOCOL_H__\r
+\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
+typedef VOID *SHELL_FILE_HANDLE;\r
+\r
+typedef enum {\r
+ ///\r
+ /// The operation completed successfully.\r
+ ///\r
+ SHELL_SUCCESS = 0,\r
+\r
+ ///\r
+ /// The image failed to load.\r
+ ///\r
+ SHELL_LOAD_ERROR = 1,\r
+\r
+ ///\r
+ /// The parameter was incorrect.\r
+ ///\r
+ SHELL_INVALID_PARAMETER = 2,\r
+\r
+ ///\r
+ /// The operation is not supported.\r
+ ///\r
+ SHELL_UNSUPPORTED = 3,\r
+\r
+ ///\r
+ /// The buffer was not the proper size for the request.\r
+ ///\r
+ SHELL_BAD_BUFFER_SIZE = 4,\r
+\r
+ ///\r
+ /// The buffer was not large enough to hold the requested data.\r
+ /// The required buffer size is returned in the appropriate\r
+ /// parameter when this error occurs.\r
+ ///\r
+ SHELL_BUFFER_TOO_SMALL = 5,\r
+\r
+ ///\r
+ /// There is no data pending upon return.\r
+ ///\r
+ SHELL_NOT_READY = 6,\r
+\r
+ ///\r
+ /// The physical device reported an error while attempting the\r
+ /// operation.\r
+ ///\r
+ SHELL_DEVICE_ERROR = 7,\r
+\r
+ ///\r
+ /// The device cannot be written to.\r
+ ///\r
+ SHELL_WRITE_PROTECTED = 8,\r
+\r
+ ///\r
+ /// The resource has run out.\r
+ ///\r
+ SHELL_OUT_OF_RESOURCES = 9,\r
+\r
+ ///\r
+ /// An inconsistency was detected on the file system causing the\r
+ /// operation to fail.\r
+ ///\r
+ SHELL_VOLUME_CORRUPTED = 10,\r
+\r
+ ///\r
+ /// There is no more space on the file system.\r
+ ///\r
+ SHELL_VOLUME_FULL = 11,\r
+\r
+ ///\r
+ /// The device does not contain any medium to perform the\r
+ /// operation.\r
+ ///\r
+ SHELL_NO_MEDIA = 12,\r
+\r
+ ///\r
+ /// The medium in the device has changed since the last\r
+ /// access.\r
+ ///\r
+ SHELL_MEDIA_CHANGED = 13,\r
+\r
+ ///\r
+ /// The item was not found.\r
+ ///\r
+ SHELL_NOT_FOUND = 14,\r
+\r
+ ///\r
+ /// Access was denied.\r
+ ///\r
+ SHELL_ACCESS_DENIED = 15,\r
+\r
+ // note the skipping of 16 and 17\r
+\r
+ ///\r
+ /// A timeout time expired.\r
+ ///\r
+ SHELL_TIMEOUT = 18,\r
+\r
+ ///\r
+ /// The protocol has not been started.\r
+ ///\r
+ SHELL_NOT_STARTED = 19,\r
+\r
+ ///\r
+ /// The protocol has already been started.\r
+ ///\r
+ SHELL_ALREADY_STARTED = 20,\r
+\r
+ ///\r
+ /// The operation was aborted.\r
+ ///\r
+ SHELL_ABORTED = 21,\r
+\r
+ // note the skipping of 22, 23, and 24\r
+\r
+ ///\r
+ /// A function encountered an internal version that was\r
+ /// incompatible with a version requested by the caller.\r
+ ///\r
+ SHELL_INCOMPATIBLE_VERSION = 25,\r
+\r
+ ///\r
+ /// The function was not performed due to a security violation.\r
+ ///\r
+ SHELL_SECURITY_VIOLATION = 26,\r
+\r
+ ///\r
+ /// The function was performed and resulted in an unequal\r
+ /// comparison..\r
+ ///\r
+ SHELL_NOT_EQUAL = 27\r
+} SHELL_STATUS;\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
+ SHELL_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 SHELL_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 The file path could not be opened.\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 SHELL_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 SHELL_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 deleted.\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 SHELL_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 SHELL_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
+ Note that the current directory string should exclude the tailing backslash character.\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
+(EFIAPI *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
+ 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 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 environment variable and Attributes, or list of environment variables. Can be \r
+ used instead of GetEnv().\r
+\r
+ This function returns the current value of the specified environment variable and\r
+ the Attributes. If no variable name was specified, then all of the known\r
+ variables will be returned.\r
+\r
+ @param[in] Name A pointer to the environment variable name. If Name is NULL,\r
+ then the function will return all of the defined shell \r
+ environment variables. In the case where multiple environment\r
+ variables are being returned, each variable will be terminated \r
+ by a NULL, and the list will be terminated by a double NULL.\r
+ @param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for\r
+ the environment variable. In the case where Name is NULL, and\r
+ multiple environment variables are being returned, Attributes\r
+ is undefined.\r
+\r
+ @retval NULL The environment variable doesn't exist. \r
+ @return The environment variable's value. The returned pointer does not \r
+ need to be freed by the caller. \r
+**/\r
+typedef\r
+CONST CHAR16 *\r
+(EFIAPI *EFI_SHELL_GET_ENV_EX) (\r
+ IN CONST CHAR16 *Name,\r
+ OUT UINT32 *Attributes 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
+ @retval NULL Cannot get the file info.\r
+ @return A pointer to a buffer with file information.\r
+**/\r
+typedef\r
+EFI_FILE_INFO *\r
+(EFIAPI *EFI_SHELL_GET_FILE_INFO)(\r
+ IN SHELL_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 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
+ @param[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 SHELL_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 SHELL_FILE_HANDLE FileHandle,\r
+ OUT UINT64 *Size\r
+ );\r
+\r
+/**\r
+ Get the GUID value from a human readable name.\r
+\r
+ If GuidName is a known GUID name, then update Guid to have the correct value for\r
+ that GUID.\r
+\r
+ This function is only available when the major and minor versions in the\r
+ EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+ @param[in] GuidName A pointer to the localized name for the GUID being queried.\r
+ @param[out] Guid A pointer to the GUID structure to be filled in.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_INVALID_PARAMETER Guid was NULL.\r
+ @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
+ @retval EFI_NOT_FOUND GuidName is not a known GUID Name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(\r
+ IN CONST CHAR16 *GuidName,\r
+ OUT EFI_GUID *Guid\r
+ );\r
+\r
+/**\r
+ Get the human readable name for a GUID from the value.\r
+\r
+ If Guid is assigned a name, then update *GuidName to point to the name. The callee\r
+ should not modify the value.\r
+\r
+ This function is only available when the major and minor versions in the\r
+ EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+ @param[in] Guid A pointer to the GUID being queried.\r
+ @param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_INVALID_PARAMETER Guid was NULL.\r
+ @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
+ @retval EFI_NOT_FOUND Guid is not assigned a name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_GET_GUID_NAME)(\r
+ IN CONST EFI_GUID *Guid,\r
+ OUT CONST CHAR16 **GuidName\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
+ 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 SHELL_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 SHELL_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 SHELL_FILE_HANDLE *FileHandle\r
+ );\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 SHELL_FILE_HANDLE FileHandle,\r
+ IN OUT UINTN *ReadSize,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Register a GUID and a localized human readable name for it.\r
+\r
+ If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID\r
+ names must be used whenever a shell command outputs GUID information.\r
+\r
+ This function is only available when the major and minor versions in the\r
+ EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+ @param[in] Guid A pointer to the GUID being registered.\r
+ @param[in] GuidName A pointer to the localized name for the GUID being registered.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_INVALID_PARAMETER Guid was NULL.\r
+ @retval EFI_INVALID_PARAMETER GuidName was NULL.\r
+ @retval EFI_ACCESS_DENIED Guid already is assigned a name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST CHAR16 *GuidName\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
+ 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 ';'\r
+ delimited list of alias (e.g.\r
+ ReturnedData = "dir;del;copy;mfp") 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
+ @retval NULL Current directory does not exist.\r
+ @return The current directory.\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. All file information in the EFI_FILE_INFO\r
+ struct will be updated to the passed in data.\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 SHELL_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 SHELL_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 SHELL_FILE_HANDLE FileHandle,\r
+ IN OUT UINTN *BufferSize,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+//\r
+// EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0\r
+// Usage of this protocol will require version checking before attempting\r
+// to use any new members. There is no need to check the version for\r
+// members that existed in UEFI Shell Spec 2.0.\r
+//\r
+// Update below for any future UEFI Shell spec changes to this protocol.\r
+//\r
+// Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:\r
+// if ((2 == gEfiShellProtocol->MajorVersion) &&\r
+// (0 == gEfiShellProtocol->MinorVersion)) {\r
+// //\r
+// // Cannot call:\r
+// // RegisterGuidName - UEFI Shell 2.1\r
+// // GetGuidName - UEFI Shell 2.1\r
+// // GetGuidFromName - UEFI Shell 2.1\r
+// // GetEnvEx - UEFI Shell 2.1\r
+// //\r
+// } else {\r
+// //\r
+// // Can use all members\r
+// //\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
+ // Added for Shell 2.1\r
+ EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName;\r
+ EFI_SHELL_GET_GUID_NAME GetGuidName;\r
+ EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName;\r
+ EFI_SHELL_GET_ENV_EX GetEnvEx;\r
+} EFI_SHELL_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiShellProtocolGuid;\r
+\r
+enum ShellVersion {\r
+ SHELL_MAJOR_VERSION = 2,\r
+ SHELL_MINOR_VERSION = 1\r
+};\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ EFI Shell Dynamic Command registration protocol\r
+\r
+ (C) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 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
+ 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
+\r
+#ifndef __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__\r
+#define __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__\r
+\r
+#include <Protocol/Shell.h>\r
+#include <Protocol/ShellParameters.h>\r
+\r
+// {3C7200E9-005F-4EA4-87DE-A3DFAC8A27C3}\r
+#define EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID \\r
+ { \\r
+ 0x3c7200e9, 0x005f, 0x4ea4, { 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 } \\r
+ }\r
+\r
+\r
+//\r
+// Define for forward reference.\r
+//\r
+typedef struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL;\r
+\r
+\r
+/**\r
+ This is the shell command handler function pointer callback type. This\r
+ function handles the command when it is invoked in the shell.\r
+\r
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+ @param[in] SystemTable The pointer to the system table.\r
+ @param[in] ShellParameters The parameters associated with the command.\r
+ @param[in] Shell The instance of the shell protocol used in the context\r
+ of processing this command.\r
+\r
+ @return EFI_SUCCESS the operation was sucessful\r
+ @return other the operation failed.\r
+**/\r
+typedef\r
+SHELL_STATUS\r
+(EFIAPI * SHELL_COMMAND_HANDLER)(\r
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
+ IN EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,\r
+ IN EFI_SHELL_PROTOCOL *Shell\r
+ );\r
+\r
+/**\r
+ This is the command help handler function pointer callback type. This\r
+ function is responsible for displaying help information for the associated\r
+ command.\r
+\r
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+ @param[in] Language The pointer to the language string to use.\r
+\r
+ @return string Pool allocated help string, must be freed by caller\r
+**/\r
+typedef\r
+CHAR16*\r
+(EFIAPI * SHELL_COMMAND_GETHELP)(\r
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
+ IN CONST CHAR8 *Language\r
+ );\r
+\r
+/// EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL protocol structure.\r
+struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL {\r
+ \r
+ CONST CHAR16 *CommandName;\r
+ SHELL_COMMAND_HANDLER Handler;\r
+ SHELL_COMMAND_GETHELP GetHelp;\r
+\r
+};\r
+\r
+extern EFI_GUID gEfiShellDynamicCommandProtocolGuid;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ EFI Shell protocol as defined in the UEFI Shell 2.0 specification.\r
+\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
+ 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
+\r
+#ifndef __EFI_SHELL_PARAMETERS_PROTOCOL_H__\r
+#define __EFI_SHELL_PARAMETERS_PROTOCOL_H__\r
+\r
+#include <Protocol/Shell.h>\r
+\r
+#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \\r
+ { \\r
+ 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } \\r
+ }\r
+\r
+typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {\r
+ ///\r
+ /// Points to an Argc-element array of points to NULL-terminated strings containing\r
+ /// the command-line parameters. The first entry in the array is always the full file\r
+ /// path of the executable. Any quotation marks that were used to preserve\r
+ /// whitespace have been removed.\r
+ ///\r
+ CHAR16 **Argv;\r
+\r
+ ///\r
+ /// The number of elements in the Argv array.\r
+ ///\r
+ UINTN Argc;\r
+\r
+ ///\r
+ /// The file handle for the standard input for this executable. This may be different\r
+ /// from the ConInHandle in EFI_SYSTEM_TABLE.\r
+ ///\r
+ SHELL_FILE_HANDLE StdIn;\r
+\r
+ ///\r
+ /// The file handle for the standard output for this executable. This may be different\r
+ /// from the ConOutHandle in EFI_SYSTEM_TABLE.\r
+ ///\r
+ SHELL_FILE_HANDLE StdOut;\r
+\r
+ ///\r
+ /// The file handle for the standard error output for this executable. This may be\r
+ /// different from the StdErrHandle in EFI_SYSTEM_TABLE.\r
+ ///\r
+ SHELL_FILE_HANDLE StdErr;\r
+} EFI_SHELL_PARAMETERS_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiShellParametersProtocolGuid;\r
+\r
+#endif\r
+++ /dev/null
-/** @file\r
- Root include file for Shell Package modules that utilize the SHELL_RETURN type\r
-\r
- Copyright (c) 2009 - 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
- 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
-\r
-#ifndef _SHELL_BASE_\r
-#define _SHELL_BASE_\r
-\r
-typedef VOID *SHELL_FILE_HANDLE;\r
-\r
-typedef enum {\r
-///\r
-/// The operation completed successfully.\r
-///\r
-SHELL_SUCCESS = 0,\r
-\r
-///\r
-/// The image failed to load.\r
-///\r
-SHELL_LOAD_ERROR = 1,\r
-\r
-///\r
-/// The parameter was incorrect.\r
-///\r
-SHELL_INVALID_PARAMETER = 2,\r
-\r
-///\r
-/// The operation is not supported.\r
-///\r
-SHELL_UNSUPPORTED = 3,\r
-\r
-///\r
-/// The buffer was not the proper size for the request.\r
-///\r
-SHELL_BAD_BUFFER_SIZE = 4,\r
-\r
-///\r
-/// The buffer was not large enough to hold the requested data.\r
-/// The required buffer size is returned in the appropriate\r
-/// parameter when this error occurs.\r
-///\r
-SHELL_BUFFER_TOO_SMALL = 5,\r
-\r
-///\r
-/// There is no data pending upon return.\r
-///\r
-SHELL_NOT_READY = 6,\r
-\r
-///\r
-/// The physical device reported an error while attempting the\r
-/// operation.\r
-///\r
-SHELL_DEVICE_ERROR = 7,\r
-\r
-///\r
-/// The device cannot be written to.\r
-///\r
-SHELL_WRITE_PROTECTED = 8,\r
-\r
-///\r
-/// The resource has run out.\r
-///\r
-SHELL_OUT_OF_RESOURCES = 9,\r
-\r
-///\r
-/// An inconsistency was detected on the file system causing the\r
-/// operation to fail.\r
-///\r
-SHELL_VOLUME_CORRUPTED = 10,\r
-\r
-///\r
-/// There is no more space on the file system.\r
-///\r
-SHELL_VOLUME_FULL = 11,\r
-\r
-///\r
-/// The device does not contain any medium to perform the\r
-/// operation.\r
-///\r
-SHELL_NO_MEDIA = 12,\r
-\r
-///\r
-/// The medium in the device has changed since the last\r
-/// access.\r
-///\r
-SHELL_MEDIA_CHANGED = 13,\r
-\r
-///\r
-/// The item was not found.\r
-///\r
-SHELL_NOT_FOUND = 14,\r
-\r
-///\r
-/// Access was denied.\r
-///\r
-SHELL_ACCESS_DENIED = 15,\r
-\r
-// note the skipping of 16 and 17\r
-\r
-///\r
-/// A timeout time expired.\r
-///\r
-SHELL_TIMEOUT = 18,\r
-\r
-///\r
-/// The protocol has not been started.\r
-///\r
-SHELL_NOT_STARTED = 19,\r
-\r
-///\r
-/// The protocol has already been started.\r
-///\r
-SHELL_ALREADY_STARTED = 20,\r
-\r
-///\r
-/// The operation was aborted.\r
-///\r
-SHELL_ABORTED = 21,\r
-\r
-// note the skipping of 22, 23, and 24\r
-\r
-///\r
-/// A function encountered an internal version that was\r
-/// incompatible with a version requested by the caller.\r
-///\r
-SHELL_INCOMPATIBLE_VERSION = 25,\r
-\r
-///\r
-/// The function was not performed due to a security violation.\r
-///\r
-SHELL_SECURITY_VIOLATION = 26,\r
-\r
-///\r
-/// The function was performed and resulted in an unequal\r
-/// comparison..\r
-///\r
-SHELL_NOT_EQUAL = 27\r
-}SHELL_STATUS;\r
-\r
-#endif //__SHELL_BASE_\r