]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
MdeModulePkg, MdePkg, NetworkPkg, OvmfPkg, PerformancePkg, ShellPkg: Library Migration.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / UefiShellLevel2CommandsLib.h
CommitLineData
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
7fe3fbad 12 Copyright (c) 2009 - 2014, 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
27#include <ShellBase.h>\r
28\r
bca163ff
LG
29#include <Guid/ShellLibHiiGuid.h>\r
30\r
a405b86d 31#include <Protocol/EfiShell.h>\r
32#include <Protocol/EfiShellParameters.h>\r
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
51extern CONST CHAR16 mFileName[];\r
52extern 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
60SHELL_STATUS\r
61EFIAPI\r
62ShellCommandRunAttrib (\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
73SHELL_STATUS\r
74EFIAPI\r
75ShellCommandRunDate (\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
86SHELL_STATUS\r
87EFIAPI\r
88ShellCommandRunTime (\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
99SHELL_STATUS\r
100EFIAPI\r
101ShellCommandRunLoad (\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
112SHELL_STATUS\r
113EFIAPI\r
114ShellCommandRunLs (\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
125SHELL_STATUS\r
126EFIAPI\r
127ShellCommandRunMap (\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
138SHELL_STATUS\r
139EFIAPI\r
140ShellCommandRunReset (\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
151SHELL_STATUS\r
152EFIAPI\r
153ShellCommandRunTimeZone (\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
164SHELL_STATUS\r
165EFIAPI\r
166ShellCommandRunSet (\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
177SHELL_STATUS\r
178EFIAPI\r
179ShellCommandRunMkDir (\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
190SHELL_STATUS\r
191EFIAPI\r
192ShellCommandRunCd (\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
203SHELL_STATUS\r
204EFIAPI\r
205ShellCommandRunCp (\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
216SHELL_STATUS\r
217EFIAPI\r
218ShellCommandRunParse (\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
229SHELL_STATUS\r
230EFIAPI\r
231ShellCommandRunRm (\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
242SHELL_STATUS\r
243EFIAPI\r
244ShellCommandRunMv (\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
265CHAR16*\r
266EFIAPI\r
267GetFullyQualifiedPath(\r
268 IN CONST CHAR16* Path\r
269 );\r
270\r
271/**\r
272 Function to verify all intermediate directories in the path.\r
273\r
274 @param[in] Path The pointer to the path to fix.\r
275\r
276 @retval EFI_SUCCESS The operation was successful.\r
277**/\r
278EFI_STATUS\r
279EFIAPI\r
280VerifyIntermediateDirectories (\r
281 IN CONST CHAR16 *Path\r
282 );\r
283\r
284/**\r
285 CaseInsensitive length limited string comparison.\r
286\r
287 @param[in] Source Pointer to first string.\r
288 @param[in] Target Pointer to second string.\r
289 @param[in] Count Number of characters to compare.\r
290\r
291 @retval 0 The strings are the same.\r
292 @return non-zero if the strings are different.\r
293**/\r
294CONST CHAR16*\r
295EFIAPI\r
296StrniCmp(\r
297 IN CONST CHAR16 *Source,\r
298 IN CONST CHAR16 *Target,\r
299 IN CONST UINTN Count\r
300 );\r
b54fd049 301\r
0960ba17
QS
302/**\r
303 Cleans off all the quotes in the string.\r
304\r
305 @param[in] OriginalString pointer to the string to be cleaned.\r
306 @param[out] CleanString The new string with all quotes removed. \r
307 Memory allocated in the function and free \r
308 by caller.\r
309\r
310 @retval EFI_SUCCESS The operation was successful.\r
311**/\r
312EFI_STATUS\r
313EFIAPI\r
314ShellLevel2StripQuotes (\r
315 IN CONST CHAR16 *OriginalString,\r
316 OUT CHAR16 **CleanString\r
317 );\r
318\r
b54fd049 319/**\r
320 Function for 'Vol' command.\r
321\r
322 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
323 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
324**/\r
325SHELL_STATUS\r
326EFIAPI\r
327ShellCommandRunVol (\r
328 IN EFI_HANDLE ImageHandle,\r
329 IN EFI_SYSTEM_TABLE *SystemTable\r
330 );\r
331\r
7fe3fbad
JC
332/**\r
333 Function to Copy one file to another location\r
334\r
335 If the destination exists the user will be prompted and the result put into *resp\r
336\r
337 @param[in] Source pointer to source file name\r
338 @param[in] Dest pointer to destination file name\r
339 @param[out] Resp pointer to response from question. Pass back on looped calling\r
340 @param[in] SilentMode whether to run in quiet mode or not\r
341\r
342 @retval SHELL_SUCCESS The source file was copied to the destination\r
343**/\r
344SHELL_STATUS\r
345EFIAPI\r
346CopySingleFile(\r
347 IN CONST CHAR16 *Source,\r
348 IN CONST CHAR16 *Dest,\r
349 OUT VOID **Resp,\r
350 IN BOOLEAN SilentMode\r
351 );\r
352\r
353/**\r
354 Delete a node and all nodes under it (including sub directories).\r
355\r
356 @param[in] Node The node to start deleting with.\r
357 @param[in] Quiet TRUE to print no messages.\r
358\r
359 @retval SHELL_SUCCESS The operation was successful.\r
360 @retval SHELL_ACCESS_DENIED A file was read only.\r
361 @retval SHELL_ABORTED The abort message was received.\r
362 @retval SHELL_DEVICE_ERROR A device error occured reading this Node.\r
363**/\r
364SHELL_STATUS\r
365EFIAPI\r
366CascadeDelete(\r
367 IN EFI_SHELL_FILE_INFO *Node,\r
368 IN CONST BOOLEAN Quiet\r
369 );\r
370\r
b54fd049 371#endif\r
372\r