]>
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 | |
28165f24 | 12 | Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r |
a405b86d | 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 | |
a1d4bfcc | 23 | #ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_\r |
b54fd049 | 24 | #define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_\r |
25 | \r | |
a405b86d | 26 | #include <Uefi.h>\r |
a405b86d | 27 | \r |
bca163ff LG |
28 | #include <Guid/ShellLibHiiGuid.h>\r |
29 | \r | |
28165f24 RN |
30 | #include <Protocol/Shell.h>\r |
31 | #include <Protocol/ShellParameters.h>\r | |
a405b86d | 32 | #include <Protocol/DevicePath.h>\r |
33 | #include <Protocol/LoadedImage.h>\r | |
34 | #include <Protocol/UnicodeCollation.h>\r | |
a405b86d | 35 | \r |
36 | #include <Library/BaseLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
38 | #include <Library/DebugLib.h>\r | |
39 | #include <Library/MemoryAllocationLib.h>\r | |
40 | #include <Library/PcdLib.h>\r | |
41 | #include <Library/ShellCommandLib.h>\r | |
42 | #include <Library/ShellLib.h>\r | |
43 | #include <Library/UefiLib.h>\r | |
44 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
45 | #include <Library/UefiBootServicesTableLib.h>\r | |
46 | #include <Library/HiiLib.h>\r | |
47 | #include <Library/SortLib.h>\r | |
48 | #include <Library/FileHandleLib.h>\r | |
49 | \r | |
50 | extern CONST CHAR16 mFileName[];\r | |
51 | extern EFI_HANDLE gShellLevel2HiiHandle;\r | |
a405b86d | 52 | \r |
53 | /**\r | |
54 | Function for 'attrib' command.\r | |
55 | \r | |
56 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
57 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
58 | **/\r | |
59 | SHELL_STATUS\r | |
60 | EFIAPI\r | |
61 | ShellCommandRunAttrib (\r | |
62 | IN EFI_HANDLE ImageHandle,\r | |
63 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | Function for 'date' command.\r | |
68 | \r | |
69 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
70 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
71 | **/\r | |
72 | SHELL_STATUS\r | |
73 | EFIAPI\r | |
74 | ShellCommandRunDate (\r | |
75 | IN EFI_HANDLE ImageHandle,\r | |
76 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | Function for 'time' command.\r | |
81 | \r | |
82 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
83 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
84 | **/\r | |
85 | SHELL_STATUS\r | |
86 | EFIAPI\r | |
87 | ShellCommandRunTime (\r | |
88 | IN EFI_HANDLE ImageHandle,\r | |
89 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
90 | );\r | |
91 | \r | |
92 | /**\r | |
93 | Function for 'load' command.\r | |
94 | \r | |
95 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
96 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
97 | **/\r | |
98 | SHELL_STATUS\r | |
99 | EFIAPI\r | |
100 | ShellCommandRunLoad (\r | |
101 | IN EFI_HANDLE ImageHandle,\r | |
102 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
103 | );\r | |
104 | \r | |
105 | /**\r | |
106 | Function for 'ls' command.\r | |
107 | \r | |
108 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
109 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
110 | **/\r | |
111 | SHELL_STATUS\r | |
112 | EFIAPI\r | |
113 | ShellCommandRunLs (\r | |
114 | IN EFI_HANDLE ImageHandle,\r | |
115 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
116 | );\r | |
117 | \r | |
118 | /**\r | |
119 | Function for 'map' command.\r | |
120 | \r | |
121 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
122 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
123 | **/\r | |
124 | SHELL_STATUS\r | |
125 | EFIAPI\r | |
126 | ShellCommandRunMap (\r | |
127 | IN EFI_HANDLE ImageHandle,\r | |
128 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
129 | );\r | |
130 | \r | |
131 | /**\r | |
132 | Function for 'reset' command.\r | |
133 | \r | |
134 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
135 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
136 | **/\r | |
137 | SHELL_STATUS\r | |
138 | EFIAPI\r | |
139 | ShellCommandRunReset (\r | |
140 | IN EFI_HANDLE ImageHandle,\r | |
141 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
142 | );\r | |
143 | \r | |
144 | /**\r | |
145 | Function for 'timezone' command.\r | |
146 | \r | |
147 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
148 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
149 | **/\r | |
150 | SHELL_STATUS\r | |
151 | EFIAPI\r | |
152 | ShellCommandRunTimeZone (\r | |
153 | IN EFI_HANDLE ImageHandle,\r | |
154 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
155 | );\r | |
156 | \r | |
157 | /**\r | |
158 | Function for 'set' command.\r | |
159 | \r | |
160 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
161 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
162 | **/\r | |
163 | SHELL_STATUS\r | |
164 | EFIAPI\r | |
165 | ShellCommandRunSet (\r | |
166 | IN EFI_HANDLE ImageHandle,\r | |
167 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Function for 'mkdir' command.\r | |
172 | \r | |
173 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
174 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
175 | **/\r | |
176 | SHELL_STATUS\r | |
177 | EFIAPI\r | |
178 | ShellCommandRunMkDir (\r | |
179 | IN EFI_HANDLE ImageHandle,\r | |
180 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
181 | );\r | |
182 | \r | |
183 | /**\r | |
184 | Function for 'cd' command.\r | |
185 | \r | |
186 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
187 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
188 | **/\r | |
189 | SHELL_STATUS\r | |
190 | EFIAPI\r | |
191 | ShellCommandRunCd (\r | |
192 | IN EFI_HANDLE ImageHandle,\r | |
193 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
194 | );\r | |
195 | \r | |
196 | /**\r | |
197 | Function for 'cp' command.\r | |
198 | \r | |
199 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
200 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
201 | **/\r | |
202 | SHELL_STATUS\r | |
203 | EFIAPI\r | |
204 | ShellCommandRunCp (\r | |
205 | IN EFI_HANDLE ImageHandle,\r | |
206 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
207 | );\r | |
208 | \r | |
209 | /**\r | |
210 | Function for 'parse' command.\r | |
211 | \r | |
212 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
213 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
214 | **/\r | |
215 | SHELL_STATUS\r | |
216 | EFIAPI\r | |
217 | ShellCommandRunParse (\r | |
218 | IN EFI_HANDLE ImageHandle,\r | |
219 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
220 | );\r | |
221 | \r | |
222 | /**\r | |
223 | Function for 'rm' command.\r | |
224 | \r | |
225 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
226 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
227 | **/\r | |
228 | SHELL_STATUS\r | |
229 | EFIAPI\r | |
230 | ShellCommandRunRm (\r | |
231 | IN EFI_HANDLE ImageHandle,\r | |
232 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
233 | );\r | |
234 | \r | |
235 | /**\r | |
236 | Function for 'mv' command.\r | |
237 | \r | |
238 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
239 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
240 | **/\r | |
241 | SHELL_STATUS\r | |
242 | EFIAPI\r | |
243 | ShellCommandRunMv (\r | |
244 | IN EFI_HANDLE ImageHandle,\r | |
245 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
246 | );\r | |
247 | \r | |
248 | /**\r | |
249 | returns a fully qualified directory (contains a map drive at the begining)\r | |
250 | path from a unknown directory path.\r | |
251 | \r | |
252 | If Path is already fully qualified this will return a duplicat otherwise this\r | |
253 | will use get the current directory and use that to build the fully qualified\r | |
254 | version.\r | |
255 | \r | |
256 | if the return value is not NULL it must be caller freed.\r | |
257 | \r | |
258 | @param[in] Path The unknown Path Value\r | |
259 | \r | |
260 | @retval NULL A memory allocation failed\r | |
261 | @retval NULL a fully qualified path could not be discovered.\r | |
262 | @retval other pointer to a fuly qualified path.\r | |
263 | **/\r | |
264 | CHAR16*\r | |
a405b86d | 265 | GetFullyQualifiedPath(\r |
266 | IN CONST CHAR16* Path\r | |
267 | );\r | |
268 | \r | |
269 | /**\r | |
270 | Function to verify all intermediate directories in the path.\r | |
271 | \r | |
272 | @param[in] Path The pointer to the path to fix.\r | |
273 | \r | |
274 | @retval EFI_SUCCESS The operation was successful.\r | |
275 | **/\r | |
276 | EFI_STATUS\r | |
a405b86d | 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 | |
a405b86d | 292 | StrniCmp(\r |
293 | IN CONST CHAR16 *Source,\r | |
294 | IN CONST CHAR16 *Target,\r | |
295 | IN CONST UINTN Count\r | |
296 | );\r | |
b54fd049 | 297 | \r |
0960ba17 QS |
298 | /**\r |
299 | Cleans off all the quotes in the string.\r | |
300 | \r | |
301 | @param[in] OriginalString pointer to the string to be cleaned.\r | |
302 | @param[out] CleanString The new string with all quotes removed. \r | |
303 | Memory allocated in the function and free \r | |
304 | by caller.\r | |
305 | \r | |
306 | @retval EFI_SUCCESS The operation was successful.\r | |
307 | **/\r | |
308 | EFI_STATUS\r | |
0960ba17 QS |
309 | ShellLevel2StripQuotes (\r |
310 | IN CONST CHAR16 *OriginalString,\r | |
311 | OUT CHAR16 **CleanString\r | |
312 | );\r | |
313 | \r | |
b54fd049 | 314 | /**\r |
315 | Function for 'Vol' command.\r | |
316 | \r | |
317 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
318 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
319 | **/\r | |
320 | SHELL_STATUS\r | |
321 | EFIAPI\r | |
322 | ShellCommandRunVol (\r | |
323 | IN EFI_HANDLE ImageHandle,\r | |
324 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
325 | );\r | |
326 | \r | |
7fe3fbad JC |
327 | /**\r |
328 | Function to Copy one file to another location\r | |
329 | \r | |
330 | If the destination exists the user will be prompted and the result put into *resp\r | |
331 | \r | |
332 | @param[in] Source pointer to source file name\r | |
333 | @param[in] Dest pointer to destination file name\r | |
334 | @param[out] Resp pointer to response from question. Pass back on looped calling\r | |
335 | @param[in] SilentMode whether to run in quiet mode or not\r | |
bf6bbc21 | 336 | @param[in] CmdName Source command name requesting single file copy\r |
7fe3fbad JC |
337 | \r |
338 | @retval SHELL_SUCCESS The source file was copied to the destination\r | |
339 | **/\r | |
340 | SHELL_STATUS\r | |
7fe3fbad JC |
341 | CopySingleFile(\r |
342 | IN CONST CHAR16 *Source,\r | |
343 | IN CONST CHAR16 *Dest,\r | |
344 | OUT VOID **Resp,\r | |
bf6bbc21 TS |
345 | IN BOOLEAN SilentMode,\r |
346 | IN CONST CHAR16 *CmdName\r | |
7fe3fbad JC |
347 | );\r |
348 | \r | |
349 | /**\r | |
350 | Delete a node and all nodes under it (including sub directories).\r | |
351 | \r | |
352 | @param[in] Node The node to start deleting with.\r | |
353 | @param[in] Quiet TRUE to print no messages.\r | |
354 | \r | |
355 | @retval SHELL_SUCCESS The operation was successful.\r | |
356 | @retval SHELL_ACCESS_DENIED A file was read only.\r | |
357 | @retval SHELL_ABORTED The abort message was received.\r | |
358 | @retval SHELL_DEVICE_ERROR A device error occured reading this Node.\r | |
359 | **/\r | |
360 | SHELL_STATUS\r | |
7fe3fbad JC |
361 | CascadeDelete(\r |
362 | IN EFI_SHELL_FILE_INFO *Node,\r | |
363 | IN CONST BOOLEAN Quiet\r | |
364 | );\r | |
365 | \r | |
b54fd049 | 366 | #endif\r |
367 | \r |