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 - 2016, Intel Corporation. All rights reserved.<BR>
13 This program and the accompanying materials
14 are licensed and made available under the terms and conditions of the BSD License
15 which accompanies this distribution. The full text of the license may be found at
16 http://opensource.org/licenses/bsd-license.php
18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
24 #define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_
28 #include <Guid/ShellLibHiiGuid.h>
30 #include <Protocol/Shell.h>
31 #include <Protocol/ShellParameters.h>
32 #include <Protocol/DevicePath.h>
33 #include <Protocol/LoadedImage.h>
34 #include <Protocol/UnicodeCollation.h>
36 #include <Library/BaseLib.h>
37 #include <Library/BaseMemoryLib.h>
38 #include <Library/DebugLib.h>
39 #include <Library/MemoryAllocationLib.h>
40 #include <Library/PcdLib.h>
41 #include <Library/ShellCommandLib.h>
42 #include <Library/ShellLib.h>
43 #include <Library/UefiLib.h>
44 #include <Library/UefiRuntimeServicesTableLib.h>
45 #include <Library/UefiBootServicesTableLib.h>
46 #include <Library/HiiLib.h>
47 #include <Library/SortLib.h>
48 #include <Library/FileHandleLib.h>
50 extern CONST CHAR16 mFileName
[];
51 extern EFI_HANDLE gShellLevel2HiiHandle
;
54 Function for 'attrib' command.
56 @param[in] ImageHandle Handle to the Image (NULL if Internal).
57 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
61 ShellCommandRunAttrib (
62 IN EFI_HANDLE ImageHandle
,
63 IN EFI_SYSTEM_TABLE
*SystemTable
67 Function for 'date' command.
69 @param[in] ImageHandle Handle to the Image (NULL if Internal).
70 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
75 IN EFI_HANDLE ImageHandle
,
76 IN EFI_SYSTEM_TABLE
*SystemTable
80 Function for 'time' command.
82 @param[in] ImageHandle Handle to the Image (NULL if Internal).
83 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
88 IN EFI_HANDLE ImageHandle
,
89 IN EFI_SYSTEM_TABLE
*SystemTable
93 Function for 'load' command.
95 @param[in] ImageHandle Handle to the Image (NULL if Internal).
96 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
100 ShellCommandRunLoad (
101 IN EFI_HANDLE ImageHandle
,
102 IN EFI_SYSTEM_TABLE
*SystemTable
106 Function for 'ls' command.
108 @param[in] ImageHandle Handle to the Image (NULL if Internal).
109 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
114 IN EFI_HANDLE ImageHandle
,
115 IN EFI_SYSTEM_TABLE
*SystemTable
119 Function for 'map' command.
121 @param[in] ImageHandle Handle to the Image (NULL if Internal).
122 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
127 IN EFI_HANDLE ImageHandle
,
128 IN EFI_SYSTEM_TABLE
*SystemTable
132 Function for 'reset' command.
134 @param[in] ImageHandle Handle to the Image (NULL if Internal).
135 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
139 ShellCommandRunReset (
140 IN EFI_HANDLE ImageHandle
,
141 IN EFI_SYSTEM_TABLE
*SystemTable
145 Function for 'timezone' command.
147 @param[in] ImageHandle Handle to the Image (NULL if Internal).
148 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
152 ShellCommandRunTimeZone (
153 IN EFI_HANDLE ImageHandle
,
154 IN EFI_SYSTEM_TABLE
*SystemTable
158 Function for 'set' command.
160 @param[in] ImageHandle Handle to the Image (NULL if Internal).
161 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
166 IN EFI_HANDLE ImageHandle
,
167 IN EFI_SYSTEM_TABLE
*SystemTable
171 Function for 'mkdir' command.
173 @param[in] ImageHandle Handle to the Image (NULL if Internal).
174 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
178 ShellCommandRunMkDir (
179 IN EFI_HANDLE ImageHandle
,
180 IN EFI_SYSTEM_TABLE
*SystemTable
184 Function for 'cd' command.
186 @param[in] ImageHandle Handle to the Image (NULL if Internal).
187 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
192 IN EFI_HANDLE ImageHandle
,
193 IN EFI_SYSTEM_TABLE
*SystemTable
197 Function for 'cp' command.
199 @param[in] ImageHandle Handle to the Image (NULL if Internal).
200 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
205 IN EFI_HANDLE ImageHandle
,
206 IN EFI_SYSTEM_TABLE
*SystemTable
210 Function for 'parse' command.
212 @param[in] ImageHandle Handle to the Image (NULL if Internal).
213 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
217 ShellCommandRunParse (
218 IN EFI_HANDLE ImageHandle
,
219 IN EFI_SYSTEM_TABLE
*SystemTable
223 Function for 'rm' command.
225 @param[in] ImageHandle Handle to the Image (NULL if Internal).
226 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
231 IN EFI_HANDLE ImageHandle
,
232 IN EFI_SYSTEM_TABLE
*SystemTable
236 Function for 'mv' command.
238 @param[in] ImageHandle Handle to the Image (NULL if Internal).
239 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
244 IN EFI_HANDLE ImageHandle
,
245 IN EFI_SYSTEM_TABLE
*SystemTable
249 returns a fully qualified directory (contains a map drive at the begining)
250 path from a unknown directory path.
252 If Path is already fully qualified this will return a duplicat otherwise this
253 will use get the current directory and use that to build the fully qualified
256 if the return value is not NULL it must be caller freed.
258 @param[in] Path The unknown Path Value
260 @retval NULL A memory allocation failed
261 @retval NULL a fully qualified path could not be discovered.
262 @retval other pointer to a fuly qualified path.
265 GetFullyQualifiedPath(
266 IN CONST CHAR16
* Path
270 Function to verify all intermediate directories in the path.
272 @param[in] Path The pointer to the path to fix.
274 @retval EFI_SUCCESS The operation was successful.
277 VerifyIntermediateDirectories (
278 IN CONST CHAR16
*Path
282 CaseInsensitive length limited string comparison.
284 @param[in] Source Pointer to first string.
285 @param[in] Target Pointer to second string.
286 @param[in] Count Number of characters to compare.
288 @retval 0 The strings are the same.
289 @return non-zero if the strings are different.
293 IN CONST CHAR16
*Source
,
294 IN CONST CHAR16
*Target
,
299 Cleans off all the quotes in the string.
301 @param[in] OriginalString pointer to the string to be cleaned.
302 @param[out] CleanString The new string with all quotes removed.
303 Memory allocated in the function and free
306 @retval EFI_SUCCESS The operation was successful.
309 ShellLevel2StripQuotes (
310 IN CONST CHAR16
*OriginalString
,
311 OUT CHAR16
**CleanString
315 Function for 'Vol' command.
317 @param[in] ImageHandle Handle to the Image (NULL if Internal).
318 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
323 IN EFI_HANDLE ImageHandle
,
324 IN EFI_SYSTEM_TABLE
*SystemTable
328 Function to Copy one file to another location
330 If the destination exists the user will be prompted and the result put into *resp
332 @param[in] Source pointer to source file name
333 @param[in] Dest pointer to destination file name
334 @param[out] Resp pointer to response from question. Pass back on looped calling
335 @param[in] SilentMode whether to run in quiet mode or not
336 @param[in] CmdName Source command name requesting single file copy
338 @retval SHELL_SUCCESS The source file was copied to the destination
342 IN CONST CHAR16
*Source
,
343 IN CONST CHAR16
*Dest
,
345 IN BOOLEAN SilentMode
,
346 IN CONST CHAR16
*CmdName
350 Delete a node and all nodes under it (including sub directories).
352 @param[in] Node The node to start deleting with.
353 @param[in] Quiet TRUE to print no messages.
355 @retval SHELL_SUCCESS The operation was successful.
356 @retval SHELL_ACCESS_DENIED A file was read only.
357 @retval SHELL_ABORTED The abort message was received.
358 @retval SHELL_DEVICE_ERROR A device error occured reading this Node.
362 IN EFI_SHELL_FILE_INFO
*Node
,
363 IN CONST BOOLEAN Quiet