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