]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
Add code to check whether the pointer 'CorrectedPath' and 'FullPath' are NULL before...
[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
863986b3 12 Copyright (c) 2009 - 2013, 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
ab94587a 50#include <Library/PathLib.h>\r
a405b86d 51\r
52extern CONST CHAR16 mFileName[];\r
53extern EFI_HANDLE gShellLevel2HiiHandle;\r
a405b86d 54\r
55/**\r
56 Function for 'attrib' command.\r
57\r
58 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
59 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
60**/\r
61SHELL_STATUS\r
62EFIAPI\r
63ShellCommandRunAttrib (\r
64 IN EFI_HANDLE ImageHandle,\r
65 IN EFI_SYSTEM_TABLE *SystemTable\r
66 );\r
67\r
68/**\r
69 Function for 'date' command.\r
70\r
71 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
72 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
73**/\r
74SHELL_STATUS\r
75EFIAPI\r
76ShellCommandRunDate (\r
77 IN EFI_HANDLE ImageHandle,\r
78 IN EFI_SYSTEM_TABLE *SystemTable\r
79 );\r
80\r
81/**\r
82 Function for 'time' command.\r
83\r
84 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
85 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
86**/\r
87SHELL_STATUS\r
88EFIAPI\r
89ShellCommandRunTime (\r
90 IN EFI_HANDLE ImageHandle,\r
91 IN EFI_SYSTEM_TABLE *SystemTable\r
92 );\r
93\r
94/**\r
95 Function for 'load' command.\r
96\r
97 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
98 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
99**/\r
100SHELL_STATUS\r
101EFIAPI\r
102ShellCommandRunLoad (\r
103 IN EFI_HANDLE ImageHandle,\r
104 IN EFI_SYSTEM_TABLE *SystemTable\r
105 );\r
106\r
107/**\r
108 Function for 'ls' command.\r
109\r
110 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
111 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
112**/\r
113SHELL_STATUS\r
114EFIAPI\r
115ShellCommandRunLs (\r
116 IN EFI_HANDLE ImageHandle,\r
117 IN EFI_SYSTEM_TABLE *SystemTable\r
118 );\r
119\r
120/**\r
121 Function for 'map' command.\r
122\r
123 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
124 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
125**/\r
126SHELL_STATUS\r
127EFIAPI\r
128ShellCommandRunMap (\r
129 IN EFI_HANDLE ImageHandle,\r
130 IN EFI_SYSTEM_TABLE *SystemTable\r
131 );\r
132\r
133/**\r
134 Function for 'reset' command.\r
135\r
136 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
137 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
138**/\r
139SHELL_STATUS\r
140EFIAPI\r
141ShellCommandRunReset (\r
142 IN EFI_HANDLE ImageHandle,\r
143 IN EFI_SYSTEM_TABLE *SystemTable\r
144 );\r
145\r
146/**\r
147 Function for 'timezone' command.\r
148\r
149 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
150 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
151**/\r
152SHELL_STATUS\r
153EFIAPI\r
154ShellCommandRunTimeZone (\r
155 IN EFI_HANDLE ImageHandle,\r
156 IN EFI_SYSTEM_TABLE *SystemTable\r
157 );\r
158\r
159/**\r
160 Function for 'set' command.\r
161\r
162 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
163 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
164**/\r
165SHELL_STATUS\r
166EFIAPI\r
167ShellCommandRunSet (\r
168 IN EFI_HANDLE ImageHandle,\r
169 IN EFI_SYSTEM_TABLE *SystemTable\r
170 );\r
171\r
172/**\r
173 Function for 'mkdir' command.\r
174\r
175 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
176 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
177**/\r
178SHELL_STATUS\r
179EFIAPI\r
180ShellCommandRunMkDir (\r
181 IN EFI_HANDLE ImageHandle,\r
182 IN EFI_SYSTEM_TABLE *SystemTable\r
183 );\r
184\r
185/**\r
186 Function for 'cd' command.\r
187\r
188 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
189 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
190**/\r
191SHELL_STATUS\r
192EFIAPI\r
193ShellCommandRunCd (\r
194 IN EFI_HANDLE ImageHandle,\r
195 IN EFI_SYSTEM_TABLE *SystemTable\r
196 );\r
197\r
198/**\r
199 Function for 'cp' command.\r
200\r
201 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
202 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
203**/\r
204SHELL_STATUS\r
205EFIAPI\r
206ShellCommandRunCp (\r
207 IN EFI_HANDLE ImageHandle,\r
208 IN EFI_SYSTEM_TABLE *SystemTable\r
209 );\r
210\r
211/**\r
212 Function for 'parse' command.\r
213\r
214 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
215 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
216**/\r
217SHELL_STATUS\r
218EFIAPI\r
219ShellCommandRunParse (\r
220 IN EFI_HANDLE ImageHandle,\r
221 IN EFI_SYSTEM_TABLE *SystemTable\r
222 );\r
223\r
224/**\r
225 Function for 'rm' command.\r
226\r
227 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
228 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
229**/\r
230SHELL_STATUS\r
231EFIAPI\r
232ShellCommandRunRm (\r
233 IN EFI_HANDLE ImageHandle,\r
234 IN EFI_SYSTEM_TABLE *SystemTable\r
235 );\r
236\r
237/**\r
238 Function for 'mv' command.\r
239\r
240 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
241 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
242**/\r
243SHELL_STATUS\r
244EFIAPI\r
245ShellCommandRunMv (\r
246 IN EFI_HANDLE ImageHandle,\r
247 IN EFI_SYSTEM_TABLE *SystemTable\r
248 );\r
249\r
250/**\r
251 returns a fully qualified directory (contains a map drive at the begining)\r
252 path from a unknown directory path.\r
253\r
254 If Path is already fully qualified this will return a duplicat otherwise this\r
255 will use get the current directory and use that to build the fully qualified\r
256 version.\r
257\r
258 if the return value is not NULL it must be caller freed.\r
259\r
260 @param[in] Path The unknown Path Value\r
261\r
262 @retval NULL A memory allocation failed\r
263 @retval NULL a fully qualified path could not be discovered.\r
264 @retval other pointer to a fuly qualified path.\r
265**/\r
266CHAR16*\r
267EFIAPI\r
268GetFullyQualifiedPath(\r
269 IN CONST CHAR16* Path\r
270 );\r
271\r
272/**\r
273 Function to verify all intermediate directories in the path.\r
274\r
275 @param[in] Path The pointer to the path to fix.\r
276\r
277 @retval EFI_SUCCESS The operation was successful.\r
278**/\r
279EFI_STATUS\r
280EFIAPI\r
281VerifyIntermediateDirectories (\r
282 IN CONST CHAR16 *Path\r
283 );\r
284\r
285/**\r
286 CaseInsensitive length limited string comparison.\r
287\r
288 @param[in] Source Pointer to first string.\r
289 @param[in] Target Pointer to second string.\r
290 @param[in] Count Number of characters to compare.\r
291\r
292 @retval 0 The strings are the same.\r
293 @return non-zero if the strings are different.\r
294**/\r
295CONST CHAR16*\r
296EFIAPI\r
297StrniCmp(\r
298 IN CONST CHAR16 *Source,\r
299 IN CONST CHAR16 *Target,\r
300 IN CONST UINTN Count\r
301 );\r
b54fd049 302\r
303/**\r
304 Function for 'Vol' command.\r
305\r
306 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
307 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
308**/\r
309SHELL_STATUS\r
310EFIAPI\r
311ShellCommandRunVol (\r
312 IN EFI_HANDLE ImageHandle,\r
313 IN EFI_SYSTEM_TABLE *SystemTable\r
314 );\r
315\r
316#endif\r
317\r