| 24 | #include <Library/UefiBootServicesTableLib.h> |
| 25 | |
| 26 | EFI_STATUS |
| 27 | GetFileData ( |
| 28 | IN EFI_FILE_PROTOCOL *File, |
| 29 | IN UINT32 Position, |
| 30 | IN UINT32 Size, |
| 31 | OUT UINT8 *Buffer |
| 32 | ) |
| 33 | { |
| 34 | EFI_STATUS Status; |
| 35 | UINTN ReadSize; |
| 36 | |
| 37 | Status = File->SetPosition (File, Position); |
| 38 | if (EFI_ERROR(Status)) { |
| 39 | return Status; |
| 40 | } |
| 41 | |
| 42 | ReadSize = Size; |
| 43 | Status = File->Read (File, &ReadSize, Buffer); |
| 44 | File->SetPosition (File, 0); |
| 45 | if (EFI_ERROR(Status)) { |
| 46 | return Status; |
| 47 | } |
| 48 | |
| 49 | if (ReadSize != Size) { |
| 50 | return EFI_BAD_BUFFER_SIZE; |
| 51 | } |
| 52 | |
| 53 | return EFI_SUCCESS; |
| 54 | } |
| 55 | |
| 56 | EFI_STATUS |
| 57 | GetFileSize ( |
no test coverage detected