]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix PE header of the VS2015 builds so they run on Windows XP.
authorSimon Tatham <anakin@pobox.com>
Sat, 21 Jan 2017 14:55:53 +0000 (14:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 21 Jan 2017 14:55:53 +0000 (14:55 +0000)
By default the VS2015 linker produces binaries with the minimum
version fields in the PE header set to 06.00, which causes XP not to
recognise them as valid binaries at all. But there's no other reason
VS2015-built binaries _can't_ run on versions of Windows as old as XP;
so here I add the link option to set those fields to 05.01 which makes
XP like them again.

This only applies to the 32-bit build, because the VS2015 64-bit
linker refuses to lower the min version field to under 06.00.

Buildscr
mkfiles.pl

index 9ea88a84ff77c2b611085a4bd9e5c3a418554d65..a476ff75c31774492f11021fe20cd18eb3210565 100644 (file)
--- a/Buildscr
+++ b/Buildscr
@@ -160,8 +160,10 @@ delegate windows
   # Build the original binaries.
   in putty/windows with visualstudio do/win mkdir buildold && nmake -f Makefile.vc BUILDDIR=buildold\ $(Makeargs) all cleantestprogs
 
-  # Build the VS2015 binaries.
-  in putty/windows with visualstudio2015_32bit do/win mkdir build32 && nmake -f Makefile.vc BUILDDIR=build32\ $(Makeargs) all cleantestprogs
+  # Build the VS2015 binaries. For the 32-bit ones, we set a subsystem
+  # version of 5.01, which allows the resulting files to still run on
+  # Windows XP.
+  in putty/windows with visualstudio2015_32bit do/win mkdir build32 && nmake -f Makefile.vc BUILDDIR=build32\ SUBSYSVER=,5.01 $(Makeargs) all cleantestprogs
   in putty/windows with visualstudio2015_64bit do/win mkdir build64 && nmake -f Makefile.vc BUILDDIR=build64\ $(Makeargs) all cleantestprogs
 
   # Code-sign the binaries, if the local bob config provides a script
index 3e42c7345edbdce39494b157dfee958653267497..4a2b3b4dcca8182a8091e884310541315349f871 100755 (executable)
@@ -676,7 +676,7 @@ if (defined $makefiles{'vc'}) {
            print "$objlines[$i]\n";
        }
        print "<<\n";
-       print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:\$(BUILDDIR)$prog.exe -map:\$(BUILDDIR)$prog.map -nologo -subsystem:$subsys \@$inlinefilename\n\n";
+       print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:\$(BUILDDIR)$prog.exe -map:\$(BUILDDIR)$prog.map -nologo -subsystem:$subsys\$(SUBSYSVER) \@$inlinefilename\n\n";
     }
     foreach $d (&deps("\$(BUILDDIR)X.obj", "\$(BUILDDIR)X.res", $dirpfx, "\\", "vc")) {
         $extradeps = $forceobj{$d->{obj_orig}} ? ["*.c","*.h","*.rc"] : [];