]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
udk2010.up2.shell initial release.
[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 - 2010, 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 #include <Uefi.h>
24 #include <ShellBase.h>
25
26 #include <Protocol/EfiShell.h>
27 #include <Protocol/EfiShellParameters.h>
28 #include <Protocol/DevicePath.h>
29 #include <Protocol/LoadedImage.h>
30 #include <Protocol/UnicodeCollation.h>
31 #include <Protocol/DevicePathToText.h>
32
33 #include <Library/BaseLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/DebugLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/ShellCommandLib.h>
39 #include <Library/ShellLib.h>
40 #include <Library/UefiLib.h>
41 #include <Library/UefiRuntimeServicesTableLib.h>
42 #include <Library/UefiBootServicesTableLib.h>
43 #include <Library/HiiLib.h>
44 #include <Library/SortLib.h>
45 #include <Library/FileHandleLib.h>
46
47 extern CONST CHAR16 mFileName[];
48 extern EFI_HANDLE gShellLevel2HiiHandle;
49 extern CONST EFI_GUID gShellLevel2HiiGuid;
50
51 /**
52 Function for 'attrib' command.
53
54 @param[in] ImageHandle Handle to the Image (NULL if Internal).
55 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
56 **/
57 SHELL_STATUS
58 EFIAPI
59 ShellCommandRunAttrib (
60 IN EFI_HANDLE ImageHandle,
61 IN EFI_SYSTEM_TABLE *SystemTable
62 );
63
64 /**
65 Function for 'date' command.
66
67 @param[in] ImageHandle Handle to the Image (NULL if Internal).
68 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
69 **/
70 SHELL_STATUS
71 EFIAPI
72 ShellCommandRunDate (
73 IN EFI_HANDLE ImageHandle,
74 IN EFI_SYSTEM_TABLE *SystemTable
75 );
76
77 /**
78 Function for 'time' command.
79
80 @param[in] ImageHandle Handle to the Image (NULL if Internal).
81 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
82 **/
83 SHELL_STATUS
84 EFIAPI
85 ShellCommandRunTime (
86 IN EFI_HANDLE ImageHandle,
87 IN EFI_SYSTEM_TABLE *SystemTable
88 );
89
90 /**
91 Function for 'load' command.
92
93 @param[in] ImageHandle Handle to the Image (NULL if Internal).
94 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
95 **/
96 SHELL_STATUS
97 EFIAPI
98 ShellCommandRunLoad (
99 IN EFI_HANDLE ImageHandle,
100 IN EFI_SYSTEM_TABLE *SystemTable
101 );
102
103 /**
104 Function for 'ls' command.
105
106 @param[in] ImageHandle Handle to the Image (NULL if Internal).
107 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
108 **/
109 SHELL_STATUS
110 EFIAPI
111 ShellCommandRunLs (
112 IN EFI_HANDLE ImageHandle,
113 IN EFI_SYSTEM_TABLE *SystemTable
114 );
115
116 /**
117 Function for 'map' command.
118
119 @param[in] ImageHandle Handle to the Image (NULL if Internal).
120 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
121 **/
122 SHELL_STATUS
123 EFIAPI
124 ShellCommandRunMap (
125 IN EFI_HANDLE ImageHandle,
126 IN EFI_SYSTEM_TABLE *SystemTable
127 );
128
129 /**
130 Function for 'reset' command.
131
132 @param[in] ImageHandle Handle to the Image (NULL if Internal).
133 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
134 **/
135 SHELL_STATUS
136 EFIAPI
137 ShellCommandRunReset (
138 IN EFI_HANDLE ImageHandle,
139 IN EFI_SYSTEM_TABLE *SystemTable
140 );
141
142 /**
143 Function for 'timezone' command.
144
145 @param[in] ImageHandle Handle to the Image (NULL if Internal).
146 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
147 **/
148 SHELL_STATUS
149 EFIAPI
150 ShellCommandRunTimeZone (
151 IN EFI_HANDLE ImageHandle,
152 IN EFI_SYSTEM_TABLE *SystemTable
153 );
154
155 /**
156 Function for 'set' command.
157
158 @param[in] ImageHandle Handle to the Image (NULL if Internal).
159 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
160 **/
161 SHELL_STATUS
162 EFIAPI
163 ShellCommandRunSet (
164 IN EFI_HANDLE ImageHandle,
165 IN EFI_SYSTEM_TABLE *SystemTable
166 );
167
168 /**
169 Function for 'mkdir' command.
170
171 @param[in] ImageHandle Handle to the Image (NULL if Internal).
172 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
173 **/
174 SHELL_STATUS
175 EFIAPI
176 ShellCommandRunMkDir (
177 IN EFI_HANDLE ImageHandle,
178 IN EFI_SYSTEM_TABLE *SystemTable
179 );
180
181 /**
182 Function for 'cd' command.
183
184 @param[in] ImageHandle Handle to the Image (NULL if Internal).
185 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
186 **/
187 SHELL_STATUS
188 EFIAPI
189 ShellCommandRunCd (
190 IN EFI_HANDLE ImageHandle,
191 IN EFI_SYSTEM_TABLE *SystemTable
192 );
193
194 /**
195 Function for 'cp' command.
196
197 @param[in] ImageHandle Handle to the Image (NULL if Internal).
198 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
199 **/
200 SHELL_STATUS
201 EFIAPI
202 ShellCommandRunCp (
203 IN EFI_HANDLE ImageHandle,
204 IN EFI_SYSTEM_TABLE *SystemTable
205 );
206
207 /**
208 Function for 'parse' command.
209
210 @param[in] ImageHandle Handle to the Image (NULL if Internal).
211 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
212 **/
213 SHELL_STATUS
214 EFIAPI
215 ShellCommandRunParse (
216 IN EFI_HANDLE ImageHandle,
217 IN EFI_SYSTEM_TABLE *SystemTable
218 );
219
220 /**
221 Function for 'rm' command.
222
223 @param[in] ImageHandle Handle to the Image (NULL if Internal).
224 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
225 **/
226 SHELL_STATUS
227 EFIAPI
228 ShellCommandRunRm (
229 IN EFI_HANDLE ImageHandle,
230 IN EFI_SYSTEM_TABLE *SystemTable
231 );
232
233 /**
234 Function for 'mv' command.
235
236 @param[in] ImageHandle Handle to the Image (NULL if Internal).
237 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
238 **/
239 SHELL_STATUS
240 EFIAPI
241 ShellCommandRunMv (
242 IN EFI_HANDLE ImageHandle,
243 IN EFI_SYSTEM_TABLE *SystemTable
244 );
245
246 /**
247 returns a fully qualified directory (contains a map drive at the begining)
248 path from a unknown directory path.
249
250 If Path is already fully qualified this will return a duplicat otherwise this
251 will use get the current directory and use that to build the fully qualified
252 version.
253
254 if the return value is not NULL it must be caller freed.
255
256 @param[in] Path The unknown Path Value
257
258 @retval NULL A memory allocation failed
259 @retval NULL a fully qualified path could not be discovered.
260 @retval other pointer to a fuly qualified path.
261 **/
262 CHAR16*
263 EFIAPI
264 GetFullyQualifiedPath(
265 IN CONST CHAR16* Path
266 );
267
268 /**
269 Function to verify all intermediate directories in the path.
270
271 @param[in] Path The pointer to the path to fix.
272
273 @retval EFI_SUCCESS The operation was successful.
274 **/
275 EFI_STATUS
276 EFIAPI
277 VerifyIntermediateDirectories (
278 IN CONST CHAR16 *Path
279 );
280
281 /**
282 CaseInsensitive length limited string comparison.
283
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.
287
288 @retval 0 The strings are the same.
289 @return non-zero if the strings are different.
290 **/
291 CONST CHAR16*
292 EFIAPI
293 StrniCmp(
294 IN CONST CHAR16 *Source,
295 IN CONST CHAR16 *Target,
296 IN CONST UINTN Count
297 );