Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1998 Intel Corporation
  3. Module Name:
  4. shell.h
  5. Abstract:
  6. Defines for shell applications
  7. Revision History
  8. --*/
  9. /*
  10. * This module is included by shell applications
  11. */
  12. #include "efi.h"
  13. #include "efilib.h"
  14. /*
  15. *
  16. */
  17. #define SHELL_FILE_ARG_SIGNATURE EFI_SIGNATURE_32('g','r','a','f')
  18. typedef struct {
  19. UINT32 Signature;
  20. LIST_ENTRY Link;
  21. EFI_STATUS Status;
  22. EFI_FILE_HANDLE Parent;
  23. UINT64 OpenMode;
  24. CHAR16 *ParentName;
  25. EFI_DEVICE_PATH *ParentDevicePath;
  26. CHAR16 *FullName;
  27. CHAR16 *FileName;
  28. EFI_FILE_HANDLE Handle;
  29. EFI_FILE_INFO *Info;
  30. } SHELL_FILE_ARG;
  31. EFI_STATUS
  32. ShellFileMetaArg (
  33. IN CHAR16 *Arg,
  34. IN OUT LIST_ENTRY *ListHead
  35. );
  36. EFI_STATUS
  37. ShellFreeFileList (
  38. IN OUT LIST_ENTRY *ListHead
  39. );
  40. /*
  41. * Shell application library functions
  42. */
  43. EFI_STATUS
  44. InitializeShellApplication (
  45. IN EFI_HANDLE ImageHandle,
  46. IN EFI_SYSTEM_TABLE *SystemTable
  47. );
  48. typedef
  49. EFI_STATUS
  50. (EFIAPI *SHELLENV_INTERNAL_COMMAND) (
  51. IN EFI_HANDLE ImageHandle,
  52. IN EFI_SYSTEM_TABLE *SystemTable
  53. );
  54. VOID
  55. InstallInternalShellCommand (
  56. IN EFI_HANDLE ImageHandle,
  57. IN EFI_SYSTEM_TABLE *SystemTable,
  58. IN SHELLENV_INTERNAL_COMMAND Dispatch,
  59. IN CHAR16 *Cmd,
  60. IN CHAR16 *CmdFormat,
  61. IN CHAR16 *CmdHelpLine,
  62. IN VOID *CmdVerboseHelp
  63. );
  64. /*
  65. * Publics in shell.lib
  66. */
  67. extern EFI_GUID ShellInterfaceProtocol;
  68. extern EFI_GUID ShellEnvProtocol;
  69. /*
  70. * GetEnvironmentVariable - returns a shell environment variable
  71. */
  72. CHAR16 *
  73. GetEnvironmentVariable (
  74. IN CHAR16 *Name
  75. );
  76. /*
  77. * GetProtocolId - returns the short ID strings for a protocol guid
  78. */
  79. CHAR16 *
  80. GetProtocolId (
  81. IN EFI_GUID *Protocol
  82. );
  83. /*
  84. * AddProtoclId - records a new ID for a protocol guid such that anyone
  85. * performing a GetProtocolId can find our id
  86. */
  87. VOID
  88. AddProtocolId (
  89. IN EFI_GUID *Protocol,
  90. IN CHAR16 *ProtocolId
  91. );
  92. /*
  93. * ShellExecute - causes the shell to parse & execute the command line
  94. */
  95. EFI_STATUS
  96. ShellExecute (
  97. IN EFI_HANDLE ParentImageHandle,
  98. IN CHAR16 *CommandLine,
  99. IN BOOLEAN Output
  100. );
  101. /*
  102. * Misc
  103. */
  104. CHAR16 *
  105. MemoryTypeStr (
  106. IN EFI_MEMORY_TYPE Type
  107. );
  108. /*
  109. * IO
  110. */
  111. EFI_FILE_HANDLE
  112. ShellOpenFilePath (
  113. IN EFI_DEVICE_PATH *FilePath,
  114. IN UINT64 FileMode
  115. );
  116. /*
  117. * ShellCurDir - returns the current directory on the current mapped device
  118. * (note the result is allocated from pool and the caller must
  119. * free it)
  120. */
  121. CHAR16 *
  122. ShellCurDir (
  123. IN CHAR16 *DeviceName OPTIONAL
  124. );
  125. /*
  126. * ShellGetEnv - returns the current mapping for the Env Name
  127. */
  128. CHAR16 *
  129. ShellGetEnv (
  130. IN CHAR16 *Name
  131. );
  132. CHAR16 *
  133. ShellGetMap (
  134. IN CHAR16 *Name
  135. );
  136. /*
  137. * **************************************
  138. * Shell Interface prototypes
  139. */
  140. /*
  141. * Shell Interface - additional information (over image_info) provided
  142. * to an application started by the shell.
  143. *
  144. * ConIo - provides a file sytle interface to the console. Note that the
  145. * ConOut & ConIn interfaces in the system table will work as well, and both
  146. * all will be redirected to a file if needed on a command line
  147. *
  148. * The shell interface's and data (including ConIo) are only valid during
  149. * the applications Entry Point. Once the application returns from it's
  150. * entry point the data is freed by the invoking shell.
  151. */
  152. #define SHELL_INTERFACE_PROTOCOL \
  153. { 0x47c7b223, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  154. typedef struct _EFI_SHELL_INTERFACE {
  155. /* Handle back to original image handle & image info */
  156. EFI_HANDLE ImageHandle;
  157. EFI_LOADED_IMAGE *Info;
  158. /* Parsed arg list */
  159. CHAR16 **Argv;
  160. UINT32 Argc;
  161. /* Storage for file redirection args after parsing */
  162. CHAR16 **RedirArgv;
  163. UINT32 RedirArgc;
  164. /* A file style handle for console io */
  165. EFI_FILE_HANDLE StdIn;
  166. EFI_FILE_HANDLE StdOut;
  167. EFI_FILE_HANDLE StdErr;
  168. } EFI_SHELL_INTERFACE;
  169. /*
  170. * Shell library globals
  171. */
  172. extern EFI_SHELL_INTERFACE *SI;
  173. extern EFI_GUID ShellInterfaceProtocol;
  174. extern EFI_GUID ShellEnvProtocol;