Signed-off-by: Konstantin Demin rockdrilla@gmail.com
-- v3: winebuild: Zero space between Wine signature and PE header in "builtin" files.
From: Konstantin Demin rockdrilla@gmail.com
Signed-off-by: Konstantin Demin rockdrilla@gmail.com --- tools/winebuild/spec32.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 6e4131bd910..74ebde37e20 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -1360,7 +1360,11 @@ void output_def_file( DLLSPEC *spec, int import_only ) */ void make_builtin_files( struct strarray files ) { - int i, fd; + int i, fd, n, k; + unsigned int pos; + unsigned short dll_charact; + unsigned char pad[32]; + struct { unsigned short e_magic; @@ -1368,6 +1372,7 @@ void make_builtin_files( struct strarray files ) unsigned int e_lfanew; } header;
+ memset( pad, 0, sizeof(pad) ); for (i = 0; i < files.count; i++) { if ((fd = open( files.str[i], O_RDWR | O_BINARY )) == -1) @@ -1378,10 +1383,20 @@ void make_builtin_files( struct strarray files ) fatal_error( "%s: Not enough space (%x) for Wine signature\n", files.str[i], header.e_lfanew ); write( fd, builtin_signature, sizeof(builtin_signature) );
+ /* zero remaining space between Wine signature and PE header */ + n = (int) header.e_lfanew - (int) (sizeof(header) + sizeof(builtin_signature)); + if (n > 0) + { + for (k = n / sizeof(pad); k; k--) + write( fd, &pad, sizeof(pad) ); + + if ((k = n % sizeof(pad))) + write( fd, &pad, k ); + } + if (prefer_native) { - unsigned int pos = header.e_lfanew + 0x5e; /* OptionalHeader.DllCharacteristics */ - unsigned short dll_charact; + pos = header.e_lfanew + 0x5e; /* OptionalHeader.DllCharacteristics */ lseek( fd, pos, SEEK_SET ); if (read( fd, &dll_charact, sizeof(dll_charact) ) == sizeof(dll_charact)) {
Please explain why this is necessary.
This is mostly cosmetic change to wipe remaining "garbage" after Wine builtin signature and before PE header.
That doesn't seem necessary.
Another try: current code is not ISO C90 compliant.
Another try: current code is not ISO C90 compliant.
If you mean the variable declarations, it's perfectly compliant. Please don't change things without a good reason.
This merge request was closed by Alexandre Julliard.