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