Browse Source

BaseTools/VolInfo: Correct buffer for GenCrc32 tool

If the guided section was encoded with GenCrc32 tool the resulting
'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of
the meaningfull data that follows the CRC32 value.
But if we want to decode the section with GenCrc32 tool we need to
provide a buffer that includes the CRC32 value itself.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Konstantin Aladyshev 1 year ago
parent
commit
9fc029ee62
1 changed files with 7 additions and 0 deletions
  1. 7 0
      BaseTools/Source/C/VolInfo/VolInfo.c

+ 7 - 0
BaseTools/Source/C/VolInfo/VolInfo.c

@@ -2009,6 +2009,13 @@ Returns:
           );
         free (ExtractionTool);
 
+        if (!CompareGuid (
+               EfiGuid,
+               &gEfiCrc32GuidedSectionExtractionProtocolGuid
+               )
+           ) {
+          DataOffset -= 4;
+        }
         Status =
           PutFileImage (
             ToolInputFile,