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

Function GetFileByName

BaseTools/Source/C/Common/FvLib.c:217–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217EFI_STATUS
218GetFileByName (
219 IN EFI_GUID *FileName,
220 OUT EFI_FFS_FILE_HEADER **File
221 )
222/*++
223
224Routine Description:
225
226 Find a file by name. The function will return NULL if the file is not found.
227
228Arguments:
229
230 FileName The GUID file name of the file to search for.
231 File Return pointer. In the case of an error, contents are undefined.
232
233Returns:
234
235 EFI_SUCCESS The function completed successfully.
236 EFI_ABORTED An error was encountered.
237 EFI_INVALID_PARAMETER One of the parameters was NULL.
238
239--*/
240{
241 EFI_FFS_FILE_HEADER *CurrentFile;
242 EFI_STATUS Status;
243 CHAR8 FileGuidString[80];
244
245 //
246 // Verify library has been initialized.
247 //
248 if (mFvHeader == NULL || mFvLength == 0) {
249 return EFI_ABORTED;
250 }
251 //
252 // Verify input parameters
253 //
254 if (FileName == NULL || File == NULL) {
255 return EFI_INVALID_PARAMETER;
256 }
257 //
258 // File Guid String Name
259 //
260 PrintGuidToBuffer (FileName, (UINT8 *)FileGuidString, sizeof (FileGuidString), TRUE);
261 //
262 // Verify FV header
263 //
264 Status = VerifyFv (mFvHeader);
265 if (EFI_ERROR (Status)) {
266 return EFI_ABORTED;
267 }
268 //
269 // Get the first file
270 //
271 Status = GetNextFile (NULL, &CurrentFile);
272 if (EFI_ERROR (Status)) {
273 Error (NULL, 0, 0003, "error parsing FV image", "FFS file with Guid %s can't be found", FileGuidString);
274 return EFI_ABORTED;

Callers

nothing calls this directly

Calls 5

PrintGuidToBufferFunction · 0.85
GetNextFileFunction · 0.85
VerifyFvFunction · 0.70
ErrorFunction · 0.70
CompareGuidFunction · 0.70

Tested by

no test coverage detected