]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c
adding "Install1" profile.
[mirror_edk2.git] / ShellPkg / Library / UefiShellInstall1CommandsLib / UefiShellInstall1CommandsLib.c
diff --git a/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c b/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c
new file mode 100644 (file)
index 0000000..e524e7f
--- /dev/null
@@ -0,0 +1,85 @@
+/** @file\r
+  Main file for NULL named library for install1 shell command functions.\r
+\r
+  Copyright (c) 2010, 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
+#include "UefiShellInstall1CommandsLib.h"\r
+\r
+STATIC CONST CHAR16 mFileName[] = L"ShellCommands";\r
+EFI_HANDLE gShellInstall1HiiHandle = NULL;\r
+CONST EFI_GUID gShellInstall1HiiGuid = \\r
+  { \\r
+    0x7d574d54, 0xd364, 0x4d4a, { 0x95, 0xe3, 0x49, 0x45, 0xdb, 0x7a, 0xd3, 0xee } \\r
+  };\r
+\r
+CONST CHAR16*\r
+EFIAPI\r
+ShellCommandGetManFileNameInstall1 (\r
+  VOID\r
+  )\r
+{\r
+  return (mFileName);\r
+}\r
+\r
+/**\r
+  Constructor for the Shell Level 1 Commands library.\r
+\r
+  Install the handlers for level 1 UEFI Shell 2.0 commands.\r
+\r
+  @param ImageHandle    the image handle of the process\r
+  @param SystemTable    the EFI System Table pointer\r
+\r
+  @retval EFI_SUCCESS        the shell command handlers were installed sucessfully\r
+  @retval EFI_UNSUPPORTED    the shell level required was not found.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellInstall1CommandsLibConstructor (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  //\r
+  // check our bit of the profiles mask\r
+  //\r
+  if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r
+    return (EFI_UNSUPPORTED);\r
+  }\r
+\r
+  gShellInstall1HiiHandle = HiiAddPackages (&gShellInstall1HiiGuid, gImageHandle, UefiShellInstall1CommandsLibStrings, NULL);\r
+  if (gShellInstall1HiiHandle == NULL) {\r
+    return (EFI_DEVICE_ERROR);\r
+  }\r
+\r
+  //\r
+  // install our shell command handlers that are always installed\r
+  //\r
+  ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfgInstall , ShellCommandGetManFileNameInstall1, 0, L"Install", FALSE, gShellInstall1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG));\r
+\r
+  return (EFI_SUCCESS);\r
+}\r
+\r
+/**\r
+  Destructor for the library.  free any resources.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellInstall1CommandsLibDestructor (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  if (gShellInstall1HiiHandle != NULL) {\r
+    HiiRemovePackages(gShellInstall1HiiHandle);\r
+  }\r
+  return (EFI_SUCCESS);\r
+}\r