TianoCore EDK2 master
Loading...
Searching...
No Matches
FileExplorer.c
Go to the documentation of this file.
1
9#include "FileExplorer.h"
10
11EFI_GUID FileExplorerGuid = EFI_FILE_EXPLORE_FORMSET_GUID;
12
17 MENU_OPTION_SIGNATURE,
18 { NULL },
19 0,
20 FALSE
21};
22
23FILE_EXPLORER_CALLBACK_DATA gFileExplorerPrivate = {
24 FILE_EXPLORER_CALLBACK_DATA_SIGNATURE,
25 NULL,
26 NULL,
27 {
31 },
32 NULL,
34 0
35};
36
37HII_VENDOR_DEVICE_PATH *gHiiVendorDevicePath;
38
39HII_VENDOR_DEVICE_PATH FeHiiVendorDevicePath = {
40 {
41 {
44 {
45 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
46 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
47 }
48 },
49 //
50 // Will be replace with gEfiCallerIdGuid in code.
51 //
52 { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }
53 }
54 },
55 {
56 END_DEVICE_PATH_TYPE,
57 END_ENTIRE_DEVICE_PATH_SUBTYPE,
58 {
59 (UINT8)(END_DEVICE_PATH_LENGTH),
60 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
61 }
62 }
63};
64
65VOID *mLibStartOpCodeHandle = NULL;
66VOID *mLibEndOpCodeHandle = NULL;
67EFI_IFR_GUID_LABEL *mLibStartLabel = NULL;
68EFI_IFR_GUID_LABEL *mLibEndLabel = NULL;
69UINT16 mQuestionIdUpdate;
70CHAR16 mNewFileName[MAX_FILE_NAME_LEN];
71CHAR16 mNewFolderName[MAX_FOLDER_NAME_LEN];
72UINTN mNewFileQuestionId = NEW_FILE_QUESTION_ID_BASE;
73UINTN mNewFolderQuestionId = NEW_FOLDER_QUESTION_ID_BASE;
74
85 IN CHAR16 *FileName,
86 IN BOOLEAN CreateFile
87 );
88
110EFIAPI
113 IN CONST EFI_STRING Request,
114 OUT EFI_STRING *Progress,
115 OUT EFI_STRING *Results
116 )
117{
118 if ((Progress == NULL) || (Results == NULL)) {
119 return EFI_INVALID_PARAMETER;
120 }
121
122 *Progress = Request;
123 return EFI_NOT_FOUND;
124}
125
142EFIAPI
145 IN CONST EFI_STRING Configuration,
146 OUT EFI_STRING *Progress
147 )
148{
149 if ((Configuration == NULL) || (Progress == NULL)) {
150 return EFI_INVALID_PARAMETER;
151 }
152
153 *Progress = Configuration;
154 return EFI_NOT_FOUND;
155}
156
178EFIAPI
181 IN EFI_BROWSER_ACTION Action,
182 IN EFI_QUESTION_ID QuestionId,
183 IN UINT8 Type,
184 IN EFI_IFR_TYPE_VALUE *Value,
185 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
186 )
187{
188 EFI_STATUS Status;
189 BOOLEAN NeedExit;
190 CHAR16 *NewFileName;
191 CHAR16 *NewFolderName;
192
193 NeedExit = TRUE;
194 NewFileName = NULL;
195 NewFolderName = NULL;
196
197 if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED)) {
198 //
199 // Do nothing for other UEFI Action. Only do call back when data is changed.
200 //
201 return EFI_UNSUPPORTED;
202 }
203
204 if (Action == EFI_BROWSER_ACTION_CHANGED) {
205 if ((Value == NULL) || (ActionRequest == NULL)) {
206 return EFI_INVALID_PARAMETER;
207 }
208
209 if (QuestionId == KEY_VALUE_CREATE_FILE_AND_EXIT) {
210 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
211 if (!IsZeroBuffer (mNewFileName, sizeof (mNewFileName))) {
212 Status = LibCreateNewFile (mNewFileName, TRUE);
213 ZeroMem (mNewFileName, sizeof (mNewFileName));
214 }
215 }
216
217 if (QuestionId == KEY_VALUE_NO_CREATE_FILE_AND_EXIT) {
218 ZeroMem (mNewFileName, sizeof (mNewFileName));
219 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
220 }
221
222 if (QuestionId == KEY_VALUE_CREATE_FOLDER_AND_EXIT) {
223 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
224 if (!IsZeroBuffer (mNewFolderName, sizeof (mNewFolderName))) {
225 Status = LibCreateNewFile (mNewFolderName, FALSE);
226 ZeroMem (mNewFolderName, sizeof (mNewFolderName));
227 }
228 }
229
230 if (QuestionId == KEY_VALUE_NO_CREATE_FOLDER_AND_EXIT) {
231 ZeroMem (mNewFolderName, sizeof (mNewFolderName));
232 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
233 }
234
235 if (QuestionId == NEW_FILE_NAME_ID) {
236 NewFileName = HiiGetString (gFileExplorerPrivate.FeHiiHandle, Value->string, NULL);
237 if (NewFileName != NULL) {
238 StrCpyS (mNewFileName, MAX_FILE_NAME_LEN, NewFileName);
239 FreePool (NewFileName);
240 NewFileName = NULL;
241 } else {
242 return EFI_INVALID_PARAMETER;
243 }
244 }
245
246 if (QuestionId == NEW_FOLDER_NAME_ID) {
247 NewFolderName = HiiGetString (gFileExplorerPrivate.FeHiiHandle, Value->string, NULL);
248 if (NewFolderName != NULL) {
249 StrCpyS (mNewFolderName, MAX_FOLDER_NAME_LEN, NewFolderName);
250 FreePool (NewFolderName);
251 NewFolderName = NULL;
252 } else {
253 return EFI_INVALID_PARAMETER;
254 }
255 }
256
257 if (QuestionId >= FILE_OPTION_OFFSET) {
258 LibGetDevicePath (QuestionId);
259
260 //
261 // Process the extra action.
262 //
263 if (gFileExplorerPrivate.ChooseHandler != NULL) {
264 NeedExit = gFileExplorerPrivate.ChooseHandler (gFileExplorerPrivate.RetDevicePath);
265 }
266
267 if (NeedExit) {
268 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
269 }
270 }
271 } else if (Action == EFI_BROWSER_ACTION_CHANGING) {
272 if (Value == NULL) {
273 return EFI_INVALID_PARAMETER;
274 }
275
276 if (QuestionId >= FILE_OPTION_OFFSET) {
277 LibGetDevicePath (QuestionId);
278 Status = LibUpdateFileExplorer (QuestionId);
279 if (EFI_ERROR (Status)) {
280 return Status;
281 }
282 }
283 }
284
285 return EFI_SUCCESS;
286}
287
297 VOID
298 )
299{
300 MENU_ENTRY *MenuEntry;
301
302 //
303 // Create new menu entry
304 //
305 MenuEntry = AllocateZeroPool (sizeof (MENU_ENTRY));
306 if (MenuEntry == NULL) {
307 return NULL;
308 }
309
310 MenuEntry->VariableContext = AllocateZeroPool (sizeof (FILE_CONTEXT));
311 if (MenuEntry->VariableContext == NULL) {
312 FreePool (MenuEntry);
313 return NULL;
314 }
315
316 MenuEntry->Signature = MENU_ENTRY_SIGNATURE;
317 return MenuEntry;
318}
319
334 MENU_OPTION *MenuOption,
335 UINTN MenuNumber
336 )
337{
338 MENU_ENTRY *NewMenuEntry;
339 UINTN Index;
340 LIST_ENTRY *List;
341
342 ASSERT (MenuNumber < MenuOption->MenuNumber);
343
344 List = MenuOption->Head.ForwardLink;
345 for (Index = 0; Index < MenuNumber; Index++) {
346 List = List->ForwardLink;
347 }
348
349 NewMenuEntry = CR (List, MENU_ENTRY, Link, MENU_ENTRY_SIGNATURE);
350
351 return NewMenuEntry;
352}
353
360VOID
362 MENU_ENTRY *MenuEntry
363 )
364{
365 FILE_CONTEXT *FileContext;
366
367 FileContext = (FILE_CONTEXT *)MenuEntry->VariableContext;
368
369 if (!FileContext->IsRoot) {
370 if (FileContext->DevicePath != NULL) {
371 FreePool (FileContext->DevicePath);
372 }
373 } else {
374 if (FileContext->FileHandle != NULL) {
375 FileContext->FileHandle->Close (FileContext->FileHandle);
376 }
377 }
378
379 if (FileContext->FileName != NULL) {
380 FreePool (FileContext->FileName);
381 }
382
383 FreePool (FileContext);
384
385 if (MenuEntry->DisplayString != NULL) {
386 FreePool (MenuEntry->DisplayString);
387 }
388
389 if (MenuEntry->HelpString != NULL) {
390 FreePool (MenuEntry->HelpString);
391 }
392
393 FreePool (MenuEntry);
394}
395
401VOID
403 MENU_OPTION *FreeMenu
404 )
405{
406 MENU_ENTRY *MenuEntry;
407
408 while (!IsListEmpty (&FreeMenu->Head)) {
409 MenuEntry = CR (
410 FreeMenu->Head.ForwardLink,
412 Link,
413 MENU_ENTRY_SIGNATURE
414 );
415 RemoveEntryList (&MenuEntry->Link);
416 LibDestroyMenuEntry (MenuEntry);
417 }
418
419 FreeMenu->MenuNumber = 0;
420}
421
433 IN EFI_HANDLE DeviceHandle
434 )
435{
436 EFI_STATUS Status;
438 EFI_FILE_HANDLE File;
439
440 File = NULL;
441
442 //
443 // File the file system interface to the device
444 //
445 Status = gBS->HandleProtocol (
446 DeviceHandle,
447 &gEfiSimpleFileSystemProtocolGuid,
448 (VOID *)&Volume
449 );
450
451 //
452 // Open the root directory of the volume
453 //
454 if (!EFI_ERROR (Status)) {
455 Status = Volume->OpenVolume (
456 Volume,
457 &File
458 );
459 }
460
461 //
462 // Done
463 //
464 return EFI_ERROR (Status) ? NULL : File;
465}
466
475CHAR16 *
478 )
479{
480 EFI_STATUS Status;
481 CHAR16 *ToText;
483
484 if (DevPath == NULL) {
485 return NULL;
486 }
487
488 Status = gBS->LocateProtocol (
489 &gEfiDevicePathToTextProtocolGuid,
490 NULL,
491 (VOID **)&DevPathToText
492 );
493 ASSERT_EFI_ERROR (Status);
494 ToText = DevPathToText->ConvertDevicePathToText (
495 DevPath,
496 FALSE,
497 TRUE
498 );
499 ASSERT (ToText != NULL);
500
501 return ToText;
502}
503
513CHAR16 *
515 IN CHAR16 *Src
516 )
517{
518 CHAR16 *Dest;
519 UINTN Size;
520
521 Size = StrSize (Src);
522 Dest = AllocateZeroPool (Size);
523 ASSERT (Dest != NULL);
524 if (Dest != NULL) {
525 CopyMem (Dest, Src, Size);
526 }
527
528 return Dest;
529}
530
542VOID *
544 IN EFI_FILE_HANDLE FHand,
545 IN EFI_GUID *InfoType
546 )
547{
548 EFI_STATUS Status;
549 EFI_FILE_INFO *Buffer;
550 UINTN BufferSize;
551
552 Buffer = NULL;
553 BufferSize = 0;
554
555 Status = FHand->GetInfo (
556 FHand,
557 InfoType,
558 &BufferSize,
559 Buffer
560 );
561 if (Status == EFI_BUFFER_TOO_SMALL) {
562 Buffer = AllocatePool (BufferSize);
563 ASSERT (Buffer != NULL);
564 }
565
566 Status = FHand->GetInfo (
567 FHand,
568 InfoType,
569 &BufferSize,
570 Buffer
571 );
572
573 return Buffer;
574}
575
586CHAR16 *
588 IN CHAR16 *FileName
589 )
590{
591 UINTN Index;
592
593 Index = StrLen (FileName) - 1;
594 while ((FileName[Index] != L'.') && (Index != 0)) {
595 Index--;
596 }
597
598 return Index == 0 ? NULL : &FileName[Index];
599}
600
608VOID
610 IN CHAR16 *String
611 )
612{
613 CHAR16 *TmpStr;
614
615 for (TmpStr = String; *TmpStr != L'\0'; TmpStr++) {
616 if ((*TmpStr >= L'A') && (*TmpStr <= L'Z')) {
617 *TmpStr = (CHAR16)(*TmpStr - L'A' + L'a');
618 }
619 }
620}
621
633BOOLEAN
635 IN UINT16 *FileName
636 )
637{
638 CHAR16 *InputFileType;
639 CHAR16 *TmpStr;
640 BOOLEAN IsSupported;
641
642 if (gFileExplorerPrivate.FileType == NULL) {
643 return TRUE;
644 }
645
646 InputFileType = LibGetTypeFromName (FileName);
647 //
648 // If the file not has *.* style, always return TRUE.
649 //
650 if (InputFileType == NULL) {
651 return TRUE;
652 }
653
654 TmpStr = AllocateCopyPool (StrSize (InputFileType), InputFileType);
655 ASSERT (TmpStr != NULL);
656 LibToLowerString (TmpStr);
657
658 IsSupported = (StrStr (gFileExplorerPrivate.FileType, TmpStr) == NULL ? FALSE : TRUE);
659
660 FreePool (TmpStr);
661 return IsSupported;
662}
663
675CHAR16 *
677 IN CHAR16 *Str1,
678 IN CHAR16 *Str2
679 )
680{
681 UINTN Size1;
682 UINTN Size2;
683 UINTN MaxLen;
684 CHAR16 *Str;
685 CHAR16 *TmpStr;
686 CHAR16 *Ptr;
687 CHAR16 *LastSlash;
688
689 Size1 = StrSize (Str1);
690 Size2 = StrSize (Str2);
691
692 //
693 // Check overflow
694 //
695 if (((MAX_UINTN - Size1) < Size2) || ((MAX_UINTN - Size1 - Size2) < sizeof (CHAR16))) {
696 return NULL;
697 }
698
699 MaxLen = (Size1 + Size2 + sizeof (CHAR16))/ sizeof (CHAR16);
700 Str = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
701 ASSERT (Str != NULL);
702
703 TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
704 ASSERT (TmpStr != NULL);
705
706 StrCpyS (Str, MaxLen, Str1);
707 if (!((*Str == '\\') && (*(Str + 1) == 0))) {
708 StrCatS (Str, MaxLen, L"\\");
709 }
710
711 StrCatS (Str, MaxLen, Str2);
712
713 Ptr = Str;
714 LastSlash = Str;
715 while (*Ptr != 0) {
716 if ((*Ptr == '\\') && (*(Ptr + 1) == '.') && (*(Ptr + 2) == '.') && (*(Ptr + 3) == L'\\')) {
717 //
718 // Convert "\Name\..\" to "\"
719 // DO NOT convert the .. if it is at the end of the string. This will
720 // break the .. behavior in changing directories.
721 //
722
723 //
724 // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings
725 // that overlap.
726 //
727 StrCpyS (TmpStr, MaxLen, Ptr + 3);
728 StrCpyS (LastSlash, MaxLen - ((UINTN)LastSlash - (UINTN)Str) / sizeof (CHAR16), TmpStr);
729 Ptr = LastSlash;
730 } else if ((*Ptr == '\\') && (*(Ptr + 1) == '.') && (*(Ptr + 2) == '\\')) {
731 //
732 // Convert a "\.\" to a "\"
733 //
734
735 //
736 // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings
737 // that overlap.
738 //
739 StrCpyS (TmpStr, MaxLen, Ptr + 2);
740 StrCpyS (Ptr, MaxLen - ((UINTN)Ptr - (UINTN)Str) / sizeof (CHAR16), TmpStr);
741 Ptr = LastSlash;
742 } else if (*Ptr == '\\') {
743 LastSlash = Ptr;
744 }
745
746 Ptr++;
747 }
748
749 FreePool (TmpStr);
750
751 return Str;
752}
753
766 VOID
767 )
768{
769 UINTN NoSimpleFsHandles;
770 EFI_HANDLE *SimpleFsHandle;
771 UINT16 *VolumeLabel;
772 UINTN Index;
773 EFI_STATUS Status;
774 MENU_ENTRY *MenuEntry;
775 FILE_CONTEXT *FileContext;
776 UINTN OptionNumber;
778
779 NoSimpleFsHandles = 0;
780 OptionNumber = 0;
781
782 //
783 // Locate Handles that support Simple File System protocol
784 //
785 Status = gBS->LocateHandleBuffer (
787 &gEfiSimpleFileSystemProtocolGuid,
788 NULL,
789 &NoSimpleFsHandles,
790 &SimpleFsHandle
791 );
792 if (!EFI_ERROR (Status)) {
793 //
794 // Find all the instances of the File System prototocol
795 //
796 for (Index = 0; Index < NoSimpleFsHandles; Index++) {
797 //
798 // Allocate pool for this load option
799 //
800 MenuEntry = LibCreateMenuEntry ();
801 if (NULL == MenuEntry) {
802 FreePool (SimpleFsHandle);
803 return EFI_OUT_OF_RESOURCES;
804 }
805
806 FileContext = (FILE_CONTEXT *)MenuEntry->VariableContext;
807 FileContext->DeviceHandle = SimpleFsHandle[Index];
808 FileContext->FileHandle = LibOpenRoot (FileContext->DeviceHandle);
809 if (FileContext->FileHandle == NULL) {
810 LibDestroyMenuEntry (MenuEntry);
811 continue;
812 }
813
814 MenuEntry->HelpString = LibDevicePathToStr (DevicePathFromHandle (FileContext->DeviceHandle));
815 FileContext->FileName = LibStrDuplicate (L"\\");
816 FileContext->DevicePath = FileDevicePath (FileContext->DeviceHandle, FileContext->FileName);
817 FileContext->IsDir = TRUE;
818 FileContext->IsRoot = TRUE;
819
820 //
821 // Get current file system's Volume Label
822 //
823 Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *)LibFileInfo (FileContext->FileHandle, &gEfiFileSystemVolumeLabelInfoIdGuid);
824 if (Info == NULL) {
825 VolumeLabel = L"NO FILE SYSTEM INFO";
826 } else {
827 VolumeLabel = Info->VolumeLabel;
828 if (*VolumeLabel == 0x0000) {
829 VolumeLabel = L"NO VOLUME LABEL";
830 }
831 }
832
833 MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
834 ASSERT (MenuEntry->DisplayString != NULL);
836 MenuEntry->DisplayString,
837 MAX_CHAR,
838 L"%s, [%s]",
839 VolumeLabel,
840 MenuEntry->HelpString
841 );
842 MenuEntry->DisplayStringToken = HiiSetString (
843 gFileExplorerPrivate.FeHiiHandle,
844 0,
845 MenuEntry->DisplayString,
846 NULL
847 );
848
849 if (Info != NULL) {
850 FreePool (Info);
851 }
852
853 OptionNumber++;
854 InsertTailList (&gFileExplorerPrivate.FsOptionMenu->Head, &MenuEntry->Link);
855 }
856 }
857
858 if (NoSimpleFsHandles != 0) {
859 FreePool (SimpleFsHandle);
860 }
861
862 gFileExplorerPrivate.FsOptionMenu->MenuNumber = OptionNumber;
863
864 return EFI_SUCCESS;
865}
866
878 IN MENU_ENTRY *MenuEntry,
879 OUT EFI_FILE_HANDLE *RetFileHandle
880 )
881{
882 EFI_FILE_HANDLE Dir;
883 EFI_FILE_HANDLE NewDir;
884 FILE_CONTEXT *FileContext;
885 EFI_STATUS Status;
886
887 FileContext = (FILE_CONTEXT *)MenuEntry->VariableContext;
888 Dir = FileContext->FileHandle;
889
890 //
891 // Open current directory to get files from it
892 //
893 Status = Dir->Open (
894 Dir,
895 &NewDir,
896 FileContext->FileName,
897 EFI_FILE_READ_ONLY,
898 0
899 );
900 if (EFI_ERROR (Status)) {
901 return Status;
902 }
903
904 if (!FileContext->IsRoot) {
905 Dir->Close (Dir);
906 }
907
908 *RetFileHandle = NewDir;
909
910 return EFI_SUCCESS;
911}
912
926 IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
927 OUT EFI_FILE_HANDLE *RetFileHandle,
928 OUT UINT16 **ParentFileName,
929 OUT EFI_HANDLE *DeviceHandle
930 )
931{
932 EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
933 EFI_DEVICE_PATH_PROTOCOL *TempDevicePathNode;
934 EFI_STATUS Status;
935 EFI_HANDLE Handle;
937 EFI_FILE_HANDLE FileHandle;
938 EFI_FILE_HANDLE LastHandle;
939 CHAR16 *TempPath;
940
941 *ParentFileName = NULL;
942
943 //
944 // Attempt to access the file via a file system interface
945 //
946 DevicePathNode = RootDirectory;
947 Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathNode, &Handle);
948 if (EFI_ERROR (Status)) {
949 return Status;
950 }
951
952 Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume);
953 if (EFI_ERROR (Status)) {
954 return Status;
955 }
956
957 //
958 // Open the Volume to get the File System handle
959 //
960 Status = Volume->OpenVolume (Volume, &FileHandle);
961 if (EFI_ERROR (Status)) {
962 return Status;
963 }
964
965 *DeviceHandle = Handle;
966
967 if (IsDevicePathEnd (DevicePathNode)) {
968 *ParentFileName = AllocateCopyPool (StrSize (L"\\"), L"\\");
969 *RetFileHandle = FileHandle;
970 return EFI_SUCCESS;
971 }
972
973 //
974 // Duplicate the device path to avoid the access to unaligned device path node.
975 // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH
976 // nodes, It assures the fields in device path nodes are 2 byte aligned.
977 //
978 TempDevicePathNode = DuplicateDevicePath (DevicePathNode);
979 if (TempDevicePathNode == NULL) {
980 //
981 // Setting Status to an EFI_ERROR value will cause the rest of
982 // the file system support below to be skipped.
983 //
984 Status = EFI_OUT_OF_RESOURCES;
985 goto Done;
986 }
987
988 //
989 // Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
990 // directory information and filename can be seperate. The goal is to inch
991 // our way down each device path node and close the previous node
992 //
993 DevicePathNode = TempDevicePathNode;
994 while (!EFI_ERROR (Status) && !IsDevicePathEnd (DevicePathNode)) {
995 if ((DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH) ||
996 (DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP))
997 {
998 Status = EFI_UNSUPPORTED;
999 goto Done;
1000 }
1001
1002 LastHandle = FileHandle;
1003 FileHandle = NULL;
1004
1005 Status = LastHandle->Open (
1006 LastHandle,
1007 &FileHandle,
1008 ((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName,
1009 EFI_FILE_MODE_READ,
1010 0
1011 );
1012 if (*ParentFileName == NULL) {
1013 *ParentFileName = AllocateCopyPool (StrSize (((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName), ((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName);
1014 } else {
1015 TempPath = LibAppendFileName (*ParentFileName, ((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName);
1016 if (TempPath == NULL) {
1017 LastHandle->Close (LastHandle);
1018 Status = EFI_OUT_OF_RESOURCES;
1019 goto Done;
1020 }
1021
1022 FreePool (*ParentFileName);
1023 *ParentFileName = TempPath;
1024 }
1025
1026 //
1027 // Close the previous node
1028 //
1029 LastHandle->Close (LastHandle);
1030
1031 DevicePathNode = NextDevicePathNode (DevicePathNode);
1032 }
1033
1034 if (EFI_ERROR (Status)) {
1035 goto Done;
1036 }
1037
1038 *RetFileHandle = FileHandle;
1039
1040 Status = EFI_SUCCESS;
1041
1042Done:
1043 if (TempDevicePathNode != NULL) {
1044 FreePool (TempDevicePathNode);
1045 }
1046
1047 if ((FileHandle != NULL) && (EFI_ERROR (Status))) {
1048 FileHandle->Close (FileHandle);
1049 }
1050
1051 return Status;
1052}
1053
1064 IN CHAR16 *FileName,
1065 IN BOOLEAN CreateFile
1066 )
1067{
1068 EFI_FILE_HANDLE FileHandle;
1069 EFI_FILE_HANDLE NewHandle;
1070 EFI_HANDLE DeviceHandle;
1071 EFI_STATUS Status;
1072 CHAR16 *ParentName;
1073 CHAR16 *FullFileName;
1074
1075 NewHandle = NULL;
1076 FullFileName = NULL;
1077
1078 if (EFI_ERROR (LibGetFileHandleFromDevicePath (gFileExplorerPrivate.RetDevicePath, &FileHandle, &ParentName, &DeviceHandle))) {
1079 return EFI_DEVICE_ERROR;
1080 }
1081
1082 FullFileName = LibAppendFileName (ParentName, FileName);
1083 if (FullFileName == NULL) {
1084 return EFI_OUT_OF_RESOURCES;
1085 }
1086
1087 if (CreateFile) {
1088 Status = FileHandle->Open (
1089 FileHandle,
1090 &NewHandle,
1091 FullFileName,
1092 EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE,
1093 0
1094 );
1095 if (EFI_ERROR (Status)) {
1096 FileHandle->Close (FileHandle);
1097 return Status;
1098 }
1099 } else {
1100 Status = FileHandle->Open (
1101 FileHandle,
1102 &NewHandle,
1103 FullFileName,
1104 EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE,
1105 EFI_FILE_DIRECTORY
1106 );
1107 if (EFI_ERROR (Status)) {
1108 FileHandle->Close (FileHandle);
1109 return Status;
1110 }
1111 }
1112
1113 FileHandle->Close (FileHandle);
1114
1115 //
1116 // Return the DevicePath of the new created file or folder.
1117 //
1118 gFileExplorerPrivate.RetDevicePath = FileDevicePath (DeviceHandle, FullFileName);
1119
1120 return EFI_SUCCESS;
1121}
1122
1139 IN EFI_FILE_HANDLE FileHandle,
1140 IN UINT16 *FileName,
1141 IN EFI_HANDLE DeviceHandle
1142 )
1143{
1144 EFI_FILE_INFO *DirInfo;
1145 UINTN BufferSize;
1146 UINTN DirBufferSize;
1147 MENU_ENTRY *NewMenuEntry;
1148 FILE_CONTEXT *NewFileContext;
1149 UINTN Pass;
1150 EFI_STATUS Status;
1151 UINTN OptionNumber;
1152
1153 OptionNumber = 0;
1154
1155 DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;
1156 DirInfo = AllocateZeroPool (DirBufferSize);
1157 if (DirInfo == NULL) {
1158 return EFI_OUT_OF_RESOURCES;
1159 }
1160
1161 //
1162 // Get all files in current directory
1163 // Pass 1 to get Directories
1164 // Pass 2 to get files that are EFI images
1165 //
1166 Status = EFI_SUCCESS;
1167 for (Pass = 1; Pass <= 2; Pass++) {
1168 FileHandle->SetPosition (FileHandle, 0);
1169 for ( ; ;) {
1170 BufferSize = DirBufferSize;
1171 Status = FileHandle->Read (FileHandle, &BufferSize, DirInfo);
1172 if (EFI_ERROR (Status) || (BufferSize == 0)) {
1173 Status = EFI_SUCCESS;
1174 break;
1175 }
1176
1177 if ((((DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0) && (Pass == 2)) ||
1178 (((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0) && (Pass == 1))
1179 )
1180 {
1181 //
1182 // Pass 1 is for Directories
1183 // Pass 2 is for file names
1184 //
1185 continue;
1186 }
1187
1188 if (!(((DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0) || LibIsSupportedFileType (DirInfo->FileName))) {
1189 //
1190 // Slip file unless it is a directory entry or a .EFI file
1191 //
1192 continue;
1193 }
1194
1195 NewMenuEntry = LibCreateMenuEntry ();
1196 if (NULL == NewMenuEntry) {
1197 Status = EFI_OUT_OF_RESOURCES;
1198 goto Done;
1199 }
1200
1201 NewFileContext = (FILE_CONTEXT *)NewMenuEntry->VariableContext;
1202 NewFileContext->DeviceHandle = DeviceHandle;
1203 NewFileContext->FileName = LibAppendFileName (FileName, DirInfo->FileName);
1204 if (NewFileContext->FileName == NULL) {
1205 LibDestroyMenuEntry (NewMenuEntry);
1206 Status = EFI_OUT_OF_RESOURCES;
1207 goto Done;
1208 }
1209
1210 NewFileContext->FileHandle = FileHandle;
1211 NewFileContext->DevicePath = FileDevicePath (NewFileContext->DeviceHandle, NewFileContext->FileName);
1212 NewMenuEntry->HelpString = NULL;
1213 NewFileContext->IsDir = (BOOLEAN)((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
1214
1215 if (NewFileContext->IsDir) {
1216 BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
1217 NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);
1219 NewMenuEntry->DisplayString,
1220 BufferSize,
1221 L"<%s>",
1222 DirInfo->FileName
1223 );
1224 } else {
1225 NewMenuEntry->DisplayString = LibStrDuplicate (DirInfo->FileName);
1226 }
1227
1228 NewMenuEntry->DisplayStringToken = HiiSetString (
1229 gFileExplorerPrivate.FeHiiHandle,
1230 0,
1231 NewMenuEntry->DisplayString,
1232 NULL
1233 );
1234
1235 NewFileContext->IsRoot = FALSE;
1236
1237 OptionNumber++;
1238 InsertTailList (&gFileExplorerPrivate.FsOptionMenu->Head, &NewMenuEntry->Link);
1239 }
1240 }
1241
1242 gFileExplorerPrivate.FsOptionMenu->MenuNumber = OptionNumber;
1243
1244Done:
1245
1246 FreePool (DirInfo);
1247
1248 return Status;
1249}
1250
1255VOID
1257 VOID
1258 )
1259{
1260 //
1261 // Free current updated date
1262 //
1263 if (mLibStartOpCodeHandle != NULL) {
1264 HiiFreeOpCodeHandle (mLibStartOpCodeHandle);
1265 }
1266
1267 if (mLibEndOpCodeHandle != NULL) {
1268 HiiFreeOpCodeHandle (mLibEndOpCodeHandle);
1269 }
1270
1271 //
1272 // Create new OpCode Handle
1273 //
1274 mLibStartOpCodeHandle = HiiAllocateOpCodeHandle ();
1275 mLibEndOpCodeHandle = HiiAllocateOpCodeHandle ();
1276
1277 //
1278 // Create Hii Extend Label OpCode as the start opcode
1279 //
1280 mLibStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
1281 mLibStartOpCodeHandle,
1282 &gEfiIfrTianoGuid,
1283 NULL,
1284 sizeof (EFI_IFR_GUID_LABEL)
1285 );
1286 mLibStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
1287
1288 mLibStartLabel->Number = FORM_FILE_EXPLORER_ID;
1289
1290 //
1291 // Create Hii Extend Label OpCode as the start opcode
1292 //
1293 mLibEndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
1294 mLibEndOpCodeHandle,
1295 &gEfiIfrTianoGuid,
1296 NULL,
1297 sizeof (EFI_IFR_GUID_LABEL)
1298 );
1299 mLibEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
1300
1301 mLibEndLabel->Number = LABEL_END;
1302}
1303
1309VOID
1311 VOID
1312 )
1313{
1314 UINTN Index;
1315 MENU_ENTRY *NewMenuEntry;
1316 FILE_CONTEXT *NewFileContext;
1317 MENU_OPTION *MenuOption;
1318 BOOLEAN CreateNewFile;
1319
1320 NewMenuEntry = NULL;
1321 NewFileContext = NULL;
1322 CreateNewFile = FALSE;
1323
1325 MenuOption = gFileExplorerPrivate.FsOptionMenu;
1326
1327 mQuestionIdUpdate += QUESTION_ID_UPDATE_STEP;
1328
1329 for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
1330 NewMenuEntry = LibGetMenuEntry (MenuOption, Index);
1331 NewFileContext = (FILE_CONTEXT *)NewMenuEntry->VariableContext;
1332
1333 if (!NewFileContext->IsRoot && !CreateNewFile) {
1335 mLibStartOpCodeHandle,
1336 FORM_ADD_NEW_FILE_ID,
1337 STRING_TOKEN (STR_NEW_FILE),
1338 STRING_TOKEN (STR_NEW_FILE_HELP),
1339 EFI_IFR_FLAG_CALLBACK,
1340 (UINT16)(mNewFileQuestionId++)
1341 );
1343 mLibStartOpCodeHandle,
1344 FORM_ADD_NEW_FOLDER_ID,
1345 STRING_TOKEN (STR_NEW_FOLDER),
1346 STRING_TOKEN (STR_NEW_FOLDER_HELP),
1347 EFI_IFR_FLAG_CALLBACK,
1348 (UINT16)(mNewFolderQuestionId++)
1349 );
1351 mLibStartOpCodeHandle,
1352 STRING_TOKEN (STR_NULL_STRING),
1353 STRING_TOKEN (STR_NULL_STRING),
1354 0
1355 );
1356 CreateNewFile = TRUE;
1357 }
1358
1359 if (!NewFileContext->IsDir) {
1360 //
1361 // Create Text opcode for directory, also create Text opcode for file in FileExplorerStateBootFromFile.
1362 //
1364 mLibStartOpCodeHandle,
1365 (UINT16)(FILE_OPTION_OFFSET + Index + mQuestionIdUpdate),
1366 NewMenuEntry->DisplayStringToken,
1367 STRING_TOKEN (STR_NULL_STRING),
1368 EFI_IFR_FLAG_CALLBACK,
1369 0
1370 );
1371 } else {
1372 //
1373 // Create Goto opcode for file in FileExplorerStateAddBootOption or FileExplorerStateAddDriverOptionState.
1374 //
1376 mLibStartOpCodeHandle,
1377 FORM_FILE_EXPLORER_ID,
1378 NewMenuEntry->DisplayStringToken,
1379 STRING_TOKEN (STR_NULL_STRING),
1380 EFI_IFR_FLAG_CALLBACK,
1381 (UINT16)(FILE_OPTION_OFFSET + Index + mQuestionIdUpdate)
1382 );
1383 }
1384 }
1385
1387 gFileExplorerPrivate.FeHiiHandle,
1388 &FileExplorerGuid,
1389 FORM_FILE_EXPLORER_ID,
1390 mLibStartOpCodeHandle, // Label FORM_FILE_EXPLORER_ID
1391 mLibEndOpCodeHandle // LABEL_END
1392 );
1393}
1394
1406 IN UINT16 KeyValue
1407 )
1408{
1409 UINT16 FileOptionMask;
1410 MENU_ENTRY *NewMenuEntry;
1411 FILE_CONTEXT *NewFileContext;
1412 EFI_STATUS Status;
1413 EFI_FILE_HANDLE FileHandle;
1414
1415 Status = EFI_SUCCESS;
1416 FileOptionMask = (UINT16)(FILE_OPTION_MASK & KeyValue) - mQuestionIdUpdate;
1417 NewMenuEntry = LibGetMenuEntry (gFileExplorerPrivate.FsOptionMenu, FileOptionMask);
1418 NewFileContext = (FILE_CONTEXT *)NewMenuEntry->VariableContext;
1419
1420 if (NewFileContext->IsDir) {
1421 RemoveEntryList (&NewMenuEntry->Link);
1422 LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
1423 Status = LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle);
1424 if (!EFI_ERROR (Status)) {
1425 Status = LibFindFiles (FileHandle, NewFileContext->FileName, NewFileContext->DeviceHandle);
1426 if (!EFI_ERROR (Status)) {
1428 } else {
1429 LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
1430 }
1431 }
1432
1433 LibDestroyMenuEntry (NewMenuEntry);
1434 }
1435
1436 return Status;
1437}
1438
1445VOID
1447 IN UINT16 KeyValue
1448 )
1449{
1450 UINT16 FileOptionMask;
1451 MENU_ENTRY *NewMenuEntry;
1452 FILE_CONTEXT *NewFileContext;
1453
1454 FileOptionMask = (UINT16)(FILE_OPTION_MASK & KeyValue) - mQuestionIdUpdate;
1455
1456 NewMenuEntry = LibGetMenuEntry (gFileExplorerPrivate.FsOptionMenu, FileOptionMask);
1457
1458 NewFileContext = (FILE_CONTEXT *)NewMenuEntry->VariableContext;
1459
1460 if (gFileExplorerPrivate.RetDevicePath != NULL) {
1461 FreePool (gFileExplorerPrivate.RetDevicePath);
1462 }
1463
1464 gFileExplorerPrivate.RetDevicePath = DuplicateDevicePath (NewFileContext->DevicePath);
1465}
1466
1487EFIAPI
1489 IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
1490 IN CHAR16 *FileType OPTIONAL,
1491 IN CHOOSE_HANDLER ChooseHandler OPTIONAL,
1492 OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL
1493 )
1494{
1495 EFI_FILE_HANDLE FileHandle;
1496 EFI_STATUS Status;
1497 UINT16 *FileName;
1498 EFI_HANDLE DeviceHandle;
1499
1500 if ((ChooseHandler == NULL) && (File == NULL)) {
1501 return EFI_INVALID_PARAMETER;
1502 }
1503
1504 mQuestionIdUpdate = 0;
1505 FileName = NULL;
1506
1507 gFileExplorerPrivate.RetDevicePath = NULL;
1508 gFileExplorerPrivate.ChooseHandler = ChooseHandler;
1509 if (FileType != NULL) {
1510 gFileExplorerPrivate.FileType = AllocateCopyPool (StrSize (FileType), FileType);
1511 ASSERT (gFileExplorerPrivate.FileType != NULL);
1512 LibToLowerString (gFileExplorerPrivate.FileType);
1513 } else {
1514 gFileExplorerPrivate.FileType = NULL;
1515 }
1516
1517 if (RootDirectory == NULL) {
1518 Status = LibFindFileSystem ();
1519 } else {
1520 Status = LibGetFileHandleFromDevicePath (RootDirectory, &FileHandle, &FileName, &DeviceHandle);
1521 if (EFI_ERROR (Status)) {
1522 goto Done;
1523 }
1524
1525 Status = LibFindFiles (FileHandle, FileName, DeviceHandle);
1526 }
1527
1528 if (EFI_ERROR (Status)) {
1529 goto Done;
1530 }
1531
1533
1534 gFileExplorerPrivate.FormBrowser2->SendForm (
1535 gFileExplorerPrivate.FormBrowser2,
1536 &gFileExplorerPrivate.FeHiiHandle,
1537 1,
1538 &FileExplorerGuid,
1539 0,
1540 NULL,
1541 NULL
1542 );
1543
1544Done:
1545 if ((Status == EFI_SUCCESS) && (File != NULL)) {
1546 *File = gFileExplorerPrivate.RetDevicePath;
1547 } else if (gFileExplorerPrivate.RetDevicePath != NULL) {
1548 FreePool (gFileExplorerPrivate.RetDevicePath);
1549 }
1550
1551 if (gFileExplorerPrivate.FileType != NULL) {
1552 FreePool (gFileExplorerPrivate.FileType);
1553 }
1554
1555 LibFreeMenu (gFileExplorerPrivate.FsOptionMenu);
1556
1557 if (FileName != NULL) {
1558 FreePool (FileName);
1559 }
1560
1561 return Status;
1562}
1563
1575EFIAPI
1577 IN EFI_HANDLE ImageHandle,
1578 IN EFI_SYSTEM_TABLE *SystemTable
1579 )
1580{
1581 EFI_STATUS Status;
1582
1583 gHiiVendorDevicePath = (HII_VENDOR_DEVICE_PATH *)DuplicateDevicePath ((EFI_DEVICE_PATH_PROTOCOL *)&FeHiiVendorDevicePath);
1584 ASSERT (gHiiVendorDevicePath != NULL);
1585 CopyGuid (&gHiiVendorDevicePath->VendorDevicePath.Guid, &gEfiCallerIdGuid);
1586
1587 //
1588 // Install Device Path Protocol and Config Access protocol to driver handle
1589 //
1590 Status = gBS->InstallMultipleProtocolInterfaces (
1591 &gFileExplorerPrivate.FeDriverHandle,
1592 &gEfiDevicePathProtocolGuid,
1593 gHiiVendorDevicePath,
1594 &gEfiHiiConfigAccessProtocolGuid,
1595 &gFileExplorerPrivate.FeConfigAccess,
1596 NULL
1597 );
1598 if (Status == EFI_ALREADY_STARTED) {
1599 return EFI_SUCCESS;
1600 }
1601
1602 if (EFI_ERROR (Status)) {
1603 return Status;
1604 }
1605
1606 //
1607 // Post our File Explorer VFR binary to the HII database.
1608 //
1609 gFileExplorerPrivate.FeHiiHandle = HiiAddPackages (
1610 &FileExplorerGuid,
1611 gFileExplorerPrivate.FeDriverHandle,
1612 FileExplorerVfrBin,
1613 FileExplorerLibStrings,
1614 NULL
1615 );
1616 ASSERT (gFileExplorerPrivate.FeHiiHandle != NULL);
1617
1618 //
1619 // Locate Formbrowser2 protocol
1620 //
1621 Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **)&gFileExplorerPrivate.FormBrowser2);
1622 ASSERT_EFI_ERROR (Status);
1623
1624 InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);
1625
1626 return EFI_SUCCESS;
1627}
1628
1638EFIAPI
1640 IN EFI_HANDLE ImageHandle,
1641 IN EFI_SYSTEM_TABLE *SystemTable
1642 )
1643{
1644 EFI_STATUS Status;
1645
1646 ASSERT (gHiiVendorDevicePath != NULL);
1647
1648 if (gFileExplorerPrivate.FeDriverHandle != NULL) {
1649 Status = gBS->UninstallMultipleProtocolInterfaces (
1650 gFileExplorerPrivate.FeDriverHandle,
1651 &gEfiDevicePathProtocolGuid,
1652 gHiiVendorDevicePath,
1653 &gEfiHiiConfigAccessProtocolGuid,
1654 &gFileExplorerPrivate.FeConfigAccess,
1655 NULL
1656 );
1657 ASSERT_EFI_ERROR (Status);
1658
1659 HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle);
1660 gFileExplorerPrivate.FeDriverHandle = NULL;
1661 }
1662
1663 FreePool (gHiiVendorDevicePath);
1664
1665 return EFI_SUCCESS;
1666}
UINT64 UINTN
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:226
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:405
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
BOOLEAN EFIAPI IsZeroBuffer(IN CONST VOID *Buffer, IN UINTN Length)
#define MAX_CHAR
Definition: BootOption.c:18
#define MEDIA_FILEPATH_DP
Definition: DevicePath.h:1098
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
UINT8 EFIAPI DevicePathType(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 DevicePathFromHandle(IN EFI_HANDLE Handle)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_FILE_HANDLE LibOpenRoot(IN EFI_HANDLE DeviceHandle)
Definition: FileExplorer.c:432
VOID LibToLowerString(IN CHAR16 *String)
Definition: FileExplorer.c:609
EFI_STATUS EFIAPI LibExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
Definition: FileExplorer.c:111
EFI_STATUS EFIAPI FileExplorerLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
MENU_ENTRY * LibCreateMenuEntry(VOID)
Definition: FileExplorer.c:296
CHAR16 * LibGetTypeFromName(IN CHAR16 *FileName)
Definition: FileExplorer.c:587
VOID LibRefreshUpdateData(VOID)
EFI_STATUS LibFindFileSystem(VOID)
Definition: FileExplorer.c:765
CHAR16 * LibStrDuplicate(IN CHAR16 *Src)
Definition: FileExplorer.c:514
VOID LibGetDevicePath(IN UINT16 KeyValue)
EFI_STATUS LibUpdateFileExplorer(IN UINT16 KeyValue)
MENU_OPTION mFsOptionMenu
Definition: FileExplorer.c:16
VOID LibUpdateFileExplorePage(VOID)
EFI_STATUS EFIAPI LibCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
Definition: FileExplorer.c:179
VOID LibDestroyMenuEntry(MENU_ENTRY *MenuEntry)
Definition: FileExplorer.c:361
EFI_STATUS EFIAPI LibRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
Definition: FileExplorer.c:143
BOOLEAN LibIsSupportedFileType(IN UINT16 *FileName)
Definition: FileExplorer.c:634
EFI_STATUS LibFindFiles(IN EFI_FILE_HANDLE FileHandle, IN UINT16 *FileName, IN EFI_HANDLE DeviceHandle)
EFI_STATUS LibGetFileHandleFromMenu(IN MENU_ENTRY *MenuEntry, OUT EFI_FILE_HANDLE *RetFileHandle)
Definition: FileExplorer.c:877
CHAR16 * LibAppendFileName(IN CHAR16 *Str1, IN CHAR16 *Str2)
Definition: FileExplorer.c:676
EFI_STATUS LibGetFileHandleFromDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, OUT EFI_FILE_HANDLE *RetFileHandle, OUT UINT16 **ParentFileName, OUT EFI_HANDLE *DeviceHandle)
Definition: FileExplorer.c:925
VOID * LibFileInfo(IN EFI_FILE_HANDLE FHand, IN EFI_GUID *InfoType)
Definition: FileExplorer.c:543
EFI_STATUS EFIAPI ChooseFile(IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, IN CHAR16 *FileType OPTIONAL, IN CHOOSE_HANDLER ChooseHandler OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL)
MENU_ENTRY * LibGetMenuEntry(MENU_OPTION *MenuOption, UINTN MenuNumber)
Definition: FileExplorer.c:333
VOID LibFreeMenu(MENU_OPTION *FreeMenu)
Definition: FileExplorer.c:402
EFI_STATUS EFIAPI FileExplorerLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS LibCreateNewFile(IN CHAR16 *FileName, IN BOOLEAN CreateFile)
CHAR16 * LibDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
Definition: FileExplorer.c:476
UINT8 *EFIAPI HiiCreateGotoOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID FormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId)
Definition: HiiLib.c:3551
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
Definition: HiiLib.c:3051
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
Definition: HiiLib.c:3085
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
Definition: HiiLib.c:3411
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
Definition: HiiLib.c:4410
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
Definition: HiiString.c:52
UINT8 *EFIAPI HiiCreateActionOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_STRING_ID QuestionConfig)
Definition: HiiLib.c:3461
UINT8 *EFIAPI HiiCreateTextOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN EFI_STRING_ID TextTwo)
Definition: HiiLib.c:4037
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
BOOLEAN(EFIAPI * CHOOSE_HANDLER)(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
Definition: FileExplorer.h:33
#define EFI_IFR_EXTEND_OP_LABEL
Definition: MdeModuleHii.h:33
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
#define STRING_TOKEN(t)
@ ByProtocol
Definition: UefiSpec.h:1518
UINT64 Attribute
Definition: FileInfo.h:47
CHAR16 FileName[1]
Definition: FileInfo.h:52
Definition: Base.h:213