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