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

Function ReadHeader

BaseTools/Source/C/VolInfo/VolInfo.c:721–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719}
720
721STATIC
722EFI_STATUS
723ReadHeader (
724 IN FILE *InputFile,
725 OUT UINT32 *FvSize,
726 OUT BOOLEAN *ErasePolarity
727 )
728/*++
729
730Routine Description:
731
732 This function determines the size of the FV and the erase polarity. The
733 erase polarity is the FALSE value for file state.
734
735Arguments:
736
737 InputFile The file that contains the FV image.
738 FvSize The size of the FV.
739 ErasePolarity The FV erase polarity.
740
741Returns:
742
743 EFI_SUCCESS Function completed successfully.
744 EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
745 EFI_ABORTED The function encountered an error.
746
747--*/
748{
749 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
750 EFI_FV_BLOCK_MAP_ENTRY BlockMap;
751 UINTN Signature[2];
752 UINTN BytesRead;
753 UINT32 Size;
754 size_t ReadSize;
755
756 BytesRead = 0;
757 Size = 0;
758 //
759 // Check input parameters
760 //
761 if (InputFile == NULL || FvSize == NULL || ErasePolarity == NULL) {
762 Error (__FILE__, __LINE__, 0, "application error", "invalid parameter to function");
763 return EFI_INVALID_PARAMETER;
764 }
765 //
766 // Read the header
767 //
768 ReadSize = fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
769 if (ReadSize != 1) {
770 return EFI_ABORTED;
771 }
772 BytesRead = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY);
773 Signature[0] = VolumeHeader.Signature;
774 Signature[1] = 0;
775
776 //
777 // Print FV header information
778 //

Callers 1

mainFunction · 0.85

Calls 4

freadFunction · 0.85
printfFunction · 0.85
ErrorFunction · 0.50
PrintGuidFunction · 0.50

Tested by

no test coverage detected