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