2 Main file for NULL named library for level 2 shell command functions.
5 attrib, cd, cp, date*, time*, rm, reset,
6 load, ls, map, mkdir, mv, parse, set, timezone*
9 * functions are non-interactive only
12 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
13 SPDX-License-Identifier: BSD-2-Clause-Patent
17 #ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
18 #define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
22 #include <Guid/GlobalVariable.h>
23 #include <Guid/ShellLibHiiGuid.h>
25 #include <Protocol/Shell.h>
26 #include <Protocol/ShellParameters.h>
27 #include <Protocol/DevicePath.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/UnicodeCollation.h>
31 #include <Library/BaseLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/ShellCommandLib.h>
37 #include <Library/ShellLib.h>
38 #include <Library/UefiLib.h>
39 #include <Library/UefiRuntimeServicesTableLib.h>
40 #include <Library/UefiBootServicesTableLib.h>
41 #include <Library/HiiLib.h>
42 #include <Library/SortLib.h>
43 #include <Library/FileHandleLib.h>
45 extern CONST CHAR16 mFileName
[];
46 extern EFI_HANDLE gShellLevel2HiiHandle
;
49 Function for 'attrib' command.
51 @param[in] ImageHandle Handle to the Image (NULL if Internal).
52 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
56 ShellCommandRunAttrib (
57 IN EFI_HANDLE ImageHandle
,
58 IN EFI_SYSTEM_TABLE
*SystemTable
62 Function for 'date' command.
64 @param[in] ImageHandle Handle to the Image (NULL if Internal).
65 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
70 IN EFI_HANDLE ImageHandle
,
71 IN EFI_SYSTEM_TABLE
*SystemTable
75 Function for 'time' command.
77 @param[in] ImageHandle Handle to the Image (NULL if Internal).
78 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
83 IN EFI_HANDLE ImageHandle
,
84 IN EFI_SYSTEM_TABLE
*SystemTable
88 Function for 'load' command.
90 @param[in] ImageHandle Handle to the Image (NULL if Internal).
91 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
96 IN EFI_HANDLE ImageHandle
,
97 IN EFI_SYSTEM_TABLE
*SystemTable
101 Function for 'ls' command.
103 @param[in] ImageHandle Handle to the Image (NULL if Internal).
104 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
109 IN EFI_HANDLE ImageHandle
,
110 IN EFI_SYSTEM_TABLE
*SystemTable
114 Function for 'map' command.
116 @param[in] ImageHandle Handle to the Image (NULL if Internal).
117 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
122 IN EFI_HANDLE ImageHandle
,
123 IN EFI_SYSTEM_TABLE
*SystemTable
127 Function for 'reset' command.
129 @param[in] ImageHandle Handle to the Image (NULL if Internal).
130 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
134 ShellCommandRunReset (
135 IN EFI_HANDLE ImageHandle
,
136 IN EFI_SYSTEM_TABLE
*SystemTable
140 Function for 'timezone' command.
142 @param[in] ImageHandle Handle to the Image (NULL if Internal).
143 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
147 ShellCommandRunTimeZone (
148 IN EFI_HANDLE ImageHandle
,
149 IN EFI_SYSTEM_TABLE
*SystemTable
153 Function for 'set' command.
155 @param[in] ImageHandle Handle to the Image (NULL if Internal).
156 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
161 IN EFI_HANDLE ImageHandle
,
162 IN EFI_SYSTEM_TABLE
*SystemTable
166 Function for 'mkdir' command.
168 @param[in] ImageHandle Handle to the Image (NULL if Internal).
169 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
173 ShellCommandRunMkDir (
174 IN EFI_HANDLE ImageHandle
,
175 IN EFI_SYSTEM_TABLE
*SystemTable
179 Function for 'cd' command.
181 @param[in] ImageHandle Handle to the Image (NULL if Internal).
182 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
187 IN EFI_HANDLE ImageHandle
,
188 IN EFI_SYSTEM_TABLE
*SystemTable
192 Function for 'cp' command.
194 @param[in] ImageHandle Handle to the Image (NULL if Internal).
195 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
200 IN EFI_HANDLE ImageHandle
,
201 IN EFI_SYSTEM_TABLE
*SystemTable
205 Function for 'parse' command.
207 @param[in] ImageHandle Handle to the Image (NULL if Internal).
208 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
212 ShellCommandRunParse (
213 IN EFI_HANDLE ImageHandle
,
214 IN EFI_SYSTEM_TABLE
*SystemTable
218 Function for 'rm' command.
220 @param[in] ImageHandle Handle to the Image (NULL if Internal).
221 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
226 IN EFI_HANDLE ImageHandle
,
227 IN EFI_SYSTEM_TABLE
*SystemTable
231 Function for 'mv' command.
233 @param[in] ImageHandle Handle to the Image (NULL if Internal).
234 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
239 IN EFI_HANDLE ImageHandle
,
240 IN EFI_SYSTEM_TABLE
*SystemTable
244 returns a fully qualified directory (contains a map drive at the begining)
245 path from a unknown directory path.
247 If Path is already fully qualified this will return a duplicat otherwise this
248 will use get the current directory and use that to build the fully qualified
251 if the return value is not NULL it must be caller freed.
253 @param[in] Path The unknown Path Value
255 @retval NULL A memory allocation failed
256 @retval NULL a fully qualified path could not be discovered.
257 @retval other pointer to a fuly qualified path.
260 GetFullyQualifiedPath(
261 IN CONST CHAR16
* Path
265 Function to verify all intermediate directories in the path.
267 @param[in] Path The pointer to the path to fix.
269 @retval EFI_SUCCESS The operation was successful.
272 VerifyIntermediateDirectories (
273 IN CONST CHAR16
*Path
277 String comparison without regard to case for a limited number of characters.
279 @param[in] Source The first item to compare.
280 @param[in] Target The second item to compare.
281 @param[in] Count How many characters to compare.
283 @retval 0 Source and Target are identical strings without regard to case.
284 @retval !=0 Source is not identical to Target.
289 IN CONST CHAR16
*Source
,
290 IN CONST CHAR16
*Target
,
295 Cleans off all the quotes in the string.
297 @param[in] OriginalString pointer to the string to be cleaned.
298 @param[out] CleanString The new string with all quotes removed.
299 Memory allocated in the function and free
302 @retval EFI_SUCCESS The operation was successful.
305 ShellLevel2StripQuotes (
306 IN CONST CHAR16
*OriginalString
,
307 OUT CHAR16
**CleanString
311 Function for 'Vol' command.
313 @param[in] ImageHandle Handle to the Image (NULL if Internal).
314 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
319 IN EFI_HANDLE ImageHandle
,
320 IN EFI_SYSTEM_TABLE
*SystemTable
324 Function to Copy one file to another location
326 If the destination exists the user will be prompted and the result put into *resp
328 @param[in] Source pointer to source file name
329 @param[in] Dest pointer to destination file name
330 @param[out] Resp pointer to response from question. Pass back on looped calling
331 @param[in] SilentMode whether to run in quiet mode or not
332 @param[in] CmdName Source command name requesting single file copy
334 @retval SHELL_SUCCESS The source file was copied to the destination
338 IN CONST CHAR16
*Source
,
339 IN CONST CHAR16
*Dest
,
341 IN BOOLEAN SilentMode
,
342 IN CONST CHAR16
*CmdName
346 Delete a node and all nodes under it (including sub directories).
348 @param[in] Node The node to start deleting with.
349 @param[in] Quiet TRUE to print no messages.
351 @retval SHELL_SUCCESS The operation was successful.
352 @retval SHELL_ACCESS_DENIED A file was read only.
353 @retval SHELL_ABORTED The abort message was received.
354 @retval SHELL_DEVICE_ERROR A device error occured reading this Node.
358 IN EFI_SHELL_FILE_INFO
*Node
,
359 IN CONST BOOLEAN Quiet