[PATCH rebase 2/2] rebase: Don't update the PE header timestamp unless -t is used
Christian Franke
Christian.Franke@t-online.de
Sat Aug 12 12:29:51 GMT 2023
This changes existing behavior but a new option --keep-timestamp is IMO
not needed.
--
Regards,
Christian
-------------- next part --------------
From 1c13ccb047ebfbcd2f239bedcd50a128fec659e9 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Sat, 12 Aug 2023 14:17:04 +0200
Subject: [PATCH] rebase: Don't update the PE header timestamp unless -t is
used
This enables reproducible rebase.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
---
imagehelper/rebaseimage.cc | 6 ++++--
rebase.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/imagehelper/rebaseimage.cc b/imagehelper/rebaseimage.cc
index 8827a14..0dec93c 100755
--- a/imagehelper/rebaseimage.cc
+++ b/imagehelper/rebaseimage.cc
@@ -111,12 +111,14 @@ BOOL ReBaseImage64 (
if (dll.is64bit ())
{
ntheader64->OptionalHeader.ImageBase = *NewImageBase;
- ntheader64->FileHeader.TimeDateStamp = TimeStamp;
+ if (ReBaseChangeFileTime)
+ ntheader64->FileHeader.TimeDateStamp = TimeStamp;
}
else
{
ntheader32->OptionalHeader.ImageBase = *NewImageBase;
- ntheader32->FileHeader.TimeDateStamp = TimeStamp;
+ if (ReBaseChangeFileTime)
+ ntheader32->FileHeader.TimeDateStamp = TimeStamp;
}
int64_t difference = *NewImageBase - *OldImageBase;
diff --git a/rebase.c b/rebase.c
index 20a9902..6a531d0 100644
--- a/rebase.c
+++ b/rebase.c
@@ -1687,7 +1687,8 @@ Rebase PE files, usually DLLs, to a specified address or address range.\n\
-o, --offset=OFFSET Specify an additional offset between adjacent DLLs\n\
when rebasing. Default is no offset.\n\
-t, --touch Use this option to make sure the file's modification\n\
- time is bumped if it has been successfully rebased.\n\
+ time and the timestamp in the PE header are bumped if\n\
+ the file has been successfully rebased.\n\
Usually rebase does not change the file's time unless\n\
the -c flag is also specified.\n\
-T, --filelist=FILE Also rebase the files specified in FILE. The format\n\
--
2.39.0
More information about the Cygwin-apps
mailing list