MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / egFindESP

Function egFindESP

rEFIt_UEFI/libeg/image.cpp:120–134  ·  view source on GitHub ↗

Slice - this is gEfiPartTypeSystemPartGuid static EFI_GUID ESPGuid = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } }; there is assumed only one ESP partition. What if there are two HDD gpt formatted?

Source from the content-addressed store, hash-verified

118//static EFI_GUID ESPGuid = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
119//there is assumed only one ESP partition. What if there are two HDD gpt formatted?
120EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir)
121{
122 EFI_STATUS Status;
123 UINTN HandleCount = 0;
124 EFI_HANDLE *Handles;
125
126 Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiPartTypeSystemPartGuid, NULL, &HandleCount, &Handles);
127 if (!EFI_ERROR(Status) && HandleCount > 0) {
128 *RootDir = EfiLibOpenRoot(Handles[0]);
129 if (*RootDir == NULL)
130 Status = EFI_NOT_FOUND;
131 FreePool(Handles);
132 }
133 return Status;
134}
135//if (NULL, ...) then save to EFI partition
136EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *FileName,
137 IN CONST VOID *FileData, IN UINTN FileDataLength)

Callers 3

GetDebugLogFileFunction · 0.85
egSaveFileFunction · 0.85
egMkDirFunction · 0.85

Calls 2

EfiLibOpenRootFunction · 0.70
FreePoolFunction · 0.50

Tested by

no test coverage detected