-
Notifications
You must be signed in to change notification settings - Fork 8
/
Other.c
26 lines (26 loc) · 881 Bytes
/
Other.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
EFI_STATUS DetectBootablePartition(void *Bootable)
{
EFI_STATUS Status;
EFI_HANDLE *ControllerHandles = NULL;
UINTN HandleIndex,NumHandles;
//find all setup SimpleFileSystemProtocol 's Handle and find all FAT partition table
Status = gBS->LocateHandleBuffer(ByProtocol,&gEfiSimpleFileSystemProtocolGuid,NULL,&NumHandles,&ControllerHandles);
if (EFI_ERROR(Status))
{
return Status;
}
//enum finder Handle
for (HandleIndex = 0;HandleIndex < NumHandles;HandleIndex++)
{
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
//open on Handle's SimpleFileSystemProtocol
Status = gBS->HandleProtocol(ControllerHandles[HandleIndex],&gEfiSimpleFileSystemProtocolGuid,(VOID **)&SimpleFileSystem);
//check eif\boot\bootx64.efi file
}
//free ControllerHandle memory area
if (ControllerHandles != NULL)
{
Status = gBS->FreePool(ControllerHandles);
}
return Status;
}