Liming,
the reason i want to maintain the version information is so that I can deduce 
the version of the file by parsing the PE header, from a non-efi environment.
------------------------------

Message: 7
Date: Thu, 29 Oct 2015 09:15:07 +0000
From: "Gao, Liming" <[email protected]>
To: "Miller, Carl H" <[email protected]>, "[email protected]"
        <[email protected]>
Subject: Re: [edk2] [PATCH] BaseTools/GenFw: add option to retain
        image   version info
Message-ID:
        <4a89e2ef3dfedb4c8bfde51014f606a112e60...@shsmsx102.ccr.corp.intel.com>
        
Content-Type: text/plain; charset="us-ascii"

Carl:
  Could you let me how you uses the version information in application .EFI 
file?

Thanks
Liming
From: Miller, Carl H [mailto:[email protected]]
Sent: Wednesday, October 28, 2015 10:32 PM
To: [email protected]
Cc: Zhu, Yonghong; Gao, Liming
Subject: [PATCH] BaseTools/GenFw: add option to retain image version info


add a command line option("-leaveversion") to GenFw to retain the version 
information in application .EFI files.



Cc: M: Yonghong Zhu <[email protected]<mailto:[email protected]>>

       M: Liming Gao <[email protected]<mailto:[email protected]>>

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Thompson, James J 
<[email protected]<mailto:[email protected]>>

---
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index 4756c52..eea131f 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -1078,6 +1078,7 @@ Returns:
   UNWIND_INFO                      *UnwindInfo;
   STATUS                           Status;
   BOOLEAN                          ReplaceFlag;
+  BOOLEAN                          LeaveVersionFlag;
   BOOLEAN                          KeepExceptionTableFlag;
   BOOLEAN                          KeepZeroPendingFlag;
   UINT64                           LogLevel;
@@ -1140,6 +1141,7 @@ Returns:
   InputFileLength   = 0;
   Optional32        = NULL;
   Optional64        = NULL;
+  LeaveVersionFlag  = FALSE;
   KeepExceptionTableFlag = FALSE;
   KeepZeroPendingFlag    = FALSE;
   NumberOfFormPacakge    = 0;
@@ -1262,7 +1264,14 @@ Returns:
       continue;
     }

-    if (stricmp (argv[0], "--keepexceptiontable") == 0) {
+             if (stricmp(argv[0], "--leaveversion") == 0) {
+                             LeaveVersionFlag = TRUE;
+                             argc--;
+                             argv++;
+                             continue;
+             }
+
+             if (stricmp(argv[0], "--keepexceptiontable") == 0) {
       KeepExceptionTableFlag = TRUE;
       argc --;
       argv ++;
@@ -2397,8 +2406,10 @@ Returns:
     Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
     Optional64->MajorOperatingSystemVersion = 0;
     Optional64->MinorOperatingSystemVersion = 0;
-    Optional64->MajorImageVersion           = 0;
-    Optional64->MinorImageVersion           = 0;
+             if (!LeaveVersionFlag) {
+                             Optional64->MajorImageVersion = 0;
+                             Optional64->MinorImageVersion = 0;
+             }
     Optional64->MajorSubsystemVersion       = 0;
     Optional64->MinorSubsystemVersion       = 0;
     Optional64->Win32VersionValue           = 0;


------------------------------

Subject: Digest Footer

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel


------------------------------

End of edk2-devel Digest, Vol 4, Issue 214
***
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to