14#define INIT_NAME_BUFFER_SIZE 128
30 IN SHELL_FILE_HANDLE FileHandle
58 Status =
gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevicePathCopy, &Handle);
60 if ((Handle !=
NULL) && (!EFI_ERROR (Status))) {
88 Status =
gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
90 if ((Handle !=
NULL) && (!EFI_ERROR (Status))) {
126 if (Mapping ==
NULL) {
127 return (EFI_INVALID_PARAMETER);
130 if (Mapping[
StrLen (Mapping)-1] !=
':') {
131 return (EFI_INVALID_PARAMETER);
137 if (DevicePath ==
NULL) {
139 return (EFI_NOT_FOUND);
149 SHELL_FREE_NON_NULL (MapListNode->DevicePath);
150 SHELL_FREE_NON_NULL (MapListNode->MapName);
151 SHELL_FREE_NON_NULL (MapListNode->CurrentDirectoryPath);
160 return (EFI_NOT_FOUND);
170 return (EFI_INVALID_PARAMETER);
177 if ((Status !=
EFI_SUCCESS) && (Status != EFI_NOT_FOUND)) {
216 if (Mapping[
StrLen (Mapping)-1] != L
':') {
224 if (MapListItem !=
NULL) {
225 return (MapListItem->DevicePath);
258 CHAR16 *PathForReturn;
267 if ((DevicePath ==
NULL) || (*DevicePath ==
NULL)) {
271 PathForReturn =
NULL;
283 ASSERT ((PathForReturn ==
NULL && PathSize == 0) || (PathForReturn !=
NULL));
285 PathForReturn =
StrnCatGrow (&PathForReturn, &PathSize, L
";", 0);
288 PathForReturn =
StrnCatGrow (&PathForReturn, &PathSize, Node->MapName, 0);
292 if (PathForReturn !=
NULL) {
386 CHAR16 *PathForReturn;
394 PathForReturn =
NULL;
398 ASSERT (DevicePathCopy !=
NULL);
399 if (DevicePathCopy ==
NULL) {
404 Status =
gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle);
406 if (EFI_ERROR (Status)) {
419 ASSERT (MapPathCopy !=
NULL);
421 Status =
gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
422 if (MapHandle == PathHandle) {
423 ASSERT ((PathForReturn ==
NULL && PathSize == 0) || (PathForReturn !=
NULL));
424 PathForReturn =
StrnCatGrow (&PathForReturn, &PathSize, MapListItem->MapName, 0);
439 if (PathForReturn !=
NULL) {
449 ASSERT ((PathForReturn ==
NULL && PathSize == 0) || (PathForReturn !=
NULL));
452 if (AlignedNode ==
NULL) {
453 if (PathForReturn !=
NULL) {
466 if ((PathSize != 0) &&
467 (PathForReturn !=
NULL) &&
468 (PathForReturn[PathSize /
sizeof (CHAR16) - 1] != L
'\\') &&
469 (AlignedNode->
PathName[0] != L
'\\'))
471 PathForReturn =
StrnCatGrow (&PathForReturn, &PathSize, L
"\\", 1);
479 if (PathForReturn !=
NULL) {
484 return (PathForReturn);
532 if (NewPath ==
NULL) {
536 StrCpyS (NewPath, Size/
sizeof (CHAR16), Cwd);
537 StrCatS (NewPath, Size/
sizeof (CHAR16), L
"\\");
538 if (*Path == L
'\\') {
544 StrCatS (NewPath, Size/
sizeof (CHAR16), Path);
547 return (DevicePathForReturn);
554 ASSERT ((MapName ==
NULL && Size == 0) || (MapName !=
NULL));
556 if ((MapName ==
NULL) || (MapName[
StrLen (MapName)-1] != L
':')) {
564 if (DevicePath ==
NULL) {
575 if (DevicePathCopy ==
NULL) {
584 Status =
gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
585 if (EFI_ERROR (Status)) {
586 if (DevicePathCopyForFree !=
NULL) {
597 if ((*(Path+
StrLen (MapName)) != CHAR_NULL) &&
598 (*(Path+
StrLen (MapName)+1) == CHAR_NULL))
606 if (DevicePathCopyForFree !=
NULL) {
610 return (DevicePathForReturn);
653 IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
655 OUT CHAR16 **BestDeviceName
664 CHAR16 *DeviceNameToReturn;
666 UINTN ParentControllerCount;
668 UINTN ParentDriverCount;
671 if ((BestDeviceName ==
NULL) ||
672 (DeviceHandle ==
NULL)
675 return (EFI_INVALID_PARAMETER);
681 if (((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) == 0) &&
682 ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) == 0))
684 return (EFI_INVALID_PARAMETER);
687 DeviceNameToReturn =
NULL;
688 *BestDeviceName =
NULL;
693 if ((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) != 0) {
697 HR_DRIVER_BINDING_HANDLE|HR_DEVICE_DRIVER,
701 for (LoopVar = 0; LoopVar < HandleCount; LoopVar++) {
705 Status =
gBS->OpenProtocol (
707 &gEfiComponentName2ProtocolGuid,
711 EFI_OPEN_PROTOCOL_GET_PROTOCOL
713 if (EFI_ERROR (Status)) {
714 Status =
gBS->OpenProtocol (
716 &gEfiComponentNameProtocolGuid,
720 EFI_OPEN_PROTOCOL_GET_PROTOCOL
724 if (EFI_ERROR (Status)) {
733 Status = CompName2->GetControllerName (CompName2, DeviceHandle,
NULL, Lang, &DeviceNameToReturn);
736 if (!EFI_ERROR (Status) && (DeviceNameToReturn !=
NULL)) {
741 if (HandleList !=
NULL) {
749 if ((DeviceNameToReturn ==
NULL) && !EFI_ERROR (Status)) {
750 for (LoopVar = 0; LoopVar < ParentControllerCount; LoopVar++) {
752 if (!EFI_ERROR (Status)) {
753 for (HandleCount = 0; HandleCount < ParentDriverCount; HandleCount++) {
757 Status =
gBS->OpenProtocol (
758 ParentDriverBuffer[HandleCount],
759 &gEfiComponentName2ProtocolGuid,
763 EFI_OPEN_PROTOCOL_GET_PROTOCOL
765 if (EFI_ERROR (Status)) {
766 Status =
gBS->OpenProtocol (
767 ParentDriverBuffer[HandleCount],
768 &gEfiComponentNameProtocolGuid,
772 EFI_OPEN_PROTOCOL_GET_PROTOCOL
776 if (EFI_ERROR (Status)) {
785 Status = CompName2->GetControllerName (CompName2, ParentControllerBuffer[LoopVar], DeviceHandle, Lang, &DeviceNameToReturn);
788 if (!EFI_ERROR (Status) && (DeviceNameToReturn !=
NULL)) {
793 SHELL_FREE_NON_NULL (ParentDriverBuffer);
794 if (!EFI_ERROR (Status) && (DeviceNameToReturn !=
NULL)) {
800 SHELL_FREE_NON_NULL (ParentControllerBuffer);
806 if (DeviceNameToReturn !=
NULL) {
807 ASSERT (BestDeviceName !=
NULL);
813 if ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) != 0) {
814 Status =
gBS->OpenProtocol (
816 &gEfiDevicePathProtocolGuid,
817 (VOID **)&DevicePath,
820 EFI_OPEN_PROTOCOL_GET_PROTOCOL
822 if (!EFI_ERROR (Status)) {
834 return (EFI_NOT_FOUND);
857 OUT SHELL_FILE_HANDLE *FileHandle
868 Status =
gBS->OpenProtocol (
870 &gEfiSimpleFileSystemProtocolGuid,
871 (VOID **)&SimpleFileSystem,
874 EFI_OPEN_PROTOCOL_GET_PROTOCOL
876 if (EFI_ERROR (Status)) {
877 return (EFI_NOT_FOUND);
880 Status =
gBS->OpenProtocol (
882 &gEfiDevicePathProtocolGuid,
886 EFI_OPEN_PROTOCOL_GET_PROTOCOL
888 if (EFI_ERROR (Status)) {
889 return (EFI_NOT_FOUND);
895 Status = SimpleFileSystem->OpenVolume (SimpleFileSystem, &RealFileHandle);
896 if (EFI_ERROR (Status)) {
925 OUT SHELL_FILE_HANDLE *FileHandle
931 if (FileHandle ==
NULL) {
932 return (EFI_INVALID_PARAMETER);
939 Status =
gBS->LocateDevicePath (
940 &gEfiSimpleFileSystemProtocolGuid,
944 if (EFI_ERROR (Status)) {
945 return (EFI_NOT_FOUND);
987 OUT SHELL_FILE_HANDLE *FileHandle,
989 IN UINT64 Attributes OPTIONAL
995 SHELL_FILE_HANDLE ShellHandle;
1000 if (FileHandle ==
NULL) {
1001 return (EFI_INVALID_PARAMETER);
1009 FilePathNode =
NULL;
1014 if (!EFI_ERROR (Status)) {
1016 if (Handle1 !=
NULL) {
1021 Status =
gBS->LocateDevicePath (
1022 &gEfiSimpleFileSystemProtocolGuid,
1026 if (!EFI_ERROR (Status)) {
1037 SHELL_FREE_NON_NULL (AlignedNode);
1042 if ((
DevicePathType (&FilePathNode->Header) != MEDIA_DEVICE_PATH) ||
1046 Status = EFI_UNSUPPORTED;
1060 Status = Handle2->Open (
1077 Status = Handle2->Open (
1081 OpenMode &~EFI_FILE_MODE_CREATE,
1088 if ((EFI_ERROR (Status)) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)) {
1089 Status = Handle2->Open (
1102 ShellInfoObject.NewEfiShellProtocol->CloseFile (Handle2);
1107 if (EFI_ERROR (Status)) {
1115 SHELL_FREE_NON_NULL (AlignedNode);
1116 if (EFI_ERROR (Status)) {
1117 if (Handle1 !=
NULL) {
1118 ShellInfoObject.NewEfiShellProtocol->CloseFile (Handle1);
1167 IN UINT64 FileAttribs,
1168 OUT SHELL_FILE_HANDLE *FileHandle
1179 if (
StrStr (FileName, L
">v") == FileName) {
1181 if (EFI_ERROR (Status)) {
1186 return (EFI_INVALID_PARAMETER);
1197 if (DevicePath ==
NULL) {
1198 return (EFI_NOT_FOUND);
1201 Status =
InternalOpenFileDevicePath (DevicePath, FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, FileAttribs);
1290 OUT SHELL_FILE_HANDLE *FileHandle,
1303 if (
StrCmp (FileName, L
">i") == 0) {
1307 if ((OpenMode & EFI_FILE_MODE_WRITE) != 0) {
1308 return (EFI_INVALID_PARAMETER);
1311 *FileHandle = ShellInfoObject.NewShellParametersProtocol->
StdIn;
1312 ASSERT (*FileHandle !=
NULL);
1319 if (
StrCmp (FileName, L
">o") == 0) {
1323 if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
1324 return (EFI_INVALID_PARAMETER);
1334 if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)FileName, L
"NUL") == 0) ||
1335 (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)FileName, L
"NULL") == 0))
1344 if (
StrCmp (FileName, L
">e") == 0) {
1348 if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
1349 return (EFI_INVALID_PARAMETER);
1360 if (
StrStr (FileName, L
">v") == FileName) {
1362 if (EFI_ERROR (Status)) {
1367 ((OpenMode & EFI_FILE_MODE_WRITE) != 0))
1369 return (EFI_INVALID_PARAMETER);
1381 if (DevicePath ==
NULL) {
1382 return (EFI_NOT_FOUND);
1411 SHELL_FILE_HANDLE FileHandle;
1424 if (EFI_ERROR (Status)) {
1432 return (ShellInfoObject.NewEfiShellProtocol->DeleteFile (FileHandle));
1444 ShellInfoObject.PageBreakEnabled =
FALSE;
1456 ShellInfoObject.PageBreakEnabled =
TRUE;
1485 IN CONST CHAR16 *CommandLine OPTIONAL,
1486 IN CONST CHAR16 **Environment OPTIONAL,
1502 if (ParentImageHandle ==
NULL) {
1503 return (EFI_INVALID_PARAMETER);
1512 if (NewCmdLine ==
NULL) {
1513 return EFI_OUT_OF_RESOURCES;
1516 for (Walker = NewCmdLine; Walker !=
NULL && *Walker != CHAR_NULL; Walker++) {
1517 if ((*Walker == L
'^') && (*(Walker+1) == L
'#')) {
1518 CopyMem (Walker, Walker+1,
StrSize (Walker) -
sizeof (Walker[0]));
1526 Status =
gBS->LoadImage (
1535 if (EFI_ERROR (Status)) {
1536 if (NewHandle !=
NULL) {
1537 gBS->UnloadImage (NewHandle);
1544 Status =
gBS->OpenProtocol (
1546 &gEfiLoadedImageProtocolGuid,
1547 (VOID **)&LoadedImage,
1550 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1553 if (!EFI_ERROR (Status)) {
1569 if (NewCmdLine !=
NULL) {
1577 if (Environment !=
NULL) {
1579 if (!EFI_ERROR (Status)) {
1587 ShellParamsProtocol.
StdIn = ShellInfoObject.NewShellParametersProtocol->
StdIn;
1588 ShellParamsProtocol.
StdOut = ShellInfoObject.NewShellParametersProtocol->
StdOut;
1589 ShellParamsProtocol.
StdErr = ShellInfoObject.NewShellParametersProtocol->
StdErr;
1591 if (EFI_ERROR (Status)) {
1605 if (ImagePath !=
NULL) {
1606 if (ShellParamsProtocol.
Argv ==
NULL) {
1610 if (ShellParamsProtocol.
Argv ==
NULL) {
1611 Status = EFI_OUT_OF_RESOURCES;
1615 ShellParamsProtocol.
Argc = 1;
1621 ShellParamsProtocol.
Argv[0] = ImagePath;
1624 Status =
gBS->InstallProtocolInterface (&NewHandle, &gEfiShellParametersProtocolGuid,
EFI_NATIVE_INTERFACE, &ShellParamsProtocol);
1632 if (!EFI_ERROR (Status)) {
1633 StartStatus =
gBS->StartImage (
1638 if (StartImageStatus !=
NULL) {
1639 *StartImageStatus = StartStatus;
1642 CleanupStatus =
gBS->UninstallProtocolInterface (
1644 &gEfiShellParametersProtocolGuid,
1645 &ShellParamsProtocol
1654 gBS->UnloadImage (NewHandle);
1658 if (ShellParamsProtocol.
Argv !=
NULL) {
1659 for (Index = 0; Index < ShellParamsProtocol.
Argc; Index++) {
1660 if (ShellParamsProtocol.
Argv[Index] !=
NULL) {
1701 IN CONST CHAR16 *CommandLine OPTIONAL,
1702 IN CONST CHAR16 **Environment OPTIONAL,
1715 if (Environment !=
NULL) {
1717 if (!EFI_ERROR (Status)) {
1757 if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.
NoNest) {
1761 if (Status == EFI_BUFFER_TOO_SMALL) {
1777 SHELL_FREE_NON_NULL (Temp);
1778 SHELL_FREE_NON_NULL (Temp2);
1820 IN CHAR16 *CommandLine OPTIONAL,
1821 IN CHAR16 **Environment OPTIONAL,
1830 if ((
PcdGet8 (PcdShellSupportLevel) < 1)) {
1831 return (EFI_UNSUPPORTED);
1837 if (DevPath ==
NULL) {
1838 return EFI_OUT_OF_RESOURCES;
1852 if (DevPath !=
NULL) {
1864 ASSERT ((Temp ==
NULL && Size == 0) || (Temp !=
NULL));
1865 StrnCatGrow (&Temp, &Size, L
"Shell.efi -exit ", 0);
1872 (
CONST CHAR16 **)Environment,
1883 (
CONST CHAR16 *)CommandLine,
1884 (
CONST CHAR16 **)Environment,
1905 if (FileListNode->Info !=
NULL) {
1906 FreePool ((VOID *)FileListNode->Info);
1909 if (FileListNode->FileName !=
NULL) {
1910 FreePool ((VOID *)FileListNode->FileName);
1913 if (FileListNode->FullName !=
NULL) {
1914 FreePool ((VOID *)FileListNode->FullName);
1917 if (FileListNode->Handle !=
NULL) {
1918 ShellInfoObject.NewEfiShellProtocol->CloseFile (FileListNode->Handle);
1944 if ((FileList ==
NULL) || (*FileList ==
NULL)) {
1945 return (EFI_INVALID_PARAMETER);
1984 if ((FileList ==
NULL) || (*FileList ==
NULL)) {
1985 return (EFI_INVALID_PARAMETER);
1991 ShellSortFileListByFullName
1993 if (!EFI_ERROR (Status)) {
2003 ; !
IsNull (&(*FileList)->Link, &ShellFileListItem->
Link)
2008 ; !
IsNull (&(*FileList)->Link, &ShellFileListItem2->
Link)
2012 if (gUnicodeCollation->StriColl (
2014 (CHAR16 *)ShellFileListItem->
FullName,
2015 (CHAR16 *)ShellFileListItem2->
FullName
2021 &ShellFileListItem2->
Link
2027 ShellFileListItem2 = TempNode;
2070 if (NewNode ==
NULL) {
2082 SHELL_FREE_NON_NULL (NewNode->
FullName);
2083 SHELL_FREE_NON_NULL (NewNode->
FileName);
2084 SHELL_FREE_NON_NULL (NewNode->
Info);
2085 SHELL_FREE_NON_NULL (NewNode);
2089 NewNode->
Status = Node->Status;
2090 NewNode->
Handle = Node->Handle;
2092 Node->Handle =
NULL;
2116 IN CONST SHELL_FILE_HANDLE Handle,
2128 if (ShellFileListItem ==
NULL) {
2132 if ((Info !=
NULL) && (Info->Size != 0)) {
2134 if (ShellFileListItem->
Info ==
NULL) {
2144 if (FileName !=
NULL) {
2145 ASSERT (TempString ==
NULL);
2158 if (BasePath !=
NULL) {
2159 ASSERT ((TempString ==
NULL && Size == 0) || (TempString !=
NULL));
2160 TempString =
StrnCatGrow (&TempString, &Size, BasePath, 0);
2161 if (TempString ==
NULL) {
2163 SHELL_FREE_NON_NULL (ShellFileListItem->
Info);
2170 ASSERT ((TempString ==
NULL && Size == 0) || (TempString !=
NULL));
2172 if (TempString ==
NULL) {
2182 ShellFileListItem->
FullName = TempString;
2183 ShellFileListItem->
Status = Status;
2184 ShellFileListItem->
Handle = Handle;
2186 return (ShellFileListItem);
2206 IN SHELL_FILE_HANDLE FileDirHandle,
2222 if (EFI_ERROR (Status)) {
2230 if (TempString ==
NULL) {
2231 SHELL_FREE_NON_NULL (BasePath);
2232 return (EFI_OUT_OF_RESOURCES);
2235 TempSpot =
StrStr (TempString, L
";");
2237 if (TempSpot !=
NULL) {
2238 *TempSpot = CHAR_NULL;
2241 TempString =
StrnCatGrow (&TempString, &Size, BasePath, 0);
2242 if (TempString ==
NULL) {
2243 SHELL_FREE_NON_NULL (BasePath);
2244 return (EFI_OUT_OF_RESOURCES);
2247 SHELL_FREE_NON_NULL (BasePath);
2248 BasePath = TempString;
2252 ShellFileList =
NULL;
2253 ShellFileListItem =
NULL;
2258 ; !EFI_ERROR (Status) && !NoFile
2262 if (ShellFileList ==
NULL) {
2264 if (ShellFileList ==
NULL) {
2265 SHELL_FREE_NON_NULL (BasePath);
2266 return EFI_OUT_OF_RESOURCES;
2282 if (ShellFileListItem ==
NULL) {
2283 Status = EFI_OUT_OF_RESOURCES;
2293 if (EFI_ERROR (Status)) {
2297 *FileList = ShellFileList;
2300 SHELL_FREE_NON_NULL (BasePath);
2331 if ((Guid ==
NULL) || (GuidName ==
NULL)) {
2332 return (EFI_INVALID_PARAMETER);
2337 if (!EFI_ERROR (Status)) {
2370 if ((Guid ==
NULL) || (GuidName ==
NULL)) {
2371 return (EFI_INVALID_PARAMETER);
2375 if ((Name ==
NULL) || (
StrLen (Name) == 0)) {
2376 SHELL_FREE_NON_NULL (Name);
2377 return (EFI_NOT_FOUND);
2411 IN SHELL_FILE_HANDLE FileHandle,
2418 CONST CHAR16 *NextFilePatternStart;
2419 CHAR16 *CurrentFilePattern;
2425 CHAR16 *NewFullName;
2428 NewShellNode =
NULL;
2430 if ( (FilePattern ==
NULL)
2431 || (UnicodeCollation ==
NULL)
2432 || (FileList ==
NULL)
2435 return (EFI_INVALID_PARAMETER);
2439 CurrentFilePattern =
NULL;
2441 if (*FilePattern == L
'\\') {
2445 for ( NextFilePatternStart = FilePattern
2446 ; *NextFilePatternStart != CHAR_NULL && *NextFilePatternStart != L
'\\'
2447 ; NextFilePatternStart++)
2451 CurrentFilePattern =
AllocateZeroPool ((NextFilePatternStart-FilePattern+1)*
sizeof (CHAR16));
2452 if (CurrentFilePattern ==
NULL) {
2453 return EFI_OUT_OF_RESOURCES;
2456 StrnCpyS (CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern, NextFilePatternStart-FilePattern);
2458 if ( (CurrentFilePattern[0] == CHAR_NULL)
2459 && (NextFilePatternStart[0] == CHAR_NULL)
2465 if (ParentNode ==
NULL) {
2488 if (NewShellNode ==
NULL) {
2489 Status = EFI_OUT_OF_RESOURCES;
2492 if (*FileList ==
NULL) {
2507 if (!EFI_ERROR (Status)) {
2508 if (
StrStr (NextFilePatternStart, L
"\\") !=
NULL) {
2519 if (UnicodeCollation->MetaiMatch (UnicodeCollation, (CHAR16 *)ShellInfoNode->
FileName, CurrentFilePattern)) {
2523 if (NewFullName ==
NULL) {
2524 Status = EFI_OUT_OF_RESOURCES;
2526 StrCpyS (NewFullName, Size /
sizeof (CHAR16), MapName);
2527 StrCatS (NewFullName, Size /
sizeof (CHAR16), ShellInfoNode->
FullName);
2529 ShellInfoNode->
FullName = NewFullName;
2548 if (EFI_ERROR (Status)) {
2560 Status =
ShellSearchHandle (NextFilePatternStart, UnicodeCollation, ShellInfoNode->
Handle, FileList, ShellInfoNode, MapName);
2564 }
else if (!EFI_ERROR (Status)) {
2573 if (NewShellNode ==
NULL) {
2574 Status = EFI_OUT_OF_RESOURCES;
2577 if (*FileList ==
NULL) {
2589 if (EFI_ERROR (Status)) {
2594 if (EFI_ERROR (Status)) {
2603 Status = EFI_NOT_FOUND;
2644 CHAR16 *PatternCopy;
2645 CHAR16 *PatternCurrentLocation;
2647 SHELL_FILE_HANDLE RootFileHandle;
2651 if ( (FilePattern ==
NULL)
2652 || (FileList ==
NULL)
2656 return (EFI_INVALID_PARAMETER);
2660 RootDevicePath =
NULL;
2661 RootFileHandle =
NULL;
2664 if (PatternCopy ==
NULL) {
2665 return (EFI_OUT_OF_RESOURCES);
2669 if (PatternCopy ==
NULL) {
2670 return (EFI_OUT_OF_RESOURCES);
2673 Count =
StrStr (PatternCopy, L
":") - PatternCopy + 1;
2674 ASSERT (Count <=
StrLen (PatternCopy));
2676 ASSERT (MapName ==
NULL);
2678 if (MapName ==
NULL) {
2679 Status = EFI_OUT_OF_RESOURCES;
2682 if (RootDevicePath ==
NULL) {
2683 Status = EFI_INVALID_PARAMETER;
2686 if (!EFI_ERROR (Status)) {
2687 for ( PatternCurrentLocation = PatternCopy
2688 ; *PatternCurrentLocation !=
':'
2689 ; PatternCurrentLocation++)
2693 PatternCurrentLocation++;
2694 Status =
ShellSearchHandle (PatternCurrentLocation, gUnicodeCollation, RootFileHandle, FileList,
NULL, MapName);
2702 SHELL_FREE_NON_NULL (PatternCopy);
2703 SHELL_FREE_NON_NULL (MapName);
2735 CONST CHAR16 *CurDir;
2743 if ((FileList ==
NULL) || (*FileList ==
NULL)) {
2744 return (EFI_INVALID_PARAMETER);
2747 if ((*Path == L
'.') && (*(Path+1) == L
'\\')) {
2756 if (CurDir ==
NULL) {
2757 return EFI_NOT_FOUND;
2760 ASSERT ((Path2 ==
NULL && Path2Size == 0) || (Path2 !=
NULL));
2763 if (*Path == L
'\\') {
2769 ASSERT ((Path2 ==
NULL && Path2Size == 0) || (Path2 !=
NULL));
2772 ASSERT (Path2 ==
NULL);
2785 if (EFI_ERROR (Status)) {
2794 ; !
IsNull (&(*FileList)->Link, &ShellFileListItem->
Link)
2798 if ((ShellFileListItem->
Status == 0) && (ShellFileListItem->
Handle ==
NULL)) {
2805 return (EFI_NOT_FOUND);
2837 OUT UINT32 *Attributes OPTIONAL
2844 CHAR16 *CurrentWriteLocation;
2854 ; !
IsNull (&gShellEnvVarList.Link, &Node->Link)
2858 ASSERT (Node->Key !=
NULL);
2862 Size += 2*
sizeof (CHAR16);
2865 if (Buffer ==
NULL) {
2869 CurrentWriteLocation = (CHAR16 *)Buffer;
2872 ; !
IsNull (&gShellEnvVarList.Link, &Node->Link)
2876 ASSERT (Node->Key !=
NULL);
2878 CurrentWriteLocation,
2879 (Size)/
sizeof (CHAR16) - (CurrentWriteLocation - ((CHAR16 *)Buffer)),
2882 CurrentWriteLocation +=
StrLen (CurrentWriteLocation) + 1;
2890 if (EFI_ERROR (Status)) {
2895 if (Status == EFI_BUFFER_TOO_SMALL) {
2900 if (Buffer ==
NULL) {
2911 if (EFI_ERROR (Status)) {
2912 if (Buffer !=
NULL) {
2987 if ((Value ==
NULL) || (
StrLen (Value) == 0)) {
2989 if (!EFI_ERROR (Status)) {
3000 if (!EFI_ERROR (Status)) {
3004 if (EFI_ERROR (Status)) {
3042 if ((Name ==
NULL) || (*Name == CHAR_NULL)) {
3043 return (EFI_INVALID_PARAMETER);
3049 if ((
StrCmp (Name, L
"cwd") == 0) ||
3050 (
StrCmp (Name, L
"lasterror") == 0) ||
3051 (
StrCmp (Name, L
"profiles") == 0) ||
3052 (
StrCmp (Name, L
"uefishellsupport") == 0) ||
3053 (
StrCmp (Name, L
"uefishellversion") == 0) ||
3054 (
StrCmp (Name, L
"uefiversion") == 0) ||
3055 (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.
NoNest &&
3056 (
StrCmp (Name, mNoNestingEnvVarName) == 0))
3059 return (EFI_INVALID_PARAMETER);
3084 IN CONST CHAR16 *FileSystemMapping OPTIONAL
3087 CHAR16 *PathToReturn;
3095 if (FileSystemMapping ==
NULL) {
3099 PathToReturn =
NULL;
3101 if (MapListItem !=
NULL) {
3102 ASSERT ((PathToReturn ==
NULL && Size == 0) || (PathToReturn !=
NULL));
3103 PathToReturn =
StrnCatGrow (&PathToReturn, &Size, MapListItem->MapName, 0);
3104 PathToReturn =
StrnCatGrow (&PathToReturn, &Size, MapListItem->CurrentDirectoryPath, 0);
3144 IN CONST CHAR16 *FileSystem OPTIONAL,
3153 CHAR16 *DirectoryName;
3160 DirectoryName =
NULL;
3162 if (((FileSystem ==
NULL) && (Dir ==
NULL)) || (Dir ==
NULL)) {
3163 return (EFI_INVALID_PARAMETER);
3167 return (EFI_NOT_FOUND);
3171 if (DirectoryName ==
NULL) {
3172 ASSERT (DirectoryName !=
NULL);
3173 return (EFI_OUT_OF_RESOURCES);
3178 if (FileSystem ==
NULL) {
3183 ASSERT (MapName ==
NULL);
3184 MapName =
StrnCatGrow (&MapName,
NULL, DirectoryName, (
StrStr (DirectoryName, L
":")-DirectoryName+1));
3191 if (MapName !=
NULL) {
3197 if (MapListItem !=
NULL) {
3204 if (MapListItem ==
NULL) {
3206 SHELL_FREE_NON_NULL (MapName);
3207 return (EFI_NOT_FOUND);
3213 if ((MapListItem->CurrentDirectoryPath !=
NULL) && (DirectoryName[
StrLen (DirectoryName) - 1] != L
':')) {
3214 FreePool (MapListItem->CurrentDirectoryPath);
3215 MapListItem->CurrentDirectoryPath =
NULL;
3218 if (MapName !=
NULL) {
3219 TempLen =
StrLen (MapName);
3220 if (TempLen !=
StrLen (DirectoryName)) {
3221 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3222 MapListItem->CurrentDirectoryPath =
StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName+
StrLen (MapName), 0);
3227 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3228 MapListItem->CurrentDirectoryPath =
StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
3231 if (((MapListItem->CurrentDirectoryPath !=
NULL) && (MapListItem->CurrentDirectoryPath[
StrLen (MapListItem->CurrentDirectoryPath)-1] == L
'\\')) || (MapListItem->CurrentDirectoryPath ==
NULL)) {
3232 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3233 if (MapListItem->CurrentDirectoryPath !=
NULL) {
3234 MapListItem->CurrentDirectoryPath[
StrLen (MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
3243 return (EFI_INVALID_PARAMETER);
3250 if (MapListItem ==
NULL) {
3252 return (EFI_INVALID_PARAMETER);
3256 if (DirectoryName !=
NULL) {
3261 if (MapListItem->CurrentDirectoryPath !=
NULL) {
3262 FreePool (MapListItem->CurrentDirectoryPath);
3264 MapListItem->CurrentDirectoryPath =
NULL;
3270 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3271 MapListItem->CurrentDirectoryPath =
StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, L
"\\", 0);
3272 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3273 MapListItem->CurrentDirectoryPath =
StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
3274 if ((MapListItem->CurrentDirectoryPath !=
NULL) && (MapListItem->CurrentDirectoryPath[
StrLen (MapListItem->CurrentDirectoryPath)-1] == L
'\\')) {
3275 ASSERT ((MapListItem->CurrentDirectoryPath ==
NULL && Size == 0) || (MapListItem->CurrentDirectoryPath !=
NULL));
3276 MapListItem->CurrentDirectoryPath[
StrLen (MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
3287 ASSERT ((TempString ==
NULL && Size == 0) || (TempString !=
NULL));
3288 StrnCatGrow (&TempString, &Size, MapListItem->MapName, 0);
3289 ASSERT ((TempString ==
NULL && Size == 0) || (TempString !=
NULL));
3290 StrnCatGrow (&TempString, &Size, MapListItem->CurrentDirectoryPath, 0);
3328 IN CONST CHAR16 *Sections OPTIONAL,
3329 OUT CHAR16 **HelpText
3332 CONST CHAR16 *ManFileName;
3336 ASSERT (HelpText !=
NULL);
3341 if (ManFileName !=
NULL) {
3344 if ( (
StrLen (Command) > 4)
3345 && ((Command[
StrLen (Command)-1] == L
'i') || (Command[
StrLen (Command)-1] == L
'I'))
3346 && ((Command[
StrLen (Command)-2] == L
'f') || (Command[
StrLen (Command)-2] == L
'F'))
3347 && ((Command[
StrLen (Command)-3] == L
'e') || (Command[
StrLen (Command)-3] == L
'E'))
3348 && (Command[
StrLen (Command)-4] == L
'.')
3352 if (FixCommand ==
NULL) {
3353 return EFI_OUT_OF_RESOURCES;
3358 (
StrSize (Command) - 4 *
sizeof (CHAR16))/
sizeof (CHAR16),
3385 return (ShellInfoObject.PageBreakEnabled);
3402 return (ShellInfoObject.RootShellInstance);
3421 CHAR16 *VariableName;
3423 UINTN NameBufferSize;
3427 NameBufferSize = INIT_NAME_BUFFER_SIZE;
3432 if (VariableName ==
NULL) {
3436 VariableName[0] = CHAR_NULL;
3439 NameSize = NameBufferSize;
3440 Status =
gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
3441 if (Status == EFI_NOT_FOUND) {
3443 }
else if (Status == EFI_BUFFER_TOO_SMALL) {
3444 NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2;
3445 SHELL_FREE_NON_NULL (VariableName);
3447 if (VariableName ==
NULL) {
3448 Status = EFI_OUT_OF_RESOURCES;
3449 SHELL_FREE_NON_NULL (RetVal);
3454 NameSize = NameBufferSize;
3455 Status =
gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
3458 if (EFI_ERROR (Status)) {
3459 SHELL_FREE_NON_NULL (RetVal);
3465 ASSERT ((RetVal ==
NULL && RetSize == 0) || (RetVal !=
NULL));
3466 RetVal =
StrnCatGrow (&RetVal, &RetSize, VariableName, 0);
3467 RetVal =
StrnCatGrow (&RetVal, &RetSize, L
";", 0);
3471 SHELL_FREE_NON_NULL (VariableName);
3491 for (Index = 0; Str[Index] != L
'\0'; Index++) {
3492 if ((Str[Index] >= L
'A') && (Str[Index] <= L
'Z')) {
3493 Str[Index] -= (CHAR16)(L
'A' - L
'a');
3522 OUT BOOLEAN *Volatile OPTIONAL
3533 if (Alias !=
NULL) {
3535 if (AliasLower ==
NULL) {
3541 if (Volatile ==
NULL) {
3549 Status =
gRT->GetVariable (AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
3550 if (Status == EFI_BUFFER_TOO_SMALL) {
3552 if (RetVal ==
NULL) {
3557 Status =
gRT->GetVariable (AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
3560 if (EFI_ERROR (Status)) {
3561 if (RetVal !=
NULL) {
3607 BOOLEAN DeleteAlias;
3609 DeleteAlias =
FALSE;
3610 if (Alias ==
NULL) {
3619 ASSERT (Alias !=
NULL);
3625 if (AliasLower ==
NULL) {
3626 return EFI_OUT_OF_RESOURCES;
3632 Status =
gRT->SetVariable (AliasLower, &gShellAliasGuid, 0, 0,
NULL);
3634 Status =
gRT->SetVariable (
3682 return (EFI_ACCESS_DENIED);
3683 }
else if ((Command ==
NULL) || (*Command == CHAR_NULL) || (
StrLen (Command) == 0)) {
3687 return (EFI_INVALID_PARAMETER);
3692 return (EFI_ACCESS_DENIED);
3741 SHELL_MAJOR_VERSION,
3742 SHELL_MINOR_VERSION,
3773 UINTN HandleCounter;
3777 if (NewShell ==
NULL) {
3778 return (EFI_INVALID_PARAMETER);
3783 OldProtocolNode =
NULL;
3789 Status =
gBS->CreateEvent (
3794 &mShellProtocol.ExecutionBreak
3796 if (EFI_ERROR (Status)) {
3803 Status =
gBS->LocateHandle (
3805 &gEfiShellProtocolGuid,
3810 if (Status == EFI_BUFFER_TOO_SMALL) {
3815 if (Buffer ==
NULL) {
3816 return (EFI_OUT_OF_RESOURCES);
3819 Status =
gBS->LocateHandle (
3821 &gEfiShellProtocolGuid,
3826 if (EFI_ERROR (Status)) {
3834 for (HandleCounter = 0; HandleCounter < (BufferSize/
sizeof (
EFI_HANDLE)); HandleCounter++) {
3835 Status =
gBS->OpenProtocol (
3836 Buffer[HandleCounter],
3837 &gEfiShellProtocolGuid,
3841 EFI_OPEN_PROTOCOL_GET_PROTOCOL
3843 if (!EFI_ERROR (Status)) {
3845 if (OldProtocolNode ==
NULL) {
3850 Status = EFI_OUT_OF_RESOURCES;
3857 OldProtocolNode->Handle = Buffer[HandleCounter];
3858 OldProtocolNode->Interface = OldShell;
3859 Status =
gBS->ReinstallProtocolInterface (
3860 OldProtocolNode->Handle,
3861 &gEfiShellProtocolGuid,
3862 OldProtocolNode->Interface,
3863 (VOID *)(&mShellProtocol)
3865 if (!EFI_ERROR (Status)) {
3879 }
else if (Status == EFI_NOT_FOUND) {
3884 Status =
gBS->InstallProtocolInterface (
3886 &gEfiShellProtocolGuid,
3888 (VOID *)(&mShellProtocol)
3892 if (
PcdGetBool (PcdShellSupportOldProtocols)) {
3897 if (!EFI_ERROR (Status)) {
3898 *NewShell = &mShellProtocol;
3931 gBS->ReinstallProtocolInterface (Node2->Handle, &gEfiShellProtocolGuid, NewShell, Node2->Interface);
3938 gBS->UninstallProtocolInterface (
gImageHandle, &gEfiShellProtocolGuid, NewShell);
3961 Status =
gBS->CloseEvent (NewShell->ExecutionBreak);
3962 NewShell->ExecutionBreak =
NULL;
3964 Status =
gBS->OpenProtocol (
3966 &gEfiSimpleTextInputExProtocolGuid,
3970 EFI_OPEN_PROTOCOL_GET_PROTOCOL
3973 if (!EFI_ERROR (Status)) {
3974 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlCNotifyHandle1);
3975 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlCNotifyHandle2);
3976 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlCNotifyHandle3);
3977 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlCNotifyHandle4);
3978 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlSNotifyHandle1);
3979 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlSNotifyHandle2);
3980 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlSNotifyHandle3);
3981 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.
CtrlSNotifyHandle4);
4000 if (((KeyData->Key.UnicodeChar == L
'c') &&
4001 ((KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED)) || (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED)))) ||
4002 (KeyData->Key.UnicodeChar == 3)
4005 if (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak ==
NULL) {
4006 return (EFI_UNSUPPORTED);
4009 return (
gBS->SignalEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak));
4010 }
else if ((KeyData->Key.UnicodeChar == L
's') &&
4011 ((KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED)) || (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED)))
4036 Status =
gBS->OpenProtocol (
4038 &gEfiSimpleTextInputExProtocolGuid,
4042 EFI_OPEN_PROTOCOL_GET_PROTOCOL
4044 if (EFI_ERROR (Status)) {
4055 if (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak ==
NULL) {
4056 return (EFI_UNSUPPORTED);
4060 KeyData.
Key.ScanCode = 0;
4062 KeyData.
Key.UnicodeChar = L
'c';
4064 Status = SimpleEx->RegisterKeyNotify (
4072 if (!EFI_ERROR (Status)) {
4073 Status = SimpleEx->RegisterKeyNotify (
4082 KeyData.
Key.UnicodeChar = 3;
4083 if (!EFI_ERROR (Status)) {
4084 Status = SimpleEx->RegisterKeyNotify (
4093 if (!EFI_ERROR (Status)) {
4094 Status = SimpleEx->RegisterKeyNotify (
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetPreviousNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
CHAR16 *EFIAPI PathCleanUpDirectories(IN CHAR16 *Path)
BOOLEAN EFIAPI PathRemoveLastItem(IN OUT CHAR16 *Path)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define MEDIA_FILEPATH_DP
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI FileDevicePath(IN EFI_HANDLE Device OPTIONAL, IN CONST CHAR16 *FileName)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
BOOLEAN EFIAPI IsDevicePathEndType(IN CONST VOID *Node)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI FileHandleFlush(IN EFI_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI FileHandleGetFileName(IN CONST EFI_FILE_HANDLE Handle, OUT CHAR16 **FullFileName)
EFI_STATUS EFIAPI FileHandleSetInfo(IN EFI_FILE_HANDLE FileHandle, IN CONST EFI_FILE_INFO *FileInfo)
EFI_STATUS EFIAPI FileHandleGetPosition(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Position)
EFI_STATUS EFIAPI FileHandleSetPosition(IN EFI_FILE_HANDLE FileHandle, IN UINT64 Position)
EFI_FILE_INFO *EFIAPI FileHandleGetInfo(IN EFI_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI FileHandleFindNextFile(IN EFI_FILE_HANDLE DirHandle, OUT EFI_FILE_INFO *Buffer, OUT BOOLEAN *NoFile)
EFI_STATUS EFIAPI FileHandleClose(IN EFI_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI FileHandleGetSize(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Size)
EFI_STATUS EFIAPI FileHandleDelete(IN EFI_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI FileHandleFindFirstFile(IN EFI_FILE_HANDLE DirHandle, OUT EFI_FILE_INFO **Buffer)
EFI_STATUS EFIAPI FileHandleWrite(IN EFI_FILE_HANDLE FileHandle, IN OUT UINTN *BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI FileHandleRead(IN EFI_FILE_HANDLE FileHandle, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_FILE_PROTOCOL FileInterfaceNulFile
EFI_FILE_PROTOCOL * CreateFileInterfaceEnv(IN CONST CHAR16 *EnvName)
EFI_FILE_PROTOCOL FileInterfaceStdErr
EFI_FILE_PROTOCOL FileInterfaceStdOut
CHAR16 *EFIAPI GetStringNameFromGuid(IN CONST EFI_GUID *Guid, IN CONST CHAR8 *Lang OPTIONAL)
CHAR8 *EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI GetGuidFromStringName(IN CONST CHAR16 *Name, IN CONST CHAR8 *Lang OPTIONAL, OUT EFI_GUID **Guid)
#define PARSE_HANDLE_DATABASE_PARENTS(ControllerHandle, Count, Buffer)
EFI_STATUS EFIAPI AddNewGuidNameMapping(IN CONST EFI_GUID *Guid, IN CONST CHAR16 *TheName, IN CONST CHAR8 *Lang OPTIONAL)
EFI_STATUS EFIAPI ParseHandleDatabaseByRelationship(IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL, IN CONST EFI_HANDLE ControllerHandle OPTIONAL, IN CONST UINTN Mask, IN UINTN *MatchingHandleCount, OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL)
#define PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ControllerHandle, Count, Buffer)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG_CODE(Expression)
EFI_FILE_INFO *(EFIAPI * EFI_SHELL_GET_FILE_INFO)(IN SHELL_FILE_HANDLE FileHandle)
EFI_STATUS(EFIAPI * EFI_SHELL_SET_FILE_INFO)(IN SHELL_FILE_HANDLE FileHandle, IN CONST EFI_FILE_INFO *FileInfo)
EFI_STATUS(EFIAPI * EFI_SHELL_WRITE_FILE)(IN SHELL_FILE_HANDLE FileHandle, IN OUT UINTN *BufferSize, IN VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_SHELL_GET_FILE_POSITION)(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Position)
EFI_STATUS(EFIAPI * EFI_SHELL_DELETE_FILE)(IN SHELL_FILE_HANDLE FileHandle)
EFI_STATUS(EFIAPI * EFI_SHELL_READ_FILE)(IN SHELL_FILE_HANDLE FileHandle, IN OUT UINTN *ReadSize, IN OUT VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_SHELL_SET_FILE_POSITION)(IN SHELL_FILE_HANDLE FileHandle, IN UINT64 Position)
EFI_STATUS(EFIAPI * EFI_SHELL_GET_FILE_SIZE)(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Size)
EFI_STATUS(EFIAPI * EFI_SHELL_FLUSH_FILE)(IN SHELL_FILE_HANDLE FileHandle)
#define PcdGet8(TokenName)
#define PcdGetBool(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_FILE_INFO * FileInfo(IN EFI_FILE_HANDLE FHand)
EFI_STATUS RunShellCommand(IN CONST CHAR16 *CmdLine, OUT EFI_STATUS *CommandStatus)
VOID * AddBufferToFreeList(VOID *Buffer)
BOOLEAN EFIAPI ShellFileHandleRemove(IN CONST SHELL_FILE_HANDLE Handle)
SHELL_FILE_HANDLE EFIAPI ConvertEfiFileProtocolToShellHandle(IN CONST EFI_FILE_PROTOCOL *Handle, IN CONST CHAR16 *Path)
EFI_STATUS EFIAPI ShellCommandAddMapItemAndUpdatePath(IN CONST CHAR16 *Name, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST UINT64 Flags, IN CONST BOOLEAN Path)
CONST CHAR16 *EFIAPI ShellCommandGetManFileNameHandler(IN CONST CHAR16 *CommandString)
SHELL_MAP_LIST gShellMapList
List of Mappings - DeviceName and Drive Letter(ism).
CONST CHAR16 *EFIAPI ShellFileHandleGetPath(IN CONST SHELL_FILE_HANDLE Handle)
SHELL_MAP_LIST * gShellCurMapping
Pointer to node of current directory in the mMapList.
EFI_FILE_PROTOCOL *EFIAPI ConvertShellHandleToEfiFileProtocol(IN CONST SHELL_FILE_HANDLE Handle)
SHELL_MAP_LIST *EFIAPI ShellCommandFindMapItem(IN CONST CHAR16 *MapKey)
EFI_STATUS EFIAPI ShellSortFileList(IN OUT EFI_SHELL_FILE_INFO **FileList, OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL, IN SHELL_SORT_FILE_LIST Order)
SCRIPT_FILE *EFIAPI ShellCommandGetCurrentScriptFile(VOID)
BOOLEAN EFIAPI ShellCommandIsOnAliasList(IN CONST CHAR16 *Alias)
EFI_STATUS ShellFindEnvVarInList(IN CONST CHAR16 *Key, OUT CHAR16 **Value, OUT UINTN *ValueSize, OUT UINT32 *Atts OPTIONAL)
EFI_STATUS ShellInitEnvVarList(VOID)
EFI_STATUS IsVolatileEnv(IN CONST CHAR16 *EnvVarName, OUT BOOLEAN *Volatile)
EFI_STATUS GetEnvironmentVariableList(IN OUT LIST_ENTRY *ListHead)
EFI_STATUS ShellAddEnvVarToList(IN CONST CHAR16 *Key, IN CONST CHAR16 *Value, IN UINTN ValueSize, IN UINT32 Atts)
EFI_STATUS ShellRemvoeEnvVarFromList(IN CONST CHAR16 *Key)
EFI_STATUS SetEnvironmentVariableList(IN LIST_ENTRY *ListHead)
VOID ShellFreeEnvVarList(VOID)
EFI_STATUS SetEnvironmentVariables(IN CONST CHAR16 **Environment)
#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName, BufferSize, Buffer)
#define SHELL_DELETE_ENVIRONMENT_VARIABLE(EnvVarName)
#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName, BufferSize, Buffer)
#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName, BufferSize, Buffer)
#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName, Atts, BufferSize, Buffer)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS ProcessManFile(IN CONST CHAR16 *ManFileName, IN CONST CHAR16 *Command, IN CONST CHAR16 *Sections OPTIONAL, OUT CHAR16 **BriefDesc OPTIONAL, OUT CHAR16 **HelpText)
EFI_STATUS UpdateArgcArgv(IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, IN SHELL_OPERATION_TYPES Type, OUT CHAR16 ***OldArgv OPTIONAL, OUT UINTN *OldArgc OPTIONAL)
EFI_STATUS CleanUpShellProtocol(IN OUT EFI_SHELL_PROTOCOL *NewShell)
CONST CHAR16 *EFIAPI EfiShellGetEnvEx(IN CONST CHAR16 *Name, OUT UINT32 *Attributes OPTIONAL)
EFI_STATUS InternalOpenFileDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes OPTIONAL)
CONST CHAR16 *EFIAPI EfiShellGetMapFromDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI EfiShellGetGuidName(IN CONST EFI_GUID *Guid, OUT CONST CHAR16 **GuidName)
BOOLEAN EFIAPI EfiShellBatchIsActive(VOID)
BOOLEAN EFIAPI EfiShellGetPageBreak(VOID)
EFI_STATUS EFIAPI EfiShellOpenFileList(IN CHAR16 *Path, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **FileList)
EFI_STATUS InternalShellExecute(IN CONST CHAR16 *CommandLine OPTIONAL, IN CONST CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StartImageStatus OPTIONAL)
VOID InternalFreeShellFileInfoNode(IN EFI_SHELL_FILE_INFO *FileListNode)
BOOLEAN InternalShellProtocolIsSimpleFileSystemPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI NotificationFunction(IN EFI_KEY_DATA *KeyData)
CONST CHAR16 *EFIAPI EfiShellGetEnv(IN CONST CHAR16 *Name)
EFI_SHELL_FILE_INFO * InternalDuplicateShellFileInfo(IN EFI_SHELL_FILE_INFO *Node, IN BOOLEAN Save)
EFI_STATUS EFIAPI EfiShellRemoveDupInFileList(IN EFI_SHELL_FILE_INFO **FileList)
VOID EFIAPI EfiShellEnablePageBreak(VOID)
STATIC BOOLEAN NestingEnabled(VOID)
EFI_STATUS EFIAPI EfiShellGetGuidFromName(IN CONST CHAR16 *GuidName, OUT EFI_GUID *Guid)
EFI_STATUS EFIAPI EfiShellCreateFile(IN CONST CHAR16 *FileName, IN UINT64 FileAttribs, OUT SHELL_FILE_HANDLE *FileHandle)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromFilePath(IN CONST CHAR16 *Path)
EFI_STATUS EFIAPI EfiShellDeleteFileByName(IN CONST CHAR16 *FileName)
CONST EFI_DEVICE_PATH_PROTOCOL *EFIAPI EfiShellGetDevicePathFromMap(IN CONST CHAR16 *Mapping)
CHAR16 *EFIAPI EfiShellGetFilePathFromDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *Path)
VOID EFIAPI EfiShellDisablePageBreak(VOID)
EFI_SHELL_FILE_INFO * CreateAndPopulateShellFileInfo(IN CONST CHAR16 *BasePath, IN CONST EFI_STATUS Status, IN CONST CHAR16 *FileName, IN CONST SHELL_FILE_HANDLE Handle, IN CONST EFI_FILE_INFO *Info)
EFI_STATUS EFIAPI EfiShellSetCurDir(IN CONST CHAR16 *FileSystem OPTIONAL, IN CONST CHAR16 *Dir)
EFI_STATUS EFIAPI EfiShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode)
EFI_STATUS EFIAPI EfiShellSetEnv(IN CONST CHAR16 *Name, IN CONST CHAR16 *Value, IN BOOLEAN Volatile)
CONST CHAR16 *EFIAPI EfiShellGetAlias(IN CONST CHAR16 *Alias, OUT BOOLEAN *Volatile OPTIONAL)
EFI_STATUS EFIAPI EfiShellOpenRootByHandle(IN EFI_HANDLE DeviceHandle, OUT SHELL_FILE_HANDLE *FileHandle)
BOOLEAN EFIAPI EfiShellIsRootShell(VOID)
EFI_STATUS EFIAPI EfiShellExecute(IN EFI_HANDLE *ParentImageHandle, IN CHAR16 *CommandLine OPTIONAL, IN CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StatusCode OPTIONAL)
EFI_STATUS EFIAPI EfiShellFreeFileList(IN EFI_SHELL_FILE_INFO **FileList)
EFI_STATUS EFIAPI EfiShellFindFilesInDir(IN SHELL_FILE_HANDLE FileDirHandle, OUT EFI_SHELL_FILE_INFO **FileList)
CONST CHAR16 *EFIAPI EfiShellGetCurDir(IN CONST CHAR16 *FileSystemMapping OPTIONAL)
EFI_STATUS InternalShellExecuteDevicePath(IN CONST EFI_HANDLE *ParentImageHandle, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *CommandLine OPTIONAL, IN CONST CHAR16 **Environment OPTIONAL, OUT EFI_STATUS *StartImageStatus OPTIONAL)
EFI_STATUS InternalEfiShellSetEnv(IN CONST CHAR16 *Name, IN CONST CHAR16 *Value, IN BOOLEAN Volatile)
EFI_STATUS EFIAPI EfiShellGetDeviceName(IN EFI_HANDLE DeviceHandle, IN EFI_SHELL_DEVICE_NAME_FLAGS Flags, IN CHAR8 *Language, OUT CHAR16 **BestDeviceName)
EFI_STATUS EFIAPI EfiShellRegisterGuidName(IN CONST EFI_GUID *Guid, IN CONST CHAR16 *GuidName)
EFI_STATUS EFIAPI EfiShellSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Replace, IN BOOLEAN Volatile)
EFI_STATUS InternalSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
BOOLEAN InternalShellProtocolIsBlockIoPresent(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI EfiShellGetHelpText(IN CONST CHAR16 *Command, IN CONST CHAR16 *Sections OPTIONAL, OUT CHAR16 **HelpText)
CHAR16 * InternalEfiShellGetListAlias(VOID)
EFI_STATUS EFIAPI EfiShellFindFiles(IN CONST CHAR16 *FilePattern, OUT EFI_SHELL_FILE_INFO **FileList)
EFI_STATUS CreatePopulateInstallShellProtocol(IN OUT EFI_SHELL_PROTOCOL **NewShell)
EFI_STATUS InernalEfiShellStartMonitor(VOID)
EFI_STATUS EFIAPI EfiShellSetMap(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST CHAR16 *Mapping)
EFI_STATUS ShellSearchHandle(IN CONST CHAR16 *FilePattern, IN EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation, IN SHELL_FILE_HANDLE FileHandle, IN OUT EFI_SHELL_FILE_INFO **FileList, IN CONST EFI_SHELL_FILE_INFO *ParentNode OPTIONAL, IN CONST CHAR16 *MapName)
CHAR16 * ToLower(CHAR16 *Str)
EFI_STATUS EFIAPI EfiShellOpenRoot(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT SHELL_FILE_HANDLE *FileHandle)
EFI_STATUS EFIAPI EfiShellClose(IN SHELL_FILE_HANDLE FileHandle)
EFI_STATUS CleanUpShellEnvironment(IN OUT EFI_SHELL_PROTOCOL *NewShell)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
INTN EFIAPI DevicePathCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
#define EFI_VARIABLE_NON_VOLATILE
EFI_KEY_TOGGLE_STATE KeyToggleState
VOID * LoadOptions
A pointer to the image's binary load options.
UINT32 LoadOptionsSize
The size in bytes of LoadOptions.
EFI_MEMORY_TYPE ImageCodeType
The memory type that the code sections were loaded as.
EFI_STATUS Status
Status of opening the file. Valid only if Handle != NULL.
CHAR16 * FileName
name of this file.
EFI_FILE_INFO * Info
Pointer to the FileInfo struct for this file or NULL.
SHELL_FILE_HANDLE Handle
Handle for interacting with the opened file or NULL if closed.
CHAR16 * FullName
Fully qualified filename.
LIST_ENTRY Link
Linked list members.
LIST_ENTRY Link
Linked list members.
SHELL_FILE_HANDLE Handle
Handle for interacting with the opened file or NULL if closed.
EFI_FILE_INFO * Info
Pointer to the FileInfo struct for this file or NULL.
EFI_STATUS Status
Status of opening the file. Valid only if Handle != NULL.
CONST CHAR16 * FullName
Fully qualified filename.
CONST CHAR16 * FileName
name of this file.
EFI_HANDLE ConsoleInHandle
UINT32 NoNest
Was "-nonest" found on command line.
VOID * CtrlCNotifyHandle3
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
EFI_DEVICE_PATH_PROTOCOL * FileDevPath
DevicePath for ourselves.
VOID * CtrlCNotifyHandle4
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
BOOLEAN HaltOutput
TRUE to start a CTRL-S halt.
EFI_DEVICE_PATH_PROTOCOL * ImageDevPath
DevicePath for ourselves.
VOID * CtrlCNotifyHandle1
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
EFI_HII_HANDLE HiiHandle
Handle from HiiLib.
VOID * CtrlSNotifyHandle4
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
VOID * CtrlCNotifyHandle2
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
VOID * CtrlSNotifyHandle2
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
SHELL_PROTOCOL_HANDLE_LIST OldShellList
List of other instances to reinstall when closing.
VOID * CtrlSNotifyHandle3
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
VOID * CtrlSNotifyHandle1
The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.