]>
Commit | Line | Data |
---|---|---|
a405b86d | 1 | /** @file\r |
2 | Main file for NULL named library for level 2 shell command functions.\r | |
3 | \r | |
4 | these functions are:\r | |
5 | attrib, cd, cp, date*, time*, rm, reset,\r | |
6 | load, ls, map, mkdir, mv, parse, set, timezone*\r | |
7 | \r | |
8 | \r | |
9 | * functions are non-interactive only\r | |
10 | \r | |
11 | \r | |
12 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
13 | This program and the accompanying materials\r | |
14 | are licensed and made available under the terms and conditions of the BSD License\r | |
15 | which accompanies this distribution. The full text of the license may be found at\r | |
16 | http://opensource.org/licenses/bsd-license.php\r | |
17 | \r | |
18 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
19 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
20 | \r | |
21 | **/\r | |
22 | \r | |
23 | #include <Uefi.h>\r | |
24 | #include <ShellBase.h>\r | |
25 | \r | |
26 | #include <Protocol/EfiShell.h>\r | |
27 | #include <Protocol/EfiShellParameters.h>\r | |
28 | #include <Protocol/DevicePath.h>\r | |
29 | #include <Protocol/LoadedImage.h>\r | |
30 | #include <Protocol/UnicodeCollation.h>\r | |
31 | #include <Protocol/DevicePathToText.h>\r | |
32 | \r | |
33 | #include <Library/BaseLib.h>\r | |
34 | #include <Library/BaseMemoryLib.h>\r | |
35 | #include <Library/DebugLib.h>\r | |
36 | #include <Library/MemoryAllocationLib.h>\r | |
37 | #include <Library/PcdLib.h>\r | |
38 | #include <Library/ShellCommandLib.h>\r | |
39 | #include <Library/ShellLib.h>\r | |
40 | #include <Library/UefiLib.h>\r | |
41 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
42 | #include <Library/UefiBootServicesTableLib.h>\r | |
43 | #include <Library/HiiLib.h>\r | |
44 | #include <Library/SortLib.h>\r | |
45 | #include <Library/FileHandleLib.h>\r | |
46 | \r | |
47 | extern CONST CHAR16 mFileName[];\r | |
48 | extern EFI_HANDLE gShellLevel2HiiHandle;\r | |
49 | extern CONST EFI_GUID gShellLevel2HiiGuid;\r | |
50 | \r | |
51 | /**\r | |
52 | Function for 'attrib' command.\r | |
53 | \r | |
54 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
55 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
56 | **/\r | |
57 | SHELL_STATUS\r | |
58 | EFIAPI\r | |
59 | ShellCommandRunAttrib (\r | |
60 | IN EFI_HANDLE ImageHandle,\r | |
61 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
62 | );\r | |
63 | \r | |
64 | /**\r | |
65 | Function for 'date' command.\r | |
66 | \r | |
67 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
68 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
69 | **/\r | |
70 | SHELL_STATUS\r | |
71 | EFIAPI\r | |
72 | ShellCommandRunDate (\r | |
73 | IN EFI_HANDLE ImageHandle,\r | |
74 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
75 | );\r | |
76 | \r | |
77 | /**\r | |
78 | Function for 'time' command.\r | |
79 | \r | |
80 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
81 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
82 | **/\r | |
83 | SHELL_STATUS\r | |
84 | EFIAPI\r | |
85 | ShellCommandRunTime (\r | |
86 | IN EFI_HANDLE ImageHandle,\r | |
87 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
88 | );\r | |
89 | \r | |
90 | /**\r | |
91 | Function for 'load' command.\r | |
92 | \r | |
93 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
94 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
95 | **/\r | |
96 | SHELL_STATUS\r | |
97 | EFIAPI\r | |
98 | ShellCommandRunLoad (\r | |
99 | IN EFI_HANDLE ImageHandle,\r | |
100 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
101 | );\r | |
102 | \r | |
103 | /**\r | |
104 | Function for 'ls' command.\r | |
105 | \r | |
106 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
107 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
108 | **/\r | |
109 | SHELL_STATUS\r | |
110 | EFIAPI\r | |
111 | ShellCommandRunLs (\r | |
112 | IN EFI_HANDLE ImageHandle,\r | |
113 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
114 | );\r | |
115 | \r | |
116 | /**\r | |
117 | Function for 'map' command.\r | |
118 | \r | |
119 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
120 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
121 | **/\r | |
122 | SHELL_STATUS\r | |
123 | EFIAPI\r | |
124 | ShellCommandRunMap (\r | |
125 | IN EFI_HANDLE ImageHandle,\r | |
126 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
127 | );\r | |
128 | \r | |
129 | /**\r | |
130 | Function for 'reset' command.\r | |
131 | \r | |
132 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
133 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
134 | **/\r | |
135 | SHELL_STATUS\r | |
136 | EFIAPI\r | |
137 | ShellCommandRunReset (\r | |
138 | IN EFI_HANDLE ImageHandle,\r | |
139 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
140 | );\r | |
141 | \r | |
142 | /**\r | |
143 | Function for 'timezone' command.\r | |
144 | \r | |
145 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
146 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
147 | **/\r | |
148 | SHELL_STATUS\r | |
149 | EFIAPI\r | |
150 | ShellCommandRunTimeZone (\r | |
151 | IN EFI_HANDLE ImageHandle,\r | |
152 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
153 | );\r | |
154 | \r | |
155 | /**\r | |
156 | Function for 'set' command.\r | |
157 | \r | |
158 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
159 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
160 | **/\r | |
161 | SHELL_STATUS\r | |
162 | EFIAPI\r | |
163 | ShellCommandRunSet (\r | |
164 | IN EFI_HANDLE ImageHandle,\r | |
165 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
166 | );\r | |
167 | \r | |
168 | /**\r | |
169 | Function for 'mkdir' command.\r | |
170 | \r | |
171 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
172 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
173 | **/\r | |
174 | SHELL_STATUS\r | |
175 | EFIAPI\r | |
176 | ShellCommandRunMkDir (\r | |
177 | IN EFI_HANDLE ImageHandle,\r | |
178 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
179 | );\r | |
180 | \r | |
181 | /**\r | |
182 | Function for 'cd' command.\r | |
183 | \r | |
184 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
185 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
186 | **/\r | |
187 | SHELL_STATUS\r | |
188 | EFIAPI\r | |
189 | ShellCommandRunCd (\r | |
190 | IN EFI_HANDLE ImageHandle,\r | |
191 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
192 | );\r | |
193 | \r | |
194 | /**\r | |
195 | Function for 'cp' command.\r | |
196 | \r | |
197 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
198 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
199 | **/\r | |
200 | SHELL_STATUS\r | |
201 | EFIAPI\r | |
202 | ShellCommandRunCp (\r | |
203 | IN EFI_HANDLE ImageHandle,\r | |
204 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
205 | );\r | |
206 | \r | |
207 | /**\r | |
208 | Function for 'parse' command.\r | |
209 | \r | |
210 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
211 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
212 | **/\r | |
213 | SHELL_STATUS\r | |
214 | EFIAPI\r | |
215 | ShellCommandRunParse (\r | |
216 | IN EFI_HANDLE ImageHandle,\r | |
217 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
218 | );\r | |
219 | \r | |
220 | /**\r | |
221 | Function for 'rm' command.\r | |
222 | \r | |
223 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
224 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
225 | **/\r | |
226 | SHELL_STATUS\r | |
227 | EFIAPI\r | |
228 | ShellCommandRunRm (\r | |
229 | IN EFI_HANDLE ImageHandle,\r | |
230 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
231 | );\r | |
232 | \r | |
233 | /**\r | |
234 | Function for 'mv' command.\r | |
235 | \r | |
236 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
237 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
238 | **/\r | |
239 | SHELL_STATUS\r | |
240 | EFIAPI\r | |
241 | ShellCommandRunMv (\r | |
242 | IN EFI_HANDLE ImageHandle,\r | |
243 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
244 | );\r | |
245 | \r | |
246 | /**\r | |
247 | returns a fully qualified directory (contains a map drive at the begining)\r | |
248 | path from a unknown directory path.\r | |
249 | \r | |
250 | If Path is already fully qualified this will return a duplicat otherwise this\r | |
251 | will use get the current directory and use that to build the fully qualified\r | |
252 | version.\r | |
253 | \r | |
254 | if the return value is not NULL it must be caller freed.\r | |
255 | \r | |
256 | @param[in] Path The unknown Path Value\r | |
257 | \r | |
258 | @retval NULL A memory allocation failed\r | |
259 | @retval NULL a fully qualified path could not be discovered.\r | |
260 | @retval other pointer to a fuly qualified path.\r | |
261 | **/\r | |
262 | CHAR16*\r | |
263 | EFIAPI\r | |
264 | GetFullyQualifiedPath(\r | |
265 | IN CONST CHAR16* Path\r | |
266 | );\r | |
267 | \r | |
268 | /**\r | |
269 | Function to verify all intermediate directories in the path.\r | |
270 | \r | |
271 | @param[in] Path The pointer to the path to fix.\r | |
272 | \r | |
273 | @retval EFI_SUCCESS The operation was successful.\r | |
274 | **/\r | |
275 | EFI_STATUS\r | |
276 | EFIAPI\r | |
277 | VerifyIntermediateDirectories (\r | |
278 | IN CONST CHAR16 *Path\r | |
279 | );\r | |
280 | \r | |
281 | /**\r | |
282 | CaseInsensitive length limited string comparison.\r | |
283 | \r | |
284 | @param[in] Source Pointer to first string.\r | |
285 | @param[in] Target Pointer to second string.\r | |
286 | @param[in] Count Number of characters to compare.\r | |
287 | \r | |
288 | @retval 0 The strings are the same.\r | |
289 | @return non-zero if the strings are different.\r | |
290 | **/\r | |
291 | CONST CHAR16*\r | |
292 | EFIAPI\r | |
293 | StrniCmp(\r | |
294 | IN CONST CHAR16 *Source,\r | |
295 | IN CONST CHAR16 *Target,\r | |
296 | IN CONST UINTN Count\r | |
297 | );\r |