diff options
author | Didier Raboud <odyx@debian.org> | 2018-03-31 20:38:24 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2018-03-31 20:38:24 +0200 |
commit | 36a80a538998a5475f871ecb9712664b19f7fc89 (patch) | |
tree | 04e22bfc9921070dcaa1d1693dc764028e7cf7d3 /Source | |
parent | 011cf00c4909a88482ed4fd6a8f45336780d766e (diff) |
Import Upstream version 2.43
Diffstat (limited to 'Source')
83 files changed, 1107 insertions, 175 deletions
diff --git a/Source/7zip/LZMADecode.c b/Source/7zip/LZMADecode.c index 2f9df47..0635b01 100755 --- a/Source/7zip/LZMADecode.c +++ b/Source/7zip/LZMADecode.c @@ -4,7 +4,7 @@ * This file is a part of LZMA compression module for NSIS. * * Original LZMA SDK Copyright (C) 1999-2006 Igor Pavlov - * Modifications Copyright (C) 2003-2008 Amir Szekely <kichik@netvision.net.il> + * Modifications Copyright (C) 2003-2009 Amir Szekely <kichik@netvision.net.il> * * Licensed under the Common Public License version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/7zip/LZMADecode.h b/Source/7zip/LZMADecode.h index 1445c0e..68c7865 100755 --- a/Source/7zip/LZMADecode.h +++ b/Source/7zip/LZMADecode.h @@ -4,7 +4,7 @@ * This file is a part of LZMA compression module for NSIS. * * Original LZMA SDK Copyright (C) 1999-2006 Igor Pavlov - * Modifications Copyright (C) 2003-2008 Amir Szekely <kichik@netvision.net.il> + * Modifications Copyright (C) 2003-2009 Amir Szekely <kichik@netvision.net.il> * * Licensed under the Common Public License version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/Platform.h b/Source/Platform.h index c64435a..cb45ba1 100755 --- a/Source/Platform.h +++ b/Source/Platform.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ #ifdef _WIN32 # include <windows.h> # include <commctrl.h> +# include <shellapi.h> #else # ifndef EXEHEAD # include <string.h> @@ -56,6 +57,7 @@ typedef unsigned int UINT_PTR; // basic stuff typedef void * HANDLE; typedef HANDLE HWND; +typedef HANDLE HMODULE; typedef unsigned long HKEY; // some gdi typedef unsigned long COLORREF; @@ -142,27 +144,6 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG; # endif #endif -// Added by Dave Laundon 19th August 2002 -// For all internal functions, use of stdcall calling convention moves the -// responsibility for tidying the stack to callee from caller, reducing the code -// involved considerably. Gives an instant saving of 0.5K. -// NB - the zlib and bzip2 portions have been given the same treatment, but with -// project compiler-options settings and/or project-wide defines. -// NB - safer for NSIS's routines to be defined explicitly to avoid problems -// calling DLL functions. -#if defined(_WIN32) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)) -# define NSISCALL __stdcall // Ordinary functions -# define NSISCALLV __cdecl // Variable-argument-list functions -#else -# if defined(__GNUC__) && defined(__i386__) -# define NSISCALL __attribute__((__stdcall__)) // Ordinary functions -# define NSISCALLV __attribute__((__cdecl__)) // Variable-argument-list functions -# else -# define NSISCALL -# define NSISCALLV -# endif -#endif - #if defined(__GNUC__) #define UNUSED __attribute__((unused)) #else diff --git a/Source/Plugins.cpp b/Source/Plugins.cpp index ddd0ff5..6872b28 100755 --- a/Source/Plugins.cpp +++ b/Source/Plugins.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/Plugins.h b/Source/Plugins.h index 54a668a..d15d7cf 100755 --- a/Source/Plugins.h +++ b/Source/Plugins.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ResourceEditor.cpp b/Source/ResourceEditor.cpp index 8aefefc..8509414 100755 --- a/Source/ResourceEditor.cpp +++ b/Source/ResourceEditor.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 2002-2008 Amir Szekely <kichik@users.sourceforge.net> + * Copyright (C) 2002-2009 Amir Szekely <kichik@users.sourceforge.net> * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -125,10 +125,11 @@ PRESOURCE_DIRECTORY CResourceEditor::GetResourceDirectory( // Construction/Destruction ////////////////////////////////////////////////////////////////////// -CResourceEditor::CResourceEditor(BYTE* pbPE, int iSize) { +CResourceEditor::CResourceEditor(BYTE* pbPE, int iSize, bool bKeepData /*=true*/) { // Copy the data pointer m_pbPE = pbPE; m_iSize = iSize; + m_bKeepData = bKeepData; // Get NT headers m_ntHeaders = GetNTHeaders(m_pbPE); @@ -270,6 +271,9 @@ bool CResourceEditor::UpdateResource(WORD szType, WORD szName, LANGID wLanguage, // Returns a copy of the requested resource // Returns 0 if the requested resource can't be found BYTE* CResourceEditor::GetResourceW(WCHAR* szType, WCHAR* szName, LANGID wLanguage) { + if (!m_bKeepData) + throw runtime_error("Can't GetResource() when bKeepData is false"); + CResourceDirectory* nameDir = 0; CResourceDirectory* langDir = 0; CResourceDataEntry* data = 0; @@ -398,6 +402,9 @@ void CResourceEditor::FreeResource(BYTE* pbResource) // Saves the edited PE into a buffer and returns it. DWORD CResourceEditor::Save(BYTE* pbBuf, DWORD &dwSize) { + if (!m_bKeepData) + throw runtime_error("Can't Save() when bKeepData is false"); + unsigned int i; DWORD dwReqSize; @@ -478,7 +485,7 @@ DWORD CResourceEditor::Save(BYTE* pbBuf, DWORD &dwSize) { // Set the new BaseOfData if needed if (ntHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) { DWORD* pdwBaseOfData = &((PIMAGE_OPTIONAL_HEADER32)&ntHeaders->OptionalHeader)->BaseOfData; - if (*pdwBaseOfData > m_dwResourceSectionVA) + if (ConvertEndianness(*pdwBaseOfData) > m_dwResourceSectionVA) *pdwBaseOfData = AdjustVA(*pdwBaseOfData, dwVAAdjustment); } @@ -624,6 +631,18 @@ CResourceDirectory* CResourceEditor::ScanDirectory(PRESOURCE_DIRECTORY rdRoot, P LPBYTE pbData = (LPBYTE)rdRoot + ConvertEndianness(rde->OffsetToData) - m_dwResourceSectionVA; DWORD dwOffset = DWORD(pbData - m_pbPE); + if (m_bKeepData) + { + if (dwOffset > DWORD(m_iSize)) + { + throw runtime_error("Invalid resource entry data pointer, possibly compressed resources"); + } + } + else + { + pbData = m_pbPE; // dummy pointer to "nothing" + } + rdc->AddEntry( new CResourceDirectoryEntry( szName, diff --git a/Source/ResourceEditor.h b/Source/ResourceEditor.h index 5174e4d..59def2e 100755 --- a/Source/ResourceEditor.h +++ b/Source/ResourceEditor.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 2002-2008 Amir Szekely <kichik@users.sourceforge.net> + * Copyright (C) 2002-2009 Amir Szekely <kichik@users.sourceforge.net> * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ typedef struct RESOURCE_DIRECTORY { ) class CResourceEditor { public: - CResourceEditor(BYTE* pbPE, int iSize); + CResourceEditor(BYTE* pbPE, int iSize, bool bKeepData = true); virtual ~CResourceEditor(); bool UpdateResource(WORD szType, WORD szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize); @@ -144,6 +144,7 @@ public: private: BYTE* m_pbPE; int m_iSize; + bool m_bKeepData; PIMAGE_NT_HEADERS m_ntHeaders; diff --git a/Source/ResourceVersionInfo.cpp b/Source/ResourceVersionInfo.cpp index 655ff7d..e3a6053 100755 --- a/Source/ResourceVersionInfo.cpp +++ b/Source/ResourceVersionInfo.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ResourceVersionInfo.h b/Source/ResourceVersionInfo.h index 8152526..cd6512c 100755 --- a/Source/ResourceVersionInfo.h +++ b/Source/ResourceVersionInfo.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ShConstants.cpp b/Source/ShConstants.cpp index a70384a..a1a7997 100755 --- a/Source/ShConstants.cpp +++ b/Source/ShConstants.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/Tests/SConscript b/Source/Tests/SConscript index b6c510b..3ee5023 100755 --- a/Source/Tests/SConscript +++ b/Source/Tests/SConscript @@ -82,6 +82,7 @@ extralibs = Split(""" scripts = Split(""" preprocessor.nsi + winver.nsi """) Import('env AddAvailableLibs') diff --git a/Source/Tests/winver.nsi b/Source/Tests/winver.nsi new file mode 100755 index 0000000..b2843ec --- /dev/null +++ b/Source/Tests/winver.nsi @@ -0,0 +1,677 @@ +####
+#
+# This massive script tests WinVer's version, SP, platform and server detection.
+# It also tests comparison of version and SP with every other available version.
+#
+# To make this work on one computer, a script storing the result of GetVersionEx
+# was executed on a number of different Windows versions. Using a hack in WinVer
+# this script replaces this computer's results with the ones from the script and
+# runs the tests for every stored result.
+#
+# To add a test for another version, use the following script.
+#
+# !include LogicLib.nsh
+#
+# OutFile WinVer.exe
+# ShowInstDetails show
+#
+# Function PrintSysVersion
+#
+# System::Alloc 156
+# Pop $0
+# System::Call *$0(ir1)
+# System::Call kernel32::GetVersionEx(ir0)i.R0
+#
+# DetailPrint 'StrCpy $2_RES $R0'
+#
+# System::Call '*$0(i.R0,i.R1,i.R2,i.R3,i.R4,&t128.R5,&i2.R6,&i2.R7,&i2.R8,&i1.R9,&i1)'
+# DetailPrint 'StrCpy $2_CSD "$R5"'
+# DetailPrint 'StrCpy $2_INIT "i $R0, i $R1, i $R2, i $R3, i $R4, &t128 s, &i2 $R6, &i2 $R7, &i2 $R8, &i1 $R9, &i1 0"'
+#
+# StrCpy $R0 $0
+# IntOp $R1 $R0 + $1
+# IntOp $R1 $R1 - 1
+# StrCpy $R3 '# '
+#
+# ${For} $R2 $R0 $R1
+#
+# System::Call *$R2(&i1.R4)
+# IntFmt $R4 %02x $R4
+# StrCpy $R3 $R3$R4
+#
+# ${Next}
+#
+# DetailPrint $R3
+#
+# System::Free $0
+#
+# FunctionEnd
+#
+# Section
+#
+# DetailPrint "# OSVERSIONINFOEX"
+#
+# StrCpy $1 156
+# StrCpy $2 "$$OSVERSIONINFOEX"
+# Call PrintSysVersion
+#
+# DetailPrint ""
+#
+# DetailPrint "# OSVERSIONINFO"
+#
+# StrCpy $1 148
+# StrCpy $2 "$$OSVERSIONINFO"
+# Call PrintSysVersion
+#
+# SectionEnd
+#
+#
+# EXPECTED RESULTS
+#
+# SUCCESS Windows 95 OSR B
+# SUCCESS Windows 98
+# SUCCESS Windows ME
+# Server detection failed for Windows NT4 SP1
+# Expected: server
+# Got: client
+# FAILURE Windows NT4 SP1
+# SUCCESS Windows NT4 SP6
+# SUCCESS Windows 2000
+# SUCCESS Windows 2000 SP4
+# SUCCESS Windows XP SP2
+# SUCCESS Windows XP SP3
+# SUCCESS Windows XP x64 SP1
+# SUCCESS Windows Vista
+# SUCCESS Windows Server 2008
+# Completed
+#
+# FAILURES
+#
+# * On NT4 below SP6, the registry has to be checked to figure out if it's
+# a server or not. WinVer doesn't do that yet.
+#
+#
+####
+
+Name winver
+OutFile winver.exe
+
+XPStyle on
+ShowInstDetails show
+
+Var OSVERSIONINFO_RES
+Var OSVERSIONINFO_CSD
+Var OSVERSIONINFO_INIT
+Var OSVERSIONINFOEX_RES
+Var OSVERSIONINFOEX_CSD
+Var OSVERSIONINFOEX_INIT
+
+!macro __WinVer_Call_GetVersionEx STRUCT_SIZE
+
+ !if ${STRUCT_SIZE} == ${OSVERSIONINFOA_SIZE}
+
+ StrCpy $3 $OSVERSIONINFO_RES
+ Push $OSVERSIONINFO_CSD
+ System::Call '*$0($OSVERSIONINFO_INIT)'
+
+ !endif
+
+ !if ${STRUCT_SIZE} == ${OSVERSIONINFOEXA_SIZE}
+
+ StrCpy $3 $OSVERSIONINFOEX_RES
+ Push $OSVERSIONINFOEX_CSD
+ System::Call '*$0($OSVERSIONINFOEX_INIT)'
+
+ !endif
+
+!macroend
+
+!include WinVer.nsh
+!insertmacro __WinVer_DeclareVars
+
+!macro TestWinVerDiff NAME VER V_
+
+ !if ${VER} != ${V_}
+
+ ${If} ${IsWin${V_}}
+
+ DetailPrint "Version detection failed for ${NAME}"
+ DetailPrint " Expected: ${VER}"
+ DetailPrint " Got: ${V_}"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ !endif
+
+!macroend
+
+!define ORDER_95 0
+!define ORDER_NT4 0
+!define ORDER_98 1
+!define ORDER_ME 2
+!define ORDER_2000 3
+!define ORDER_XP 4
+!define ORDER_2003 5
+!define ORDER_Vista 6
+!define ORDER_2008 7
+
+!macro TestWinVerOrder NAME VER V_
+
+ !if ${ORDER_${VER}} >= ${ORDER_${V_}}
+
+ ${IfNot} ${AtLeastWin${V_}}
+
+ DetailPrint "Version comparison failed for ${NAME}"
+ DetailPrint " Expected: ${VER} >= ${V_}"
+ DetailPrint " Got: ${VER} < ${V_}"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ !endif
+
+ !if ${ORDER_${VER}} <= ${ORDER_${V_}}
+
+ ${IfNot} ${AtMostWin${V_}}
+
+ DetailPrint "Version comparison failed for ${NAME}"
+ DetailPrint " Expected: ${VER} <= ${V_}"
+ DetailPrint " Got: ${VER} > ${V_}"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ !endif
+
+!macroend
+
+!macro TestWinVer NAME VER SP SERVER PLATFORM
+
+ StrCpy $R0 "SUCCESS"
+
+ StrCpy $__WINVERV ""
+ StrCpy $__WINVERSP ""
+
+ # test version equality
+
+ ${IfNot} ${IsWin${VER}}
+ ${OrIfNot} ${AtLeastWin${VER}}
+ ${OrIfNot} ${AtMostWin${VER}}
+
+ DetailPrint "Version detection failed for ${NAME}"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} 95
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} 98
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} ME
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} NT4
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} 2000
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} XP
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} 2003
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} Vista
+ !insertmacro TestWinVerDiff "${NAME}" ${VER} 2008
+
+ # test version comparison
+
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} 95
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} 98
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} ME
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} NT4
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} 2000
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} XP
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} 2003
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} Vista
+ !insertmacro TestWinVerOrder "${NAME}" ${VER} 2008
+
+ # test service pack equality
+
+ IntOp $0 ${SP} - 1
+ IntOp $1 ${SP} + 1
+
+ ${IfNot} ${IsServicePack} ${SP}
+ ${OrIf} ${IsServicePack} $0
+ ${OrIf} ${IsServicePack} $1
+
+ ${WinVerGetServicePackLevel} $2
+
+ DetailPrint "Service pack detection failed for ${NAME}"
+ DetailPrint " Expected: ${SP}"
+ DetailPrint " Got: $2"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ # test service pack comparison
+
+ ${IfNot} ${AtLeastServicePack} ${SP}
+ ${OrIfNot} ${AtLeastServicePack} $0
+ ${OrIfNot} ${AtMostServicePack} ${SP}
+ ${OrIfNot} ${AtMostServicePack} $1
+
+ DetailPrint "Service pack comparison failed for ${NAME}"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ # test server detection
+
+ StrCpy $0 "client"
+ ${If} ${IsServerOS}
+ StrCpy $0 "server"
+ ${EndIf}
+
+ ${If} ${SERVER} != $0
+
+ DetailPrint "Server detection failed for ${NAME}"
+ DetailPrint " Expected: ${SERVER}"
+ DetailPrint " Got: $0"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ # test platform
+
+ StrCpy $0 "9x"
+ ${If} ${IsNT}
+ StrCpy $0 "nt"
+ ${EndIf}
+
+ ${If} ${PLATFORM} != $0
+
+ DetailPrint "Platform detection failed for ${NAME}"
+ DetailPrint " Expected: ${PLATFORM}"
+ DetailPrint " Got: $0"
+
+ StrCpy $R0 "FAILURE"
+
+ ${EndIf}
+
+ DetailPrint "$R0 ${NAME}"
+
+!macroend
+
+###############################################################
+###############################################################
+###############################################################
+
+Section
+
+ #### WINDOWS 95 OSR B [4.00.950 B]
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 0
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 0, i 0, i 0, i 0, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 9c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD " B"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 0, i 67109975, i 1, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 94000000040000000000000057040004010000002042000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 95 OSR B" 95 2 client 9x
+
+ #### WINDOWS 98
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 0
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 0, i 0, i 0, i 0, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 9c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD " "
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 10, i 67766222, i 1, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 94000000040000000a000000ce070a04010000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 98" 98 0 client 9x
+
+ #### WINDOWS 98 SE
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD " A "
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 4, i 10, i 67766446, i 1, &t128 s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 9c000000040000000a000000ae080a040100000020412000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD " A "
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 10, i 67766446, i 1, &t128 s, &i2 64, &i2 40960, &i2 8544, &i1 68, &i1 0"
+ # 94000000040000000a000000ae080a04010000002041200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 98 SE" 98 1 client 9x
+
+ #### WINDOWS ME
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD " "
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 4, i 90, i 73010104, i 1, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 9c000000040000005a000000b80b5a040100000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD " "
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 90, i 73010104, i 1, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 94000000040000005a000000b80b5a04010000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows ME" ME 0 client 9x
+
+ #### WINDOWS NT4 SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 0
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 0, i 0, i 0, i 0, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 9c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 0, i 1381, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000400000000000000650500000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows NT4 SP1" NT4 1 server nt
+
+ #### WINDOWS NT4 SP6
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 6"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 4, i 0, i 1381, i 2, &t128s, &i2 6, &i2 0, &i2 0, &i1 3, &i1 0"
+ # 9c0000000400000000000000650500000200000053657276696365205061636b20360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000300
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 6"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 4, i 0, i 1381, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000400000000000000650500000200000053657276696365205061636b2036000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows NT4 SP6" NT4 6 server nt
+
+ #### WINDOWS 2000 SP0
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 0, i 2195, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 1, &i1 0"
+ # 9c0000000500000000000000930800000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD ""
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 0, i 2195, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 94000000050000000000000093080000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 2000 SP0" 2000 0 client nt
+
+ #### WINDOWS 2000 SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 0, i 2195, i 2, &t128 s, &i2 1, &i2 0, &i2 0, &i1 1, &i1 0"
+ # 9c0000000500000000000000930800000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 0, i 2195, i 2, &t128 s, &i2 0, &i2 0, &i2 7, &i1 20, &i1 0"
+ # 940000000500000000000000930800000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 2000 SP1" 2000 1 client nt
+
+ #### WINDOWS 2000 SP2
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 0, i 2195, i 2, &t128 s, &i2 2, &i2 0, &i2 0, &i1 1, &i1 0"
+ # 9c0000000500000000000000930800000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 0, i 2195, i 2, &t128 s, &i2 0, &i2 0, &i2 5, &i1 20, &i1 0"
+ # 940000000500000000000000930800000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 2000 SP2" 2000 2 client nt
+
+ #### WINDOWS 2000 SP3
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 3"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 0, i 2195, i 2, &t128 s, &i2 3, &i2 0, &i2 0, &i1 1, &i1 0"
+ # 9c0000000500000000000000930800000200000053657276696365205061636b2033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 3"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 0, i 2195, i 2, &t128 s, &i2 0, &i2 0, &i2 7, &i1 20, &i1 0"
+ # 940000000500000000000000930800000200000053657276696365205061636b2033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 2000 SP3" 2000 3 client nt
+
+ #### WINDOWS 2000 SP4
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 4"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 0, i 2195, i 2, &t128s, &i2 4, &i2 0, &i2 0, &i1 1, &i1 0"
+ # 9c0000000500000000000000930800000200000053657276696365205061636b20340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000100
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 4"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 0, i 2195, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000500000000000000930800000200000053657276696365205061636b2034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows 2000 SP4" 2000 4 client nt
+
+ #### WINDOWS XP PRO SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 1, i 2600, i 2, &t128 s, &i2 1, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000500000001000000280a00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 1, i 2600, i 2, &t128 s, &i2 93, &i2 0, &i2 26, &i1 20, &i1 0"
+ # 940000000500000001000000280a00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows XP Pro SP1" XP 1 client nt
+
+ #### WINDOWS XP PRO SP2
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 1, i 2600, i 2, &t128s, &i2 2, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000500000001000000280a00000200000053657276696365205061636b20320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000010100
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 1, i 2600, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000500000001000000280a00000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows XP Pro SP2" XP 2 client nt
+
+ #### WINDOWS XP PRO SP3
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 3"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 1, i 2600, i 2, &t128s, &i2 3, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000500000001000000280a00000200000053657276696365205061636b20330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000010100
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 3"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 1, i 2600, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000500000001000000280a00000200000053657276696365205061636b2033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows XP Pro SP3" XP 3 client nt
+
+ #### WINDOWS XP x64 SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 2, i 3790, i 2, &t128s, &i2 1, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000500000002000000ce0e00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 2, i 3790, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000500000002000000ce0e00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows XP x64 SP1" XP 1 client nt
+
+ #### WINDOWS SERVER 2003 STANDARD EDITION SP0
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 2, i 3790, i 2, &t128 s, &i2 0, &i2 0, &i2 272, &i1 3, &i1 0"
+ # 9c0000000500000002000000ce0e00000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010300
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD ""
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 2, i 3790, i 2, &t128 s, &i2 0, &i2 0, &i2 7, &i1 20, &i1 0"
+ # 940000000500000002000000ce0e0000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Server 2003 SP0" 2003 0 server nt
+
+ #### WINDOWS SERVER 2003 STANDARD EDITION SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 2, i 3790, i 2, &t128 s, &i2 1, &i2 0, &i2 272, &i1 3, &i1 0"
+ # 9c0000000500000002000000ce0e00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000001001031e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 2, i 3790, i 2, &t128 s, &i2 0, &i2 0, &i2 44, &i1 20, &i1 0"
+ # 940000000500000002000000ce0e00000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Server 2003 SP1" 2003 1 server nt
+
+ #### WINDOWS SERVER 2003 STANDARD EDITION SP2
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 2, i 3790, i 2, &t128 s, &i2 2, &i2 0, &i2 272, &i1 3, &i1 0"
+ # 9c0000000500000002000000ce0e00000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000001001031e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 2, i 3790, i 2, &t128 s, &i2 93, &i2 0, &i2 20, &i1 20, &i1 0"
+ # 940000000500000002000000ce0e00000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Server 2003 SP2" 2003 2 server nt
+
+ #### WINDOWS SERVER 2003 R2
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 5, i 2, i 3790, i 2, &t128 s, &i2 2, &i2 0, &i2 274, &i1 3, &i1 0"
+ # 9c0000000500000002000000ce0e00000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000001201031e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 2"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 5, i 2, i 3790, i 2, &t128 s, &i2 0, &i2 0, &i2 44, &i1 20, &i1 0"
+ # 940000000500000002000000ce0e00000200000053657276696365205061636b2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Server 2003 x64 R2" 2003 2 server nt
+
+ #### WINDOWS VISTA ULTIMATE SP0
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD ""
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 6, i 0, i 6000, i 2, &t128s, &i2 0, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000600000000000000701700000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD ""
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 6, i 0, i 6000, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 94000000060000000000000070170000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Vista SP0" Vista 0 client nt
+
+ #### WINDOWS VISTA ULTIMATE SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 6, i 0, i 6001, i 2, &t128 s, &i2 1, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 6, i 0, i 6001, i 2, &t128 s, &i2 114, &i2 118, &i2 43684, &i1 202, &i1 0"
+ # 940000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Vista SP1" Vista 1 client nt
+
+ #### WINDOWS VISTA x64 SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 6, i 0, i 6001, i 2, &t128 s, &i2 1, &i2 0, &i2 256, &i1 1, &i1 0"
+ # 9c0000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001011e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 6, i 0, i 6001, i 2, &t128 s, &i2 10402, &i2 0, &i2 5938, &i1 49, &i1 0"
+ # 940000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Vista x64 SP1" Vista 1 client nt
+
+ #### WINDOWS 2008 SERVER SP1
+
+ # OSVERSIONINFOEX
+ StrCpy $OSVERSIONINFOEX_RES 1
+ StrCpy $OSVERSIONINFOEX_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFOEX_INIT "i 156, i 6, i 0, i 6001, i 2, &t128s, &i2 1, &i2 0, &i2 272, &i1 3, &i1 0"
+ # 9c0000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000001001031e
+
+ # OSVERSIONINFO
+ StrCpy $OSVERSIONINFO_RES 1
+ StrCpy $OSVERSIONINFO_CSD "Service Pack 1"
+ StrCpy $OSVERSIONINFO_INIT "i 148, i 6, i 0, i 6001, i 2, &t128s, &i2 0, &i2 0, &i2 0, &i1 0, &i1 0"
+ # 940000000600000000000000711700000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ !insertmacro TestWinVer "Windows Server 2008" 2008 1 server nt
+
+SectionEnd
diff --git a/Source/afxres.h b/Source/afxres.h index a97e638..1a3e4b6 100755 --- a/Source/afxres.h +++ b/Source/afxres.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/build.cpp b/Source/build.cpp index 549e869..2df3e3d 100755 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -18,7 +18,7 @@ #include <stdio.h> #include "exehead/config.h" -#include "version.h" +#include <nsis-version.h> #include "build.h" #include "util.h" @@ -28,9 +28,11 @@ #include "manifest.h" #include "icon.h" +#include "exehead/api.h" +#include "exehead/resource.h" + #include <stdexcept> -#include "exehead/resource.h" #include "ResourceEditor.h" #include "DialogTemplate.h" #include "ResourceVersionInfo.h" @@ -110,7 +112,7 @@ CEXEBuild::CEXEBuild() : definedlist.add("NSIS_VERSION", NSIS_VERSION); // automatically generated header file containing all defines -#include "defines.h" +#include <nsis-defines.h> // no longer optional definedlist.add("NSIS_SUPPORT_STANDARD_PREDEFINES"); @@ -3232,7 +3234,7 @@ void CEXEBuild::build_plugin_table(void) INFO_MSG("\n"); } -#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags, flag)/sizeof(int)) +#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int)) int CEXEBuild::add_plugins_dir_initializer(void) { diff --git a/Source/bzip2/blocksort.c b/Source/bzip2/blocksort.c index b42878f..09489dc 100755 --- a/Source/bzip2/blocksort.c +++ b/Source/bzip2/blocksort.c @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/bzip2/bzlib.c b/Source/bzip2/bzlib.c index baba256..3f605d7 100755 --- a/Source/bzip2/bzlib.c +++ b/Source/bzip2/bzlib.c @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/bzip2/bzlib.h b/Source/bzip2/bzlib.h index 11947ad..d4ee661 100755 --- a/Source/bzip2/bzlib.h +++ b/Source/bzip2/bzlib.h @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/bzip2/compress.c b/Source/bzip2/compress.c index bd02018..f70acf0 100755 --- a/Source/bzip2/compress.c +++ b/Source/bzip2/compress.c @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/bzip2/decompress.c b/Source/bzip2/decompress.c index 11f4e44..cb559f4 100755 --- a/Source/bzip2/decompress.c +++ b/Source/bzip2/decompress.c @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/bzip2/huffman.c b/Source/bzip2/huffman.c index c170cf0..ea13ea5 100755 --- a/Source/bzip2/huffman.c +++ b/Source/bzip2/huffman.c @@ -2,7 +2,7 @@ * This file is a part of the bzip2 compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.bzip.org/ diff --git a/Source/cbzip2.h b/Source/cbzip2.h index d4da7e7..21079c0 100755 --- a/Source/cbzip2.h +++ b/Source/cbzip2.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/clzma.cpp b/Source/clzma.cpp index 2734f88..7088648 100755 --- a/Source/clzma.cpp +++ b/Source/clzma.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/clzma.h b/Source/clzma.h index eb5e8a7..74cacdf 100755 --- a/Source/clzma.h +++ b/Source/clzma.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/compressor.h b/Source/compressor.h index 29a39df..7913a1d 100755 --- a/Source/compressor.h +++ b/Source/compressor.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/crc32.c b/Source/crc32.c index 38993c9..f41d423 100755 --- a/Source/crc32.c +++ b/Source/crc32.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/crc32.h b/Source/crc32.h index 00c1dbb..c75c919 100755 --- a/Source/crc32.h +++ b/Source/crc32.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/czlib.h b/Source/czlib.h index fdf23fa..654ae10 100755 --- a/Source/czlib.h +++ b/Source/czlib.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/dirreader.cpp b/Source/dirreader.cpp index 22a6d37..4854851 100755 --- a/Source/dirreader.cpp +++ b/Source/dirreader.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/dirreader.h b/Source/dirreader.h index f161ef2..b79a74e 100755 --- a/Source/dirreader.h +++ b/Source/dirreader.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index 44cb4a2..c8e6de8 100755 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include "lang.h" #include "state.h" #include "exec.h" +#include "plugin.h" #if !defined(NSIS_CONFIG_VISIBLE_SUPPORT) && !defined(NSIS_CONFIG_SILENT_SUPPORT) #error One of NSIS_CONFIG_SILENT_SUPPORT or NSIS_CONFIG_VISIBLE_SUPPORT must be defined. @@ -341,6 +342,8 @@ void NSISCALL CleanUp() dbd_hFile = INVALID_HANDLE_VALUE; } #endif + // Notify plugins that we are about to unload + Plugins_UnloadAll(); #ifdef NSIS_CONFIG_PLUGIN_SUPPORT // Clean up after plug-ins myDelete(state_plugins_dir, DEL_DIR | DEL_RECURSE | DEL_REBOOT); diff --git a/Source/exehead/SConscript b/Source/exehead/SConscript index b004c79..bebdd54 100755 --- a/Source/exehead/SConscript +++ b/Source/exehead/SConscript @@ -4,6 +4,7 @@ files = Split(""" exec.c fileform.c Main.c + plugin.c Ui.c util.c #Source/crc32.c diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 07baceb..7fe32ac 100755 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft, Jeff Doozan and Contributors + * Copyright (C) 1999-2009 Nullsoft, Jeff Doozan and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,10 @@ #include "util.h" #include "ui.h" #include "exec.h" +#include "plugin.h" #include "lang.h" #include "components.h" +#include "api.h" #ifdef NSIS_CONFIG_VISIBLE_SUPPORT HICON g_hIcon; @@ -54,8 +56,6 @@ static char g_tmp[NSIS_MAX_STRLEN * 4]; static int m_page=-1,m_retcode,m_delta; static page *g_this_page; -#define NOTIFY_BYE_BYE 'x' - static void NSISCALL outernotify(int delta) { if (delta==NOTIFY_BYE_BYE) g_quit_flag++; @@ -268,6 +268,11 @@ FORCE_INLINE int NSISCALL ui_doinstall(void) // initialize auto close flag g_exec_flags.autoclose=g_flags&CH_FLAGS_AUTO_CLOSE; +#ifdef NSIS_CONFIG_PLUGIN_SUPPORT + // initialize plugin api + g_exec_flags.plugin_api_version=NSISPIAPIVER_CURR; +#endif + // read install directory from registry if (!is_valid_instpath(state_install_directory)) { @@ -397,6 +402,9 @@ FORCE_INLINE int NSISCALL ui_doinstall(void) #if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT) ExecuteCallbackFunction(CB_ONGUIEND); #endif +#ifdef NSIS_CONFIG_PLUGIN_SUPPORT + Plugins_SendMsgToAllPlugins(NSPIM_GUIUNLOAD); +#endif return ret; } } @@ -837,8 +845,14 @@ static void NSISCALL SetSizeText(int dlgItem, int prefix, unsigned kb) if (kb < (0xFFFFFFFF - ((1 << 20) / 20))) // check for overflow kb += (1 << sh) / 20; // round numbers for better display (e.g. 1.59 => 1.6) +#if _MSC_VER == 1200 // patch #1982084 wsprintf( GetNSISString(g_tmp, prefix) + mystrlen(g_tmp), +#else + GetNSISString(g_tmp, prefix); + wsprintf( + g_tmp + mystrlen(g_tmp), +#endif "%u.%u%s%s", kb >> sh, (((kb & 0x00FFFFFF) * 10) >> sh) % 10, // 0x00FFFFFF mask is used to diff --git a/Source/exehead/afxres.h b/Source/exehead/afxres.h index 92bd14d..24b664f 100755 --- a/Source/exehead/afxres.h +++ b/Source/exehead/afxres.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/api.h b/Source/exehead/api.h new file mode 100755 index 0000000..7418b87 --- /dev/null +++ b/Source/exehead/api.h @@ -0,0 +1,83 @@ +/*
+ * apih
+ *
+ * This file is a part of NSIS.
+ *
+ * Copyright (C) 1999-2009 Nullsoft and Contributors
+ *
+ * Licensed under the zlib/libpng license (the "License");
+ * you may not use this file except in compliance with the License.
+ *
+ * Licence details can be found in the file COPYING.
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.
+ */
+
+#ifndef _NSIS_EXEHEAD_API_H_
+#define _NSIS_EXEHEAD_API_H_
+
+// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
+// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
+// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
+
+#define NSISPIAPIVER_1_0 0x00010000
+#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
+
+// NSIS Plug-In Callback Messages
+enum NSPIM
+{
+ NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
+ NSPIM_GUIUNLOAD, // Called after .onGUIEnd
+};
+
+// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
+// Return NULL for unknown messages
+// Should always be __cdecl for future expansion possibilities
+typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
+
+// extra_parameters data structures containing other interesting stuff
+// but the stack, variables and HWND passed on to plug-ins.
+typedef struct
+{
+ int autoclose;
+ int all_user_var;
+ int exec_error;
+ int abort;
+ int exec_reboot; // NSIS_SUPPORT_REBOOT
+ int reboot_called; // NSIS_SUPPORT_REBOOT
+ int XXX_cur_insttype; // depreacted
+ int plugin_api_version; // see NSISPIAPIVER_CURR
+ // used to be XXX_insttype_changed
+ int silent; // NSIS_CONFIG_SILENT_SUPPORT
+ int instdir_error;
+ int rtl;
+ int errlvl;
+ int alter_reg_view;
+ int status_update;
+} exec_flags_t;
+
+#ifndef NSISCALL
+# define NSISCALL __stdcall
+#endif
+
+typedef struct {
+ exec_flags_t *exec_flags;
+ int (NSISCALL *ExecuteCodeSegment)(int, HWND);
+ void (NSISCALL *validate_filename)(char *);
+ int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
+} extra_parameters;
+
+// Definitions for page showing plug-ins
+// See Ui.c to understand better how they're used
+
+// sent to the outer window to tell it to go to the next inner window
+#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
+
+// custom pages should send this message to let NSIS know they're ready
+#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
+
+// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
+#define NOTIFY_BYE_BYE 'x'
+
+#endif /* _PLUGIN_H_ */
diff --git a/Source/exehead/bgbg.c b/Source/exehead/bgbg.c index 75a4781..9285aae 100755 --- a/Source/exehead/bgbg.c +++ b/Source/exehead/bgbg.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/components.c b/Source/exehead/components.c index 18e1f75..87087a3 100755 --- a/Source/exehead/components.c +++ b/Source/exehead/components.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/components.h b/Source/exehead/components.h index 71ab1be..7a9af48 100755 --- a/Source/exehead/components.h +++ b/Source/exehead/components.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/config.h b/Source/exehead/config.h index ca422e6..2c86cf8 100755 --- a/Source/exehead/config.h +++ b/Source/exehead/config.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ #ifndef APSTUDIO_INVOKED // keep msdev's resource editor from mangling the .rc file -#include "sconf.h" +#include <nsis-sconf.h> #ifndef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_LICENSEPAGE diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 4e62c4b..bf76f86 100755 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,10 @@ #include "ui.h" #include "components.h" #include "exec.h" +#include "plugin.h" #include "lang.h" #include "resource.h" +#include "api.h" #define EXEC_ERROR 0x7FFFFFFF @@ -41,17 +43,14 @@ typedef struct _stack_t { static stack_t *g_st; #endif -exec_flags g_exec_flags; -exec_flags g_exec_flags_last_used; +exec_flags_t g_exec_flags; +exec_flags_t g_exec_flags_last_used; -struct { - exec_flags *flags; - void *ExecuteCodeSegment; - void *validate_filename; -} plugin_extra_parameters = { +extra_parameters plugin_extra_parameters = { &g_exec_flags, &ExecuteCodeSegment, - &validate_filename + &validate_filename, + &RegisterPluginCallback }; #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) @@ -996,7 +995,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) update_status_text(LANG_CANNOTFINDSYMBOL,buf0); log_printf3("Error registering DLL: %s not found in %s",buf0,buf1); } - if (!parm3) FreeLibrary(h); + if (!parm3 && Plugins_CanUnload(h)) FreeLibrary(h); } else { diff --git a/Source/exehead/exec.h b/Source/exehead/exec.h index ad2008e..4468a9f 100755 --- a/Source/exehead/exec.h +++ b/Source/exehead/exec.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,10 @@ #ifndef _EXEC_H_ #define _EXEC_H_ -extern exec_flags g_exec_flags; -extern exec_flags g_exec_flags_last_used; +#include "api.h" + +extern exec_flags_t g_exec_flags; +extern exec_flags_t g_exec_flags_last_used; int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success int NSISCALL ExecuteCallbackFunction(int num); // returns 0 on success diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index 470f46d..73929f1 100755 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -144,6 +144,7 @@ void handle_ver_dlg(BOOL kill) 0, verProc ); + ShowWindow(hwnd, SW_SHOW); } } } diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 5ee4cbf..a2518f9 100755 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -484,33 +484,6 @@ typedef struct { #define NSIS_INSTDIR_INVALID 1 #define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2 -typedef struct -{ - int autoclose; - int all_user_var; - int exec_error; - int abort; -#ifdef NSIS_SUPPORT_REBOOT - int exec_reboot; - int reboot_called; -#else - int _; - int __; -#endif - int XXX_cur_insttype; // depreacted - int XXX_insttype_changed; // deprecated -#ifdef NSIS_CONFIG_SILENT_SUPPORT - int silent; -#else - int ___; -#endif - int instdir_error; - int rtl; - int errlvl; - int alter_reg_view; - int status_update; -} exec_flags; - #define FIELDN(x, y) (((int *)&x)[y]) #ifdef EXEHEAD diff --git a/Source/exehead/lang.h b/Source/exehead/lang.h index 3d0adfb..824cde9 100755 --- a/Source/exehead/lang.h +++ b/Source/exehead/lang.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/plugin.c b/Source/exehead/plugin.c new file mode 100755 index 0000000..569f072 --- /dev/null +++ b/Source/exehead/plugin.c @@ -0,0 +1,97 @@ +/*
+ * plugin.c
+ *
+ * This file is a part of NSIS.
+ *
+ * Copyright (C) 1999-2009 Nullsoft and Contributors
+ *
+ * Licensed under the zlib/libpng license (the "License");
+ * you may not use this file except in compliance with the License.
+ *
+ * Licence details can be found in the file COPYING.
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.
+ */
+
+#include "plugin.h"
+
+#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
+
+typedef struct _loaded_plugin
+{
+ struct _loaded_plugin* next;
+ NSISPLUGINCALLBACK proc;
+ HMODULE dll;
+}
+loaded_plugin;
+
+static loaded_plugin* g_plugins = 0; // not thread safe!
+
+void NSISCALL Plugins_SendMsgToAllPlugins(int msg)
+{
+ loaded_plugin* p;
+
+ for (p = g_plugins; p; p = p->next)
+ {
+ p->proc(msg);
+ }
+}
+
+void NSISCALL Plugins_UnloadAll()
+{
+ loaded_plugin* p = g_plugins;
+
+ Plugins_SendMsgToAllPlugins(NSPIM_UNLOAD);
+
+ while (p)
+ {
+ loaded_plugin* oldp = p;
+ p = oldp->next;
+ FreeLibrary(oldp->dll);
+ GlobalFree(oldp);
+ }
+
+ g_plugins = NULL;
+}
+
+BOOL NSISCALL Plugins_CanUnload(HANDLE pluginHandle)
+{
+ loaded_plugin* p;
+
+ for (p = g_plugins; p; p = p->next)
+ {
+ if (p->dll == pluginHandle)
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int NSISCALL RegisterPluginCallback(HMODULE pluginHandle, NSISPLUGINCALLBACK proc)
+{
+ loaded_plugin* p;
+
+ if (!Plugins_CanUnload(pluginHandle))
+ {
+ // already registered
+ return 1;
+ }
+
+ p = (loaded_plugin*) GlobalAlloc(GPTR, sizeof(loaded_plugin));
+ if (p)
+ {
+ p->proc = proc;
+ p->dll = pluginHandle;
+ p->next = g_plugins;
+
+ g_plugins = p;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+#endif /* #ifdef NSIS_CONFIG_PLUGIN_SUPPORT */
diff --git a/Source/exehead/plugin.h b/Source/exehead/plugin.h new file mode 100755 index 0000000..35a1422 --- /dev/null +++ b/Source/exehead/plugin.h @@ -0,0 +1,34 @@ +/*
+ * plugin.h
+ *
+ * This file is a part of NSIS.
+ *
+ * Copyright (C) 1999-2009 Nullsoft and Contributors
+ *
+ * Licensed under the zlib/libpng license (the "License");
+ * you may not use this file except in compliance with the License.
+ *
+ * Licence details can be found in the file COPYING.
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.
+ */
+
+#ifndef _PLUGIN_H_
+#define _PLUGIN_H_
+
+#include "../Platform.h"
+#include "fileform.h"
+#include "api.h"
+
+#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
+
+extern int NSISCALL RegisterPluginCallback(HMODULE pluginHandle, NSISPLUGINCALLBACK proc);
+
+extern void NSISCALL Plugins_SendMsgToAllPlugins(int msg);
+extern void NSISCALL Plugins_UnloadAll();
+extern BOOL NSISCALL Plugins_CanUnload(HANDLE pluginHandle);
+
+#endif /* #ifdef NSIS_CONFIG_PLUGIN_SUPPORT */
+
+#endif /* _PLUGIN_H_ */
diff --git a/Source/exehead/resource.rc b/Source/exehead/resource.rc index 245927e..920cb50 100755 --- a/Source/exehead/resource.rc +++ b/Source/exehead/resource.rc @@ -189,7 +189,7 @@ IDD_VERIFY$(_NSIS_CONFIG_VERIFYDIALOG) DIALOGEX 0, 0, 162, 22 #else IDD_VERIFY DIALOGEX 0, 0, 162, 22 #endif -STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE +STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CTEXT "",IDC_STR,7,7,148,8 diff --git a/Source/exehead/state.h b/Source/exehead/state.h index d53154e..94d04f6 100755 --- a/Source/exehead/state.h +++ b/Source/exehead/state.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/ui.h b/Source/exehead/ui.h index 8ee0cab..33da6bf 100755 --- a/Source/exehead/ui.h +++ b/Source/exehead/ui.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -36,18 +36,12 @@ void NSISCALL build_g_logfile(void); // sent to every child window to tell it it can start executing NSIS code #define WM_NOTIFY_START (WM_USER+0x5) -// sent to the outer window to tell it to go to the next inner window -#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) - // sent to every child window to tell it it is closing soon #define WM_NOTIFY_INIGO_MONTOYA (WM_USER+0xb) // update message used by DirProc and SelProc for space display #define WM_IN_UPDATEMSG (WM_USER+0xf) -// custom pages should send this message to let NSIS know they're ready -#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) - // simulates clicking on the tree #define WM_TREEVIEW_KEYHACK (WM_USER+0x13) diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 80e18c1..5b053e3 100755 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/exehead/util.h b/Source/exehead/util.h index f2bcbb3..ab8dd1b 100755 --- a/Source/exehead/util.h +++ b/Source/exehead/util.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/fileform.cpp b/Source/fileform.cpp index b1ce87e..72296ba 100755 --- a/Source/fileform.cpp +++ b/Source/fileform.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/fileform.h b/Source/fileform.h index e3d6be5..a92b698 100755 --- a/Source/fileform.h +++ b/Source/fileform.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/growbuf.cpp b/Source/growbuf.cpp index f7c942d..6ad7697 100755 --- a/Source/growbuf.cpp +++ b/Source/growbuf.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/growbuf.h b/Source/growbuf.h index 14b6444..dcbbae2 100755 --- a/Source/growbuf.h +++ b/Source/growbuf.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/icon.cpp b/Source/icon.cpp index a899c2a..4c2ad0b 100755 --- a/Source/icon.cpp +++ b/Source/icon.cpp @@ -368,18 +368,18 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin DWORD offset; DWORD size; - CResourceEditor re(exeHeader, exeHeaderSize); + CResourceEditor re(exeHeader, exeHeaderSize, false); LPBYTE seeker = uninstIconData; offset = re.GetResourceOffsetA(RT_GROUP_ICON, MAKEINTRESOURCE(wIconId), NSIS_DEFAULT_LANG); - size = *(LPDWORD)seeker; + size = FIX_ENDIAN_INT32(*(LPDWORD)seeker); seeker += sizeof(DWORD); *(LPDWORD) seeker = FIX_ENDIAN_INT32(offset); seeker += sizeof(DWORD); - seeker += FIX_ENDIAN_INT32(size); + seeker += size; WORD icon_index = 1; @@ -394,10 +394,10 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin DWORD real_size = re.GetResourceSizeA(RT_ICON, MAKEINTRESOURCE(icon_index), NSIS_DEFAULT_LANG); - size = *(LPDWORD)seeker; + size = FIX_ENDIAN_INT32(*(LPDWORD)seeker); seeker += sizeof(DWORD); - if (real_size < size) + if (real_size != size) { throw runtime_error("invalid icon size (possibly compressed icon)"); } @@ -405,7 +405,7 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin *(LPDWORD) seeker = FIX_ENDIAN_INT32(offset); seeker += sizeof(DWORD); - seeker += FIX_ENDIAN_INT32(size); + seeker += size; icon_index++; } diff --git a/Source/icon.h b/Source/icon.h index 7b014cb..38aeef9 100755 --- a/Source/icon.h +++ b/Source/icon.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/lang.cpp b/Source/lang.cpp index a65bc02..ac684b7 100755 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ #include "util.h" #include "DialogTemplate.h" #include "exehead/resource.h" -#include "version.h" +#include <nsis-version.h> using namespace std; @@ -59,8 +59,8 @@ NLFString NLFStrings[NLF_STRINGS] = { {"^BackBtn", "< &Back", NONE_STATIC}, {"^NextBtn", "&Next >", NONE_STATIC}, {"^AgreeBtn", "I &Agree", NONE_STATIC}, - {"^AcceptBtn", "I &accept the terms in the License Agreement", NONE_STATIC}, - {"^DontAcceptBtn", "I &do not accept the terms in the License Agreement", NONE_STATIC}, + {"^AcceptBtn", "I &accept the terms of the License Agreement", NONE_STATIC}, + {"^DontAcceptBtn", "I &do not accept the terms of the License Agreement", NONE_STATIC}, {"^InstallBtn", "&Install", NONE_STATIC}, {"^UninstallBtn", "&Uninstall", NONE_STATIC}, {"^CancelBtn", "Cancel", NONE_STATIC}, diff --git a/Source/lang.h b/Source/lang.h index 6979981..44775ba 100755 --- a/Source/lang.h +++ b/Source/lang.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/lineparse.cpp b/Source/lineparse.cpp index 5e591dc..bc363c5 100755 --- a/Source/lineparse.cpp +++ b/Source/lineparse.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/lineparse.h b/Source/lineparse.h index dabaf65..744071e 100755 --- a/Source/lineparse.h +++ b/Source/lineparse.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index 89d54cf..6341026 100755 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ #include "build.h" #include "util.h" -#include "version.h" +#include <nsis-version.h> using namespace std; @@ -92,7 +92,7 @@ static void init_signals() static void print_logo() { - fprintf(g_output,"MakeNSIS %s - Copyright 1995-2008 Contributors\n" + fprintf(g_output,"MakeNSIS %s - Copyright 1995-2009 Contributors\n" "See the file COPYING for license details.\n" "Credits can be found in the Users Manual.\n\n", NSIS_VERSION); fflush(g_output); @@ -100,7 +100,7 @@ static void print_logo() static void print_license() { - fprintf(g_output,"Copyright (C) 1999-2008 Nullsoft and Contributors\n\n" + fprintf(g_output,"Copyright (C) 1999-2009 Nullsoft and Contributors\n\n" "This license applies to everything in the NSIS package, except where otherwise\n" "noted.\n\n" "This software is provided 'as-is', without any express or implied warranty.\n" diff --git a/Source/manifest.cpp b/Source/manifest.cpp index 2484757..9d1789f 100755 --- a/Source/manifest.cpp +++ b/Source/manifest.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ #include "Platform.h" #include "manifest.h" -#include "version.h" +#include <nsis-version.h> namespace manifest { diff --git a/Source/manifest.h b/Source/manifest.h index 8c2c3f9..b8975cb 100755 --- a/Source/manifest.h +++ b/Source/manifest.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/mmap.cpp b/Source/mmap.cpp index e6f21f3..1e0be7a 100755 --- a/Source/mmap.cpp +++ b/Source/mmap.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -312,7 +312,7 @@ void MMapFile::release() #ifdef _WIN32 UnmapViewOfFile(m_pView); #else - munmap(m_pView, m_iMappedSize); + munmap((char *)m_pView, m_iMappedSize); #endif m_pView = NULL; } @@ -328,7 +328,7 @@ void MMapFile::release(void *pView, int size) #ifdef _WIN32 UnmapViewOfFile(pView); #else - munmap(pView, size); + munmap((char *)pView, size); #endif } @@ -338,7 +338,7 @@ void MMapFile::flush(int num) #ifdef _WIN32 FlushViewOfFile(m_pView, num); #else - msync(m_pView, num, MS_SYNC); + msync((char *)m_pView, num, MS_SYNC); #endif } diff --git a/Source/mmap.h b/Source/mmap.h index 9f14449..e05a87a 100755 --- a/Source/mmap.h +++ b/Source/mmap.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ #ifndef _WIN32 #include <cstdio> // for FILE* +#include <fstream> // (some systems have FILE* in here) #endif class IMMap diff --git a/Source/script.cpp b/Source/script.cpp index 0e06c8f..dc9c7fc 100755 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,9 @@ #include "DialogTemplate.h" #include "lang.h" #include "dirreader.h" -#include "version.h" +#include <nsis-version.h> #include "icon.h" +#include "exehead/api.h" #include "exehead/resource.h" #include <cassert> // for assert(3) #include <time.h> @@ -897,7 +898,7 @@ int CEXEBuild::process_jump(LineParser &line, int wt, int *offs) return 0; } -#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags, flag)/sizeof(int)) +#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int)) #define SECTION_FIELD_GET(field) (FIELD_OFFSET(section, field)/sizeof(int)) #define SECTION_FIELD_SET(field) (-1 - (int)(FIELD_OFFSET(section, field)/sizeof(int))) @@ -3075,7 +3076,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) return PS_OK; case TOK_P_ECHO: SCRIPT_MSG("%s (%s:%d)\n", line.gettoken_str(1),curfilename,linecnt); - return PS_OK; + return PS_OK;
case TOK_P_SEARCHPARSESTRING:
{
bool ignCase=false;
@@ -3193,6 +3194,49 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) delete list;
}
return PS_OK;
+ case TOK_P_SEARCHREPLACESTRING:
+ {
+ int ignoreCase=!stricmp(line.gettoken_str(1),"/ignorecase");
+ if (line.getnumtokens()!=5+ignoreCase) PRINTHELP()
+
+ char *define=line.gettoken_str(1+ignoreCase);
+ char *src = line.gettoken_str(2+ignoreCase);
+ char *search = line.gettoken_str(3+ignoreCase);
+ char *replace = line.gettoken_str(4+ignoreCase);
+ int searchlen=strlen(search);
+ int replacelen=strlen(replace);
+ if (!searchlen)
+ {
+ ERROR_MSG("!searchreplace: search string must not be empty for search/replace!\n");
+ return PS_ERROR;
+ }
+
+ GrowBuf valout;
+
+ while (*src)
+ {
+ if (ignoreCase ? strnicmp(src,search,searchlen) : strncmp(src,search,searchlen))
+ valout.add(src++,1);
+ else
+ {
+ valout.add(replace,replacelen);
+ src+=searchlen;
+ }
+ }
+
+ valout.add("",1);
+
+ definedlist.del(define); // allow changing variables since we'll often use this in series
+
+ if (definedlist.add(define,(char*)valout.get()))
+ {
+ ERROR_MSG("!searchreplace: error defining \"%s\"!\n",define);
+ return PS_ERROR;
+ }
+ SCRIPT_MSG("!searchreplace: \"%s\"=\"%s\"\n",define,(char*)valout.get());
+
+ }
+ return PS_OK;
case TOK_P_VERBOSE: { diff --git a/Source/strlist.cpp b/Source/strlist.cpp index 892c701..b9c09d9 100755 --- a/Source/strlist.cpp +++ b/Source/strlist.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/strlist.h b/Source/strlist.h index d65d916..48a1b49 100755 --- a/Source/strlist.h +++ b/Source/strlist.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include "Platform.h" #include <cstdio> +#include <fstream> #include "growbuf.h" class StringList diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 4f3d6d1..0fd74f3 100755 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_BRANDINGTEXT,"BrandingText",1,1,"[/TRIM(LEFT|RIGHT|CENTER)] installer_text",TP_GLOBAL}, {TOK_BRINGTOFRONT,"BringToFront",0,0,"",TP_CODE}, {TOK_CALL,"Call",1,0,"function_name | [:label_name]",TP_CODE}, -{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll [/NOUNLOAD] function",TP_CODE}, +{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll function",TP_CODE}, {TOK_CAPTION,"Caption",1,0,"installer_caption",TP_GLOBAL|TP_PAGEEX}, {TOK_CHANGEUI,"ChangeUI",2,0,"(all|dlg_id) ui_file.exe",TP_GLOBAL}, {TOK_CLEARERRORS,"ClearErrors",0,0,"",TP_CODE}, @@ -192,7 +192,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size",TP_GLOBAL}, {TOK_SETOUTPATH,"SetOutPath",1,0,"output_path",TP_CODE}, {TOK_SETOVERWRITE,"SetOverwrite",1,0,"on|off|try|ifnewer|ifdiff",TP_ALL}, -{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)",TP_ALL}, +{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"deprecated - plug-ins should handle this on their own",TP_ALL}, {TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false",TP_CODE}, {TOK_SETREGVIEW,"SetRegView",1,0,"32|64|lastused",TP_CODE}, {TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current",TP_CODE}, @@ -258,6 +258,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_P_APPENDFILE,"!appendfile",2,0,"file appended_line",TP_ALL}, {TOK_P_SEARCHPARSESTRING,"!searchparse",3,-1,"[/ignorecase] [/noerrors] [/file] source_string substring OUTPUTSYM1 [substring [OUTPUTSYM2 [substring ...]]]",TP_ALL},
+{TOK_P_SEARCHREPLACESTRING,"!searchreplace",4,1,"[/ignorecase] output_name source_string substring replacestring", TP_ALL},
{TOK_MISCBUTTONTEXT,"MiscButtonText",0,4,"[back button text] [next button text] [cancel button text] [close button text]",TP_GLOBAL}, {TOK_DETAILSBUTTONTEXT,"DetailsButtonText",0,1,"[details button text]",TP_PG}, diff --git a/Source/tokens.h b/Source/tokens.h index 2d0683d..e0f91f2 100755 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -118,6 +118,7 @@ enum TOK_P_APPENDFILE, TOK_P_SEARCHPARSESTRING,
+ TOK_P_SEARCHREPLACESTRING,
// section/function shit TOK_SECTION, diff --git a/Source/util.cpp b/Source/util.cpp index 7df4177..2c0b07f 100755 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,15 @@ # include <unistd.h> // for close(2) # include <fcntl.h> // for open(2) # include <iconv.h> +# include <locale.h> #endif #ifdef __APPLE__ namespace Apple { // defines struct section -# define ENUM_DYLD_BOOL // for TRUE/FALSE, bug #1851365 # include <mach-o/dyld.h> // for _NSGetExecutablePath }; +# define FALSE 0 // bugs #1851365, #2497290 +# define TRUE 1 # include <sys/param.h> // for MAXPATHLEN #endif @@ -178,7 +180,7 @@ int wsprintf(char *s, const char *format, ...) { // iconv const inconsistency workaround by Alexandre Oliva template <typename T> -inline size_t __iconv_adaptor +inline size_t nsis_iconv_adaptor (size_t (*iconv_func)(iconv_t, T, size_t *, char**,size_t*), iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) @@ -220,7 +222,7 @@ int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, size_t inbytes = cchWideChar * sizeof(WCHAR); size_t outbytes = cbMultiByte; - if (__iconv_adaptor(iconv, cd, &in, &inbytes, &out, &outbytes) == (size_t) -1) { + if (nsis_iconv_adaptor(iconv, cd, &in, &inbytes, &out, &outbytes) == (size_t) -1) { iconv_close(cd); return 0; } @@ -256,7 +258,7 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, size_t inbytes = cbMultiByte; size_t outbytes = cchWideChar * sizeof(WCHAR); - if (__iconv_adaptor(iconv, cd, &in, &inbytes, &out, &outbytes) == (size_t) -1) { + if (nsis_iconv_adaptor(iconv, cd, &in, &inbytes, &out, &outbytes) == (size_t) -1) { iconv_close(cd); return 0; } diff --git a/Source/util.h b/Source/util.h index 3c3e46b..d8d7827 100755 --- a/Source/util.h +++ b/Source/util.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/winchar.cpp b/Source/winchar.cpp index 6cc81ee..7c23630 100755 --- a/Source/winchar.cpp +++ b/Source/winchar.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/winchar.h b/Source/winchar.h index 8645b14..d04ff0e 100755 --- a/Source/winchar.h +++ b/Source/winchar.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/writer.cpp b/Source/writer.cpp index b8f27c7..2c3c95a 100755 --- a/Source/writer.cpp +++ b/Source/writer.cpp @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/writer.h b/Source/writer.h index be454d3..ca84c5d 100755 --- a/Source/writer.h +++ b/Source/writer.h @@ -3,7 +3,7 @@ * * This file is a part of NSIS. * - * Copyright (C) 1999-2008 Nullsoft and Contributors + * Copyright (C) 1999-2009 Nullsoft and Contributors * * Licensed under the zlib/libpng license (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/zlib/DEFLATE.H b/Source/zlib/DEFLATE.H index dfe15a5..fab3dce 100755 --- a/Source/zlib/DEFLATE.H +++ b/Source/zlib/DEFLATE.H @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/INFBLOCK.C b/Source/zlib/INFBLOCK.C index 9306a56..6fd0333 100755 --- a/Source/zlib/INFBLOCK.C +++ b/Source/zlib/INFBLOCK.C @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/ZCONF.H b/Source/zlib/ZCONF.H index efb3499..633c62d 100755 --- a/Source/zlib/ZCONF.H +++ b/Source/zlib/ZCONF.H @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/ZLIB.H b/Source/zlib/ZLIB.H index 8185960..904efc6 100755 --- a/Source/zlib/ZLIB.H +++ b/Source/zlib/ZLIB.H @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/ZUTIL.H b/Source/zlib/ZUTIL.H index 1f1addd..c2d61ea 100755 --- a/Source/zlib/ZUTIL.H +++ b/Source/zlib/ZUTIL.H @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/deflate.c b/Source/zlib/deflate.c index 5577adb..9be307c 100755 --- a/Source/zlib/deflate.c +++ b/Source/zlib/deflate.c @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ diff --git a/Source/zlib/trees.c b/Source/zlib/trees.c index 8f11181..745e5c6 100755 --- a/Source/zlib/trees.c +++ b/Source/zlib/trees.c @@ -2,7 +2,7 @@ * This file is a part of the zlib compression module for NSIS. * * Copyright and license information can be found below. - * Modifications Copyright (C) 1999-2008 Nullsoft and Contributors + * Modifications Copyright (C) 1999-2009 Nullsoft and Contributors * * The original zlib source code is available at * http://www.zlib.net/ |