Alexandre Julliard : winebuild: Set PE timestamps to a hash of the file name.

Alexandre Julliard julliard at winehq.org
Thu Oct 29 16:32:08 CDT 2020


Module: wine
Branch: master
Commit: d5c089f5fa71e2ae568b2f1bcb9158223c552040
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d5c089f5fa71e2ae568b2f1bcb9158223c552040

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>

---

 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 efb136a8e61..ba2edfb588f 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 )
 {
@@ -405,7 +413,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 */
@@ -666,7 +674,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 */
@@ -817,7 +825,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