]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/Shell.h
ShellPkg: Fix the bug that handling Ctrl-C improperly
[mirror_edk2.git] / ShellPkg / Application / Shell / Shell.h
index 7c876510dd29f5d80ee08c9b3b361597414a251f..ff0849446817a5ccb681fc48044e205d22c7a38f 100644 (file)
@@ -2,7 +2,7 @@
   function definitions for internal to shell functions.\r
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\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
 #define _SHELL_INTERNAL_HEADER_\r
 \r
 #include <Uefi.h>\r
-#include <ShellBase.h>\r
 \r
 #include <Guid/ShellVariableGuid.h>\r
 #include <Guid/ShellAliasGuid.h>\r
 \r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/SimpleTextOut.h>\r
-#include <Protocol/EfiShell.h>\r
+#include <Protocol/Shell.h>\r
 #include <Protocol/EfiShellInterface.h>\r
 #include <Protocol/EfiShellEnvironment2.h>\r
-#include <Protocol/EfiShellParameters.h>\r
+#include <Protocol/ShellParameters.h>\r
 #include <Protocol/BlockIo.h>\r
+#include <Protocol/HiiPackageList.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/UefiApplicationEntryPoint.h>\r
@@ -47,6 +47,7 @@
 #include <Library/PrintLib.h>\r
 #include <Library/HandleParsingLib.h>\r
 #include <Library/FileHandleLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 \r
 #include "ShellParametersProtocol.h"\r
 #include "ShellProtocol.h"\r
 #include "ConsoleWrappers.h"\r
 #include "FileHandleWrappers.h"\r
 \r
+extern CONST CHAR16 mNoNestingEnvVarName[];\r
+extern CONST CHAR16 mNoNestingTrue[];\r
+extern CONST CHAR16 mNoNestingFalse[];\r
+\r
 typedef struct {\r
   LIST_ENTRY        Link;           ///< Standard linked list handler.\r
-  SHELL_FILE_HANDLE *SplitStdOut;   ///< ConsoleOut for use in the split.\r
-  SHELL_FILE_HANDLE *SplitStdIn;    ///< ConsoleIn for use in the split.\r
+  SHELL_FILE_HANDLE SplitStdOut;    ///< ConsoleOut for use in the split.\r
+  SHELL_FILE_HANDLE SplitStdIn;     ///< ConsoleIn for use in the split.\r
 } SPLIT_LIST;\r
 \r
 typedef struct {\r
@@ -71,7 +76,8 @@ typedef struct {
   UINT32  NoMap:1;        ///< Was "-nomap"         found on command line.\r
   UINT32  NoVersion:1;    ///< Was "-noversion"     found on command line.\r
   UINT32  Delay:1;        ///< Was "-delay[:n]      found on command line\r
-  UINT32  Exit:1;         ///< Was "-_exit"          found on command line\r
+  UINT32  Exit:1;         ///< Was "-_exit"         found on command line\r
+  UINT32  NoNest:1;       ///< Was "-nonest"        found on command line\r
   UINT32  Reserved:7;     ///< Extra bits\r
 } SHELL_BITS;\r
 \r
@@ -122,15 +128,17 @@ typedef struct {
   BOOLEAN                       HaltOutput;           ///< TRUE to start a CTRL-S halt.\r
 } SHELL_INFO;\r
 \r
-extern SHELL_INFO ShellInfoObject;\r
+#pragma pack(1)\r
+///\r
+/// HII specific Vendor Device Path definition.\r
+///\r
+typedef struct {\r
+  VENDOR_DEVICE_PATH             VendorDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL       End;\r
+} SHELL_MAN_HII_VENDOR_DEVICE_PATH;\r
+#pragma pack()\r
 \r
-typedef enum {\r
-  Internal_Command,\r
-  Script_File_Name,\r
-  Efi_Application,\r
-  File_Sys_Change,\r
-  Unknown_Invalid\r
-} SHELL_OPERATION_TYPES;\r
+extern SHELL_INFO ShellInfoObject;\r
 \r
 /**\r
   Converts the command line to it's post-processed form.  this replaces variables and alias' per UEFI Shell spec.\r
@@ -142,7 +150,6 @@ typedef enum {
   @return                       some other error occurred\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 ProcessCommandLineToFinal(\r
   IN OUT CHAR16 **CmdLine\r
   );\r
@@ -153,7 +160,6 @@ ProcessCommandLineToFinal(
   @param[in] ErrorCode      the error code to put into lasterror\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SetLastError(\r
   IN CONST SHELL_STATUS   ErrorCode\r
   );\r
@@ -164,7 +170,6 @@ SetLastError(
   @retval EFI_SUCCESS           all init commands were run successfully.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SetBuiltInAlias(\r
   VOID\r
   );\r
@@ -184,7 +189,6 @@ SetBuiltInAlias(
   @sa HandleProtocol\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 GetDevicePathsForImageAndFile (\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath\r
@@ -218,7 +222,6 @@ GetDevicePathsForImageAndFile (
   @retval EFI_SUCCESS           the variable is initialized.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 ProcessCommandLine(\r
   VOID\r
   );\r
@@ -234,7 +237,6 @@ ProcessCommandLine(
   @retval EFI_SUCCESS           The variable is initialized.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 DoStartupScript(\r
   IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,\r
   IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
@@ -249,7 +251,6 @@ DoStartupScript(
   @retval RETURN_ABORTED\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 DoShellPrompt (\r
   VOID\r
   );\r
@@ -261,7 +262,6 @@ DoShellPrompt (
   @param Buffer   Something to pass to FreePool when the shell is exiting.\r
 **/\r
 VOID*\r
-EFIAPI\r
 AddBufferToFreeList(\r
   VOID *Buffer\r
   );\r
@@ -272,7 +272,6 @@ AddBufferToFreeList(
   @param Buffer[in]     The line buffer to add.\r
 **/\r
 VOID\r
-EFIAPI\r
 AddLineToCommandHistory(\r
   IN CONST CHAR16 *Buffer\r
   );\r
@@ -288,7 +287,6 @@ AddLineToCommandHistory(
   @retval EFI_ABORTED     the command's operation was aborted\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 RunCommand(\r
   IN CONST CHAR16   *CmdLine\r
   );\r
@@ -306,7 +304,6 @@ RunCommand(
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 RunShellCommand(\r
   IN CONST CHAR16   *CmdLine,\r
   OUT EFI_STATUS    *CommandStatus\r
@@ -322,7 +319,6 @@ RunShellCommand(
   @retval FALSE             CommandName could not be a valid command name\r
 **/\r
 BOOLEAN\r
-EFIAPI\r
 IsValidCommandName(\r
   IN CONST CHAR16     *CommandName\r
   );\r
@@ -336,7 +332,6 @@ IsValidCommandName(
   @retval EFI_SUCCESS           the script completed successfully\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 RunScriptFileHandle (\r
   IN SHELL_FILE_HANDLE  Handle,\r
   IN CONST CHAR16       *Name\r
@@ -353,7 +348,6 @@ RunScriptFileHandle (
   @retval EFI_SUCCESS           the script completed successfully\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 RunScriptFile (\r
   IN CONST CHAR16                   *ScriptPath,\r
   IN SHELL_FILE_HANDLE              Handle OPTIONAL,\r
@@ -372,7 +366,6 @@ RunScriptFile (
   @retval CHAR_NULL no instance of any character in CharacterList was found in String\r
 **/\r
 CONST CHAR16*\r
-EFIAPI\r
 FindFirstCharacter(\r
   IN CONST CHAR16 *String,\r
   IN CONST CHAR16 *CharacterList,\r
@@ -385,10 +378,32 @@ FindFirstCharacter(
   @param[in] String pointer to the string to trim them off.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 TrimSpaces(\r
   IN CHAR16 **String\r
   );\r
 \r
+/**\r
+  \r
+  Create a new buffer list and stores the old one to OldBufferList  \r
+\r
+  @param OldBufferList   The temporary list head used to store the nodes in BufferToFreeList.\r
+**/\r
+VOID\r
+SaveBufferList (\r
+  OUT LIST_ENTRY     *OldBufferList\r
+  );\r
+\r
+/**\r
+  Restore previous nodes into BufferToFreeList .\r
+\r
+  @param OldBufferList   The temporary list head used to store the nodes in BufferToFreeList.\r
+**/\r
+VOID\r
+RestoreBufferList (\r
+  IN OUT LIST_ENTRY     *OldBufferList\r
+  );\r
+\r
+\r
+\r
 #endif //_SHELL_INTERNAL_HEADER_\r
 \r