]>
Commit | Line | Data |
---|---|---|
d41bc92c | 1 | /** @file\r |
2 | Main file for NULL named library for install1 shell command functions.\r | |
3 | \r | |
4 | Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.\r | |
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 | |
15 | #include "UefiDpLib.h"\r | |
16 | \r | |
17 | STATIC CONST CHAR16 mFileName[] = L"ShellCommands";\r | |
18 | EFI_HANDLE gDpHiiHandle = NULL;\r | |
19 | \r | |
20 | #define DP_HII_GUID \\r | |
21 | { \\r | |
22 | 0xeb832fd9, 0x9089, 0x4898, { 0x83, 0xc9, 0x41, 0x61, 0x8f, 0x5c, 0x48, 0xb9 } \\r | |
23 | }\r | |
24 | \r | |
25 | EFI_GUID gDpHiiGuid = DP_HII_GUID;\r | |
26 | \r | |
27 | /**\r | |
28 | Function to get the filename with help context if HII will not be used.\r | |
29 | \r | |
30 | @return The filename with help text in it.\r | |
31 | **/\r | |
32 | CONST CHAR16*\r | |
33 | EFIAPI\r | |
34 | UefiDpLibGetManFileName (\r | |
35 | VOID\r | |
36 | )\r | |
37 | {\r | |
38 | return (mFileName);\r | |
39 | }\r | |
40 | \r | |
41 | /**\r | |
42 | Constructor for the Shell Level 1 Commands library.\r | |
43 | \r | |
44 | Install the handlers for level 1 UEFI Shell 2.0 commands.\r | |
45 | \r | |
46 | @param ImageHandle the image handle of the process\r | |
47 | @param SystemTable the EFI System Table pointer\r | |
48 | \r | |
49 | @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r | |
50 | @retval EFI_UNSUPPORTED the shell level required was not found.\r | |
51 | **/\r | |
52 | EFI_STATUS\r | |
53 | EFIAPI\r | |
54 | UefiDpLibConstructor (\r | |
55 | IN EFI_HANDLE ImageHandle,\r | |
56 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
57 | )\r | |
58 | {\r | |
59 | //\r | |
60 | // check our bit of the profiles mask\r | |
61 | //\r | |
62 | if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r | |
63 | return (EFI_SUCCESS);\r | |
64 | }\r | |
65 | \r | |
66 | //\r | |
67 | // 3rd parameter 'HII strings array' must be name of .uni strings file followed by 'Strings', e.g. mycommands.uni must be\r | |
68 | // specified as 'mycommandsStrings' because the build Autogen process defines this as a string array for the strings in your\r | |
69 | // .uni file. Examine your Build folder under your package's DEBUG folder and you will find it defined in a xxxStrDefs.h file.\r | |
70 | //\r | |
71 | gDpHiiHandle = HiiAddPackages (&gDpHiiGuid, gImageHandle, UefiDpLibStrings, NULL);\r | |
72 | if (gDpHiiHandle == NULL) {\r | |
73 | return (EFI_DEVICE_ERROR);\r | |
74 | }\r | |
75 | \r | |
76 | //\r | |
77 | // install our shell command handlers that are always installed\r | |
78 | //\r | |
79 | ShellCommandRegisterCommandName(L"dp", ShellCommandRunDp , UefiDpLibGetManFileName, 0, L"", FALSE, gDpHiiHandle, STRING_TOKEN(STR_GET_HELP_DP));\r | |
80 | \r | |
81 | return (EFI_SUCCESS);\r | |
82 | }\r | |
83 | \r | |
84 | /**\r | |
85 | Destructor for the library. free any resources.\r | |
86 | \r | |
87 | @param ImageHandle The image handle of the process.\r | |
88 | @param SystemTable The EFI System Table pointer.\r | |
89 | **/\r | |
90 | EFI_STATUS\r | |
91 | EFIAPI\r | |
92 | UefiDpLibDestructor (\r | |
93 | IN EFI_HANDLE ImageHandle,\r | |
94 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
95 | )\r | |
96 | {\r | |
97 | if (gDpHiiHandle != NULL) {\r | |
98 | HiiRemovePackages(gDpHiiHandle);\r | |
99 | }\r | |
100 | return (EFI_SUCCESS);\r | |
101 | }\r |