From bde21731933bbfb01bf85725ec004e4652a85480 Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 26 Oct 2017 16:37:42 +0000 Subject: [PATCH] Only print the PE flags string for actual PE executable files. Now also zeros the checksum just in case. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6943 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/history.but | 2 +- SCons/utils.py | 99 ++++++++++++++++++++++++++++++++------------ SConstruct | 19 +++++---- 3 files changed, 85 insertions(+), 35 deletions(-) diff --git a/Docs/src/history.but b/Docs/src/history.but index 7c2fb70c..40083e91 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -26,7 +26,7 @@ Released on ??? ??rd, 20?? \b Added IntOp and System::Int64Op >>> operator -\b Plug-ins now set the ASLR, DEP, LAA and NOSEH PE flags (\W{http://sf.net/p/nsis/bugs/1188}{bug #1188}) +\b Plug-ins now set the ASLR, DEP, LAA, NOSEH and TS PE flags (\W{http://sf.net/p/nsis/bugs/1188}{bug #1188}) \b MakeNSIS exits with code 0 for various information commands (\W{http://sf.net/p/nsis/bugs/1193}{bug #1193}) diff --git a/SCons/utils.py b/SCons/utils.py index b0f250d4..1d561e90 100644 --- a/SCons/utils.py +++ b/SCons/utils.py @@ -131,38 +131,85 @@ def GetOptionOrEnv(name, defval = None): return os.environ[name] return defval -def EnablePESecurityFlagsHelper(filepath): +import struct +def FileUnpackRead(pack, size, f, fpos=None, defval=None): + r = defval + try: + if not fpos is None: f.seek(fpos) + r = struct.unpack(pack, f.read(size))[0] + finally: + return r +def ReadU16LE(f, fpos=None, defval=None): + return FileUnpackRead("