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