]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
Verify memory allocations were successful.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Cp.c
1 /** @file
2 Main file for cp shell level 2 function.
3
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "UefiShellLevel2CommandsLib.h"
16
17 // this is later in the file.
18 SHELL_STATUS
19 EFIAPI
20 ValidateAndCopyFiles(
21 IN CONST EFI_SHELL_FILE_INFO *FileList,
22 IN CONST CHAR16 *DestDir,
23 IN BOOLEAN SilentMode,
24 IN BOOLEAN RecursiveMode,
25 IN VOID **Resp
26 );
27
28 /**
29 Function to Copy one file to another location
30
31 If the destination exists the user will be prompted and the result put into *resp
32
33 @param[in] Source pointer to source file name
34 @param[in] Dest pointer to destination file name
35 @param[out] Resp pointer to response from question. Pass back on looped calling
36 @param[in] SilentMode whether to run in quiet mode or not
37
38 @retval SHELL_SUCCESS The source file was copied to the destination
39 **/
40 SHELL_STATUS
41 EFIAPI
42 CopySingleFile(
43 IN CONST CHAR16 *Source,
44 IN CONST CHAR16 *Dest,
45 OUT VOID **Resp,
46 IN BOOLEAN SilentMode
47 )
48 {
49 VOID *Response;
50 UINTN ReadSize;
51 SHELL_FILE_HANDLE SourceHandle;
52 SHELL_FILE_HANDLE DestHandle;
53 EFI_STATUS Status;
54 VOID *Buffer;
55 CHAR16 *TempName;
56 UINTN Size;
57 EFI_SHELL_FILE_INFO *List;
58 SHELL_STATUS ShellStatus;
59
60
61 ASSERT(Resp != NULL);
62
63 SourceHandle = NULL;
64 DestHandle = NULL;
65 Response = *Resp;
66 List = NULL;
67
68 ReadSize = PcdGet16(PcdShellFileOperationSize);
69 // Why bother copying a file to itself
70 if (StrCmp(Source, Dest) == 0) {
71 return (SHELL_SUCCESS);
72 }
73
74 //
75 // Open destination file without create
76 //
77 Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
78
79 //
80 // close file
81 //
82 if (DestHandle != NULL) {
83 ShellCloseFile(&DestHandle);
84 DestHandle = NULL;
85 }
86
87 //
88 // if the destination file existed check response and possibly prompt user
89 //
90 if (!EFI_ERROR(Status)) {
91 if (Response == NULL && !SilentMode) {
92 Status = ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_CP_PROMPT), gShellLevel2HiiHandle, &Response);
93 }
94 //
95 // possibly return based on response
96 //
97 if (!SilentMode) {
98 switch (*(SHELL_PROMPT_RESPONSE*)Response) {
99 case ShellPromptResponseNo:
100 //
101 // return success here so we dont stop the process
102 //
103 return (SHELL_SUCCESS);
104 case ShellPromptResponseCancel:
105 *Resp = Response;
106 //
107 // indicate to stop everything
108 //
109 return (SHELL_ABORTED);
110 case ShellPromptResponseAll:
111 *Resp = Response;
112 case ShellPromptResponseYes:
113 break;
114 default:
115 return SHELL_ABORTED;
116 }
117 }
118 }
119
120 if (ShellIsDirectory(Source) == EFI_SUCCESS) {
121 Status = ShellCreateDirectory(Dest, &DestHandle);
122 if (EFI_ERROR(Status)) {
123 return (SHELL_ACCESS_DENIED);
124 }
125
126 //
127 // Now copy all the files under the directory...
128 //
129 TempName = NULL;
130 Size = 0;
131 StrnCatGrow(&TempName, &Size, Source, 0);
132 StrnCatGrow(&TempName, &Size, L"\\*", 0);
133 ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
134 TempName = NULL;
135 StrnCatGrow(&TempName, &Size, Dest, 0);
136 StrnCatGrow(&TempName, &Size, L"\\", 0);
137 ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
138 ShellCloseFileMetaArg(&List);
139 FreePool(TempName);
140 Size = 0;
141 } else {
142 //
143 // open file with create enabled
144 //
145 Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
146 if (EFI_ERROR(Status)) {
147 return (SHELL_ACCESS_DENIED);
148 }
149
150 //
151 // open source file
152 //
153 Status = ShellOpenFileByName(Source, &SourceHandle, EFI_FILE_MODE_READ, 0);
154 ASSERT_EFI_ERROR(Status);
155
156 //
157 // copy data between files
158 //
159 Buffer = AllocateZeroPool(ReadSize);
160 ASSERT(Buffer != NULL);
161 while (ReadSize == PcdGet16(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
162 Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);
163 ASSERT_EFI_ERROR(Status);
164 Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
165 }
166 }
167
168 //
169 // close files
170 //
171 if (DestHandle != NULL) {
172 ShellCloseFile(&DestHandle);
173 DestHandle = NULL;
174 }
175 if (SourceHandle != NULL) {
176 ShellCloseFile(&SourceHandle);
177 SourceHandle = NULL;
178 }
179
180 //
181 // return
182 //
183 return (SHELL_SUCCESS);
184 }
185
186 /**
187 function to take a list of files to copy and a destination location and do
188 the verification and copying of those files to that location. This function
189 will report any errors to the user and halt.
190
191 The key is to have this function called ONLY once. this allows for the parameter
192 verification to happen correctly.
193
194 @param[in] FileList A LIST_ENTRY* based list of files to move
195 @param[in] DestDir the destination location
196
197 @retval SHELL_SUCCESS the files were all moved.
198 @retval SHELL_INVALID_PARAMETER a parameter was invalid
199 @retval SHELL_SECURITY_VIOLATION a security violation ocurred
200 @retval SHELL_WRITE_PROTECTED the destination was write protected
201 @retval SHELL_OUT_OF_RESOURCES a memory allocation failed
202 **/
203 SHELL_STATUS
204 EFIAPI
205 ValidateAndCopyFiles(
206 IN CONST EFI_SHELL_FILE_INFO *FileList,
207 IN CONST CHAR16 *DestDir,
208 IN BOOLEAN SilentMode,
209 IN BOOLEAN RecursiveMode,
210 IN VOID **Resp
211 )
212 {
213 CHAR16 *HiiOutput;
214 CHAR16 *HiiResultOk;
215 CONST EFI_SHELL_FILE_INFO *Node;
216 SHELL_STATUS ShellStatus;
217 CHAR16 *DestPath;
218 VOID *Response;
219 UINTN PathLen;
220 CONST CHAR16 *Cwd;
221 CONST CHAR16 *TempLocation;
222 UINTN NewSize;
223
224 if (Resp == NULL) {
225 Response = NULL;
226 } else {
227 Response = *Resp;
228 }
229
230 DestPath = NULL;
231 ShellStatus = SHELL_SUCCESS;
232 PathLen = 0;
233 Cwd = ShellGetCurrentDir(NULL);
234
235 ASSERT(FileList != NULL);
236 ASSERT(DestDir != NULL);
237
238 //
239 // If we are trying to copy multiple files... make sure we got a directory for the target...
240 //
241 if (EFI_ERROR(ShellIsDirectory(DestDir)) && FileList->Link.ForwardLink != FileList->Link.BackLink) {
242 //
243 // Error for destination not a directory
244 //
245 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, DestDir);
246 return (SHELL_INVALID_PARAMETER);
247 }
248 for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
249 ; !IsNull(&FileList->Link, &Node->Link)
250 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
251 ){
252 //
253 // skip the directory traversing stuff...
254 //
255 if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
256 continue;
257 }
258
259 NewSize = StrSize(DestDir);
260 NewSize += StrSize(Node->FileName);
261 NewSize += StrSize(Cwd);
262 if (NewSize > PathLen) {
263 PathLen = NewSize;
264 }
265
266 //
267 // Make sure got -r if required
268 //
269 if (!RecursiveMode && !EFI_ERROR(ShellIsDirectory(Node->FullName))) {
270 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_REQ), gShellLevel2HiiHandle);
271 return (SHELL_INVALID_PARAMETER);
272 }
273
274 //
275 // make sure got dest as dir if needed
276 //
277 if (!EFI_ERROR(ShellIsDirectory(Node->FullName)) && EFI_ERROR(ShellIsDirectory(DestDir))) {
278 //
279 // Error for destination not a directory
280 //
281 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, DestDir);
282 return (SHELL_INVALID_PARAMETER);
283 }
284 }
285
286 HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_CP_OUTPUT), NULL);
287 HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL);
288 DestPath = AllocatePool(PathLen);
289
290 if (HiiOutput == NULL || HiiOutput == NULL || HiiResultOk == NULL) {
291 SHELL_FREE_NON_NULL(DestPath);
292 SHELL_FREE_NON_NULL(HiiOutput);
293 SHELL_FREE_NON_NULL(HiiResultOk);
294 return (SHELL_OUT_OF_RESOURCES);
295 }
296
297 //
298 // Go through the list of files to copy...
299 //
300 for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
301 ; !IsNull(&FileList->Link, &Node->Link)
302 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
303 ){
304 if (ShellGetExecutionBreakFlag()) {
305 break;
306 }
307 ASSERT(Node->FileName != NULL);
308 ASSERT(Node->FullName != NULL);
309
310 //
311 // skip the directory traversing stuff...
312 //
313 if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
314 continue;
315 }
316
317 if (FileList->Link.ForwardLink == FileList->Link.BackLink // 1 item
318 && EFI_ERROR(ShellIsDirectory(DestDir)) // not an existing directory
319 ) {
320 ASSERT(StrStr(DestDir, L":") == NULL);
321 //
322 // simple copy of a single file
323 //
324 StrCpy(DestPath, Cwd);
325 if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {
326 StrCat(DestPath, L"\\");
327 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') {
328 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
329 }
330 StrCat(DestPath, DestDir);
331 } else {
332 //
333 // we have multiple files or a directory in the DestDir
334 //
335 if (StrStr(DestDir, L":") == NULL) {
336 StrCpy(DestPath, Cwd);
337 if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') {
338 StrCat(DestPath, L"\\");
339 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') {
340 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
341 }
342 StrCat(DestPath, DestDir);
343 if (DestDir[StrLen(DestDir)-1] != L'\\' && Node->FileName[0] != L'\\') {
344 StrCat(DestPath, L"\\");
345 } else if (DestDir[StrLen(DestDir)-1] == L'\\' && Node->FileName[0] == L'\\') {
346 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
347 }
348 StrCat(DestPath, Node->FileName);
349
350 } else {
351 StrCpy(DestPath, DestDir);
352 if (DestDir[StrLen(DestDir)-1] != L'\\' && Node->FileName[0] != L'\\') {
353 StrCat(DestPath, L"\\");
354 } else if (DestDir[StrLen(DestDir)-1] == L'\\' && Node->FileName[0] == L'\\') {
355 ((CHAR16*)DestDir)[StrLen(DestDir)-1] = CHAR_NULL;
356 }
357 StrCat(DestPath, Node->FileName);
358 }
359 }
360
361 //
362 // Make sure the path exists
363 //
364 if (EFI_ERROR(VerifyIntermediateDirectories(DestPath))) {
365 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_WNF), gShellLevel2HiiHandle);
366 ShellStatus = SHELL_DEVICE_ERROR;
367 break;
368 }
369
370 if ( !EFI_ERROR(ShellIsDirectory(Node->FullName))
371 && !EFI_ERROR(ShellIsDirectory(DestPath))
372 && StrniCmp(Node->FullName, DestPath, StrLen(DestPath)) == NULL
373 ){
374 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle);
375 ShellStatus = SHELL_INVALID_PARAMETER;
376 break;
377 }
378 if (StringNoCaseCompare(&Node->FullName, &DestPath) == 0) {
379 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle);
380 ShellStatus = SHELL_INVALID_PARAMETER;
381 break;
382 }
383
384 if ((TempLocation = StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName))) == 0
385 && (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\')
386 ) {
387 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle);
388 ShellStatus = SHELL_INVALID_PARAMETER;
389 break;
390 }
391
392 CleanPath(DestPath);
393
394 ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath);
395
396 //
397 // copy single file...
398 //
399 ShellStatus = CopySingleFile(Node->FullName, DestPath, &Response, SilentMode);
400 if (ShellStatus != SHELL_SUCCESS) {
401 break;
402 }
403 }
404 if (ShellStatus == SHELL_SUCCESS && Resp == NULL) {
405 ShellPrintEx(-1, -1, L"%s", HiiResultOk);
406 }
407
408 SHELL_FREE_NON_NULL(DestPath);
409 SHELL_FREE_NON_NULL(HiiOutput);
410 SHELL_FREE_NON_NULL(HiiResultOk);
411 if (Resp != NULL) {
412 SHELL_FREE_NON_NULL(Response);
413 }
414
415 return (ShellStatus);
416 }
417
418 SHELL_STATUS
419 EFIAPI
420 ProcessValidateAndCopyFiles(
421 IN EFI_SHELL_FILE_INFO *FileList,
422 IN CONST CHAR16 *DestDir,
423 IN BOOLEAN SilentMode,
424 IN BOOLEAN RecursiveMode
425 )
426 {
427 SHELL_STATUS ShellStatus;
428 EFI_SHELL_FILE_INFO *List;
429 EFI_STATUS Status;
430 EFI_FILE_INFO *FileInfo;
431
432 List = NULL;
433
434 Status = ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List);
435 if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) {
436 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, DestDir);
437 ShellStatus = SHELL_INVALID_PARAMETER;
438 ShellCloseFileMetaArg(&List);
439 } else if (List != NULL) {
440 ASSERT(List != NULL);
441 ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL);
442 ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL);
443 FileInfo = NULL;
444 FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle);
445 ASSERT(FileInfo != NULL);
446 if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) == 0) {
447 ShellStatus = ValidateAndCopyFiles(FileList, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, SilentMode, RecursiveMode, NULL);
448 } else {
449 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle);
450 ShellStatus = SHELL_ACCESS_DENIED;
451 }
452 SHELL_FREE_NON_NULL(FileInfo);
453 ShellCloseFileMetaArg(&List);
454 } else {
455 ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL);
456 }
457
458 return (ShellStatus);
459 }
460
461 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
462 {L"-r", TypeFlag},
463 {L"-q", TypeFlag},
464 {NULL, TypeMax}
465 };
466
467 /**
468 Function for 'cp' command.
469
470 @param[in] ImageHandle Handle to the Image (NULL if Internal).
471 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
472 **/
473 SHELL_STATUS
474 EFIAPI
475 ShellCommandRunCp (
476 IN EFI_HANDLE ImageHandle,
477 IN EFI_SYSTEM_TABLE *SystemTable
478 )
479 {
480 EFI_STATUS Status;
481 LIST_ENTRY *Package;
482 CHAR16 *ProblemParam;
483 SHELL_STATUS ShellStatus;
484 UINTN ParamCount;
485 UINTN LoopCounter;
486 EFI_SHELL_FILE_INFO *FileList;
487 BOOLEAN SilentMode;
488 BOOLEAN RecursiveMode;
489 CONST CHAR16 *Cwd;
490
491 ProblemParam = NULL;
492 ShellStatus = SHELL_SUCCESS;
493 ParamCount = 0;
494 FileList = NULL;
495
496 //
497 // initialize the shell lib (we must be in non-auto-init...)
498 //
499 Status = ShellInitialize();
500 ASSERT_EFI_ERROR(Status);
501
502 Status = CommandInit();
503 ASSERT_EFI_ERROR(Status);
504
505 //
506 // parse the command line
507 //
508 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
509 if (EFI_ERROR(Status)) {
510 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
511 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ProblemParam);
512 FreePool(ProblemParam);
513 ShellStatus = SHELL_INVALID_PARAMETER;
514 } else {
515 ASSERT(FALSE);
516 }
517 } else {
518 //
519 // check for "-?"
520 //
521 if (ShellCommandLineGetFlag(Package, L"-?")) {
522 ASSERT(FALSE);
523 }
524
525 //
526 // Initialize SilentMode and RecursiveMode
527 //
528 if (gEfiShellProtocol->BatchIsActive()) {
529 SilentMode = TRUE;
530 } else {
531 SilentMode = ShellCommandLineGetFlag(Package, L"-q");
532 }
533 RecursiveMode = ShellCommandLineGetFlag(Package, L"-r");
534
535 switch (ParamCount = ShellCommandLineGetCount(Package)) {
536 case 0:
537 case 1:
538 //
539 // we have insufficient parameters
540 //
541 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle);
542 ShellStatus = SHELL_INVALID_PARAMETER;
543 break;
544 case 2:
545 //
546 // must have valid CWD for single parameter...
547 //
548 Cwd = ShellGetCurrentDir(NULL);
549 if (Cwd == NULL){
550 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle);
551 ShellStatus = SHELL_INVALID_PARAMETER;
552 } else {
553 Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
554 if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
555 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, ShellCommandLineGetRawValue(Package, 1));
556 ShellStatus = SHELL_NOT_FOUND;
557 } else {
558 ShellStatus = ProcessValidateAndCopyFiles(FileList, Cwd, SilentMode, RecursiveMode);
559 }
560 }
561
562 break;
563 default:
564 //
565 // Make a big list of all the files...
566 //
567 for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount && ShellStatus == SHELL_SUCCESS ; LoopCounter++) {
568 if (ShellGetExecutionBreakFlag()) {
569 break;
570 }
571 Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
572 if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) {
573 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, ShellCommandLineGetRawValue(Package, 1));
574 ShellStatus = SHELL_NOT_FOUND;
575 }
576 }
577 //
578 // now copy them all...
579 //
580 if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
581 ShellStatus = ProcessValidateAndCopyFiles(FileList, ShellCommandCleanPath((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)), SilentMode, RecursiveMode);
582 Status = ShellCloseFileMetaArg(&FileList);
583 if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
584 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, ShellCommandLineGetRawValue(Package, 1), ShellStatus|MAX_BIT);
585 ShellStatus = SHELL_ACCESS_DENIED;
586 }
587 }
588
589 break;
590 } // switch on parameter count
591
592 if (FileList != NULL) {
593 ShellCloseFileMetaArg(&FileList);
594 }
595
596 //
597 // free the command line package
598 //
599 ShellCommandLineFreeVarList (Package);
600 }
601
602 if (ShellGetExecutionBreakFlag()) {
603 return (SHELL_ABORTED);
604 }
605
606 return (ShellStatus);
607 }
608