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@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-10-29 16:49:29 +01:00
parent 488ec98bf2
commit d5c089f5fa
1 changed files with 11 additions and 3 deletions

View File

@ -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 ?