Alexandre Julliard : winebuild: Set PE timestamps to a hash of the file name.
Alexandre Julliard
julliard at winehq.org
Tue Mar 23 15:07:43 CDT 2021
Module: wine
Branch: oldstable
Commit: 74475ea34114c053c52e1b8c4e1a367d5e0d229f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=74475ea34114c053c52e1b8c4e1a367d5e0d229f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Oct 29 16:49:29 2020 +0100
winebuild: Set PE timestamps to a hash of the file name.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44061
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d5c089f5fa71e2ae568b2f1bcb9158223c552040)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
tools/winebuild/spec32.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 7abeb08140a..8e5217cc717 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -51,6 +51,14 @@ int needs_get_pc_thunk = 0;
static const char builtin_signature[32] = "Wine builtin DLL";
static const char fakedll_signature[32] = "Wine placeholder DLL";
+static unsigned int hash_filename( const char *name )
+{
+ /* FNV-1 hash */
+ unsigned int ret = 2166136261u;
+ while (*name) ret = (ret * 16777619) ^ *name++;
+ return ret;
+}
+
/* check if entry point needs a relay thunk */
static inline int needs_relay( const ORDDEF *odp )
{
@@ -398,7 +406,7 @@ void output_exports( DLLSPEC *spec )
/* export directory header */
output( "\t.long 0\n" ); /* Characteristics */
- output( "\t.long 0\n" ); /* TimeDateStamp */
+ output( "\t.long %u\n", hash_filename(spec->file_name) ); /* TimeDateStamp */
output( "\t.long 0\n" ); /* MajorVersion/MinorVersion */
output_rva( ".L__wine_spec_exp_names" ); /* Name */
output( "\t.long %u\n", spec->base ); /* Base */
@@ -695,7 +703,7 @@ void output_module( DLLSPEC *spec )
output( "\t.short 0x%04x\n", /* Machine */
machine );
output( "\t.short 0\n" ); /* NumberOfSections */
- output( "\t.long 0\n" ); /* TimeDateStamp */
+ output( "\t.long %u\n", hash_filename(spec->file_name) ); /* TimeDateStamp */
output( "\t.long 0\n" ); /* PointerToSymbolTable */
output( "\t.long 0\n" ); /* NumberOfSymbols */
output( "\t.short %d\n", /* SizeOfOptionalHeader */
@@ -850,7 +858,7 @@ void output_fake_module( DLLSPEC *spec )
case CPU_ARM64: put_word( IMAGE_FILE_MACHINE_ARM64 ); break;
}
put_word( nb_sections ); /* NumberOfSections */
- put_dword( 0 ); /* TimeDateStamp */
+ put_dword( hash_filename(spec->file_name) ); /* TimeDateStamp */
put_dword( 0 ); /* PointerToSymbolTable */
put_dword( 0 ); /* NumberOfSymbols */
put_word( get_ptr_size() == 8 ?
More information about the wine-cvs
mailing list