| 215 | } |
| 216 | |
| 217 | EFI_STATUS |
| 218 | GetFileByName ( |
| 219 | IN EFI_GUID *FileName, |
| 220 | OUT EFI_FFS_FILE_HEADER **File |
| 221 | ) |
| 222 | /*++ |
| 223 | |
| 224 | Routine Description: |
| 225 | |
| 226 | Find a file by name. The function will return NULL if the file is not found. |
| 227 | |
| 228 | Arguments: |
| 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 | |
| 233 | Returns: |
| 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; |
nothing calls this directly
no test coverage detected