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