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