]>
Commit | Line | Data |
---|---|---|
a405b86d | 1 | /** @file\r |
2 | Main file for NULL named library for level 3 shell command functions.\r | |
3 | \r | |
345cd235 | 4 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>\r |
a405b86d | 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 | #include "UefiShellLevel3CommandsLib.h"\r | |
15 | \r | |
16 | CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";\r | |
17 | EFI_HANDLE gShellLevel3HiiHandle = NULL;\r | |
18 | STATIC CONST EFI_GUID gShellLevel3HiiGuid = \\r | |
19 | { \\r | |
20 | 0x4344558d, 0x4ef9, 0x4725, { 0xb1, 0xe4, 0x33, 0x76, 0xe8, 0xd6, 0x97, 0x4f } \\r | |
21 | };\r | |
22 | \r | |
345cd235 | 23 | /**\r |
24 | return the filename to get help from is not using HII.\r | |
25 | \r | |
26 | @retval The filename.\r | |
27 | **/\r | |
a405b86d | 28 | CONST CHAR16*\r |
29 | EFIAPI\r | |
30 | ShellCommandGetManFileNameLevel3 (\r | |
31 | VOID\r | |
32 | )\r | |
33 | {\r | |
34 | return (gShellLevel3FileName);\r | |
35 | }\r | |
36 | \r | |
37 | /**\r | |
38 | Constructor for the Shell Level 3 Commands library.\r | |
39 | \r | |
40 | Install the handlers for level 3 UEFI Shell 2.0 commands.\r | |
41 | \r | |
42 | @param ImageHandle the image handle of the process\r | |
43 | @param SystemTable the EFI System Table pointer\r | |
44 | \r | |
45 | @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r | |
46 | @retval EFI_UNSUPPORTED the shell level required was not found.\r | |
47 | **/\r | |
48 | EFI_STATUS\r | |
49 | EFIAPI\r | |
50 | ShellLevel3CommandsLibConstructor (\r | |
51 | IN EFI_HANDLE ImageHandle,\r | |
52 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
53 | )\r | |
54 | {\r | |
55 | gShellLevel3HiiHandle = NULL;\r | |
56 | //\r | |
57 | // if shell level is less than 3 do nothing\r | |
58 | //\r | |
59 | if (PcdGet8(PcdShellSupportLevel) < 3) {\r | |
82571fb5 | 60 | return (EFI_SUCCESS);\r |
a405b86d | 61 | }\r |
62 | \r | |
63 | gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL);\r | |
64 | if (gShellLevel3HiiHandle == NULL) {\r | |
65 | return (EFI_DEVICE_ERROR);\r | |
66 | }\r | |
67 | //\r | |
68 | // install our shell command handlers that are always installed\r | |
69 | //\r | |
70 | // Note: that Time, Timezone, and Date are part of level 2 library\r | |
71 | //\r | |
72 | ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE));\r | |
73 | ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH));\r | |
74 | ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER));\r | |
75 | ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS));\r | |
76 | ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS));\r | |
77 | ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO));\r | |
78 | ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE));\r | |
79 | ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC));\r | |
80 | ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP));\r | |
81 | \r | |
82 | return (EFI_SUCCESS);\r | |
83 | }\r | |
84 | \r | |
85 | /**\r | |
86 | Destructor for the library. free any resources.\r | |
345cd235 | 87 | \r |
88 | @param ImageHandle The image handle of the process.\r | |
89 | @param SystemTable The EFI System Table pointer.\r | |
a405b86d | 90 | **/\r |
91 | EFI_STATUS\r | |
92 | EFIAPI\r | |
93 | ShellLevel3CommandsLibDestructor (\r | |
94 | IN EFI_HANDLE ImageHandle,\r | |
95 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
96 | )\r | |
97 | {\r | |
98 | if (gShellLevel3HiiHandle != NULL) {\r | |
99 | HiiRemovePackages(gShellLevel3HiiHandle);\r | |
100 | }\r | |
101 | return (EFI_SUCCESS);\r | |
102 | }\r |