]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c
ShellPkg/Dp: Add null pointer check
[mirror_edk2.git] / ShellPkg / Library / UefiShellInstall1CommandsLib / UefiShellInstall1CommandsLib.c
CommitLineData
75aadf59 1/** @file\r
2 Main file for NULL named library for install1 shell command functions.\r
3\r
2398d9b1 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
75aadf59 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
fba9b6ba 15#include <Library/BcfgCommandLib.h>\r
75aadf59 16\r
17/**\r
18 Constructor for the Shell Level 1 Commands library.\r
19\r
20 Install the handlers for level 1 UEFI Shell 2.0 commands.\r
21\r
22 @param ImageHandle the image handle of the process\r
23 @param SystemTable the EFI System Table pointer\r
24\r
25 @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r
26 @retval EFI_UNSUPPORTED the shell level required was not found.\r
27**/\r
28EFI_STATUS\r
29EFIAPI\r
30ShellInstall1CommandsLibConstructor (\r
31 IN EFI_HANDLE ImageHandle,\r
32 IN EFI_SYSTEM_TABLE *SystemTable\r
33 )\r
34{\r
35 //\r
36 // check our bit of the profiles mask\r
37 //\r
38 if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r
82571fb5 39 return (EFI_SUCCESS);\r
75aadf59 40 }\r
41\r
fba9b6ba 42 return (BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Install1"));\r
75aadf59 43}\r
44\r
45/**\r
46 Destructor for the library. free any resources.\r
2398d9b1 47\r
48 @param ImageHandle The image handle of the process.\r
49 @param SystemTable The EFI System Table pointer.\r
75aadf59 50**/\r
51EFI_STATUS\r
52EFIAPI\r
53ShellInstall1CommandsLibDestructor (\r
54 IN EFI_HANDLE ImageHandle,\r
55 IN EFI_SYSTEM_TABLE *SystemTable\r
56 )\r
57{\r
fba9b6ba 58 return (BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable));\r
75aadf59 59}\r