1 Index: SCons/Config/gnu
2 --- ../release/nsis-2.17-src/SCons/Config/gnu 2006-04-28 08:54:41.000000000 -0700
3 +++ ./SCons/Config/gnu 2006-07-31 05:48:44.000000000 -0700
7 if not defenv['DEBUG']:
\r
8 - stub_env.Append(CCFLAGS = '-Os') # optimize for size
\r
9 + stub_env.Append(CCFLAGS = '-Os -fno-strict-aliasing') # optimize for size
\r
10 stub_env.Append(CCFLAGS = '-Wall') # all warnings
\r
11 stub_env.Append(CCFLAGS = '-x c') # force compile as c
\r
14 makensis_env = defenv.Copy()
\r
16 if not defenv['DEBUG']:
\r
17 - makensis_env.Append(CCFLAGS = '-O2') # optimize
\r
18 + makensis_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing') # optimize
\r
19 makensis_env.Append(CCFLAGS = '-Wall') # all warnings
\r
21 conf = FlagsConfigure(makensis_env)
\r
23 cross_env(plugin_env)
\r
25 if not defenv['DEBUG']:
\r
26 - plugin_env.Append(CCFLAGS = '-Os') # optimize for size
\r
27 + plugin_env.Append(CCFLAGS = '-Os -fno-strict-aliasing') # optimize for size
\r
28 plugin_env.Append(CCFLAGS = '-Wall') # level 3 warnings
\r
30 if not defenv['DEBUG']:
\r
32 cp_util_env = defenv.Copy()
\r
34 if not defenv['DEBUG']:
\r
35 - cp_util_env.Append(CCFLAGS = '-O2') # optimize
\r
36 + cp_util_env.Append(CCFLAGS = '-O2 -fno-strict-aliasing') # optimize
\r
37 cp_util_env.Append(CCFLAGS = '-Wall') # all warnings
\r
39 conf = FlagsConfigure(cp_util_env)
\r
40 Index: Source/build.cpp
41 --- ../release/nsis-2.17-src/Source/build.cpp 2006-04-14 03:05:01.000000000 -0700
42 +++ ./Source/build.cpp 2006-07-31 13:26:38.000000000 -0700
46 #ifdef NSIS_CONFIG_CRC_SUPPORT
\r
47 - crc_writer_sink crc_sink((unsigned long *) &crc);
\r
48 + crc_writer_sink crc_sink((unsigned int *) &crc);
\r
49 firstheader_writer w(&crc_sink);
\r
53 --- ../release/nsis-2.17-src/Source/build.h 2005-04-02 04:04:06.000000000 -0800
54 +++ ./Source/build.h 2006-07-31 13:28:44.000000000 -0700
56 #ifdef NSIS_CONFIG_CRC_SUPPORT
\r
59 - unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
\r
60 + unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
\r
65 --- ../release/nsis-2.17-src/Source/crc32.c 2004-03-12 12:43:54.000000000 -0800
66 +++ ./Source/crc32.c 2006-07-31 13:27:12.000000000 -0700
68 #ifdef NSIS_CONFIG_CRC_SUPPORT
\r
70 // this is based on the (slow,small) CRC32 implementation from zlib.
\r
71 -unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len)
\r
72 +unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len)
\r
74 - static unsigned long crc_table[256];
\r
75 + static unsigned int crc_table[256];
\r
83 for (n = 0; n < 256; n++)
\r
85 - c = (unsigned long)n;
\r
86 + c = (unsigned int)n;
\r
87 for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320L : 0);
\r
90 Index: Source/DialogTemplate.cpp
91 --- ../release/nsis-2.17-src/Source/DialogTemplate.cpp 2006-03-24 10:36:24.000000000 -0800
92 +++ ./Source/DialogTemplate.cpp 2006-07-31 05:48:44.000000000 -0700
94 if (IS_INTRESOURCE(x)) { \
\r
95 *(WORD*)seeker = 0xFFFF; \
\r
96 seeker += sizeof(WORD); \
\r
97 - *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \
\r
98 + *(WORD*)seeker = ConvertEndianness(WORD(ULONG_PTR(x))); \
\r
99 seeker += sizeof(WORD); \
\r
106 - assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
\r
107 + assert((ULONG_PTR) seeker - (ULONG_PTR) pbDlg == dwSize);
\r
111 Index: Source/exehead/fileform.c
112 --- ../release/nsis-2.17-src/Source/exehead/fileform.c 2005-09-09 09:08:44.000000000 -0700
113 +++ ./Source/exehead/fileform.c 2006-07-31 13:26:08.000000000 -0700
115 static z_stream g_inflate_stream;
\r
118 -extern unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
\r
119 +extern unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
\r
121 const char * NSISCALL loadHeaders(int cl_flags)
\r
123 Index: Source/Platform.h
124 --- ../release/nsis-2.17-src/Source/Platform.h 2006-05-03 08:43:54.000000000 -0700
125 +++ ./Source/Platform.h 2006-07-31 05:48:44.000000000 -0700
128 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
\r
129 typedef unsigned short WORD, *LPWORD;
\r
130 -typedef unsigned long DWORD, *LPDWORD;
\r
131 +typedef unsigned int DWORD, *LPDWORD;
\r
132 typedef short SHORT;
\r
133 typedef unsigned short USHORT;
\r
134 typedef unsigned int UINT;
\r
135 typedef unsigned int UINT32;
\r
138 -typedef long LONG;
\r
139 -typedef unsigned long ULONG;
\r
141 +typedef unsigned int ULONG;
\r
142 typedef long long INT64, LARGE_INTEGER;
\r
143 typedef unsigned long long UINT64, ULARGE_INTEGER;
\r
144 typedef int BOOL, *LPBOOL;
\r
146 typedef const char *LPCCH, *PCSTR, *LPCSTR;
\r
147 typedef unsigned short WCHAR, *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR;
\r
148 typedef const unsigned short *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR;
\r
149 -typedef unsigned int UINT_PTR;
\r
150 +typedef unsigned long UINT_PTR;
\r
151 +typedef unsigned long ULONG_PTR;
\r
153 typedef void * HANDLE;
\r
154 -typedef unsigned long HKEY;
\r
155 +typedef unsigned int HKEY;
\r
157 -typedef unsigned long COLORREF;
\r
158 -typedef unsigned long HBRUSH;
\r
159 +typedef unsigned int COLORREF;
\r
160 +typedef unsigned int HBRUSH;
\r
164 @@ -129,13 +130,13 @@
167 # ifndef FIELD_OFFSET
\r
168 -# define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
\r
169 +# define FIELD_OFFSET(t,f) ((ULONG_PTR)&(((t*)0)->f))
\r
171 # ifndef MAKEINTRESOURCE
\r
172 # define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
\r
174 # ifndef IMAGE_FIRST_SECTION
\r
175 -# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \
\r
176 +# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \
\r
177 FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \
\r
178 FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
\r
181 # define FOF_NOERRORUI 0x0400
\r
185 -# define ULONG_PTR DWORD
\r
187 +//#ifndef ULONG_PTR
\r
188 +//# define ULONG_PTR ULONG
\r
192 # define IDC_HAND MAKEINTRESOURCE(32649)
\r
193 Index: Source/Plugins.cpp
194 --- ../release/nsis-2.17-src/Source/Plugins.cpp 2006-04-05 11:42:12.000000000 -0700
195 +++ ./Source/Plugins.cpp 2006-07-31 06:50:08.000000000 -0700
197 DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData);
\r
198 PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va);
\r
199 DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames);
\r
200 - unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA);
\r
201 - for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
\r
202 + unsigned int *names = (unsigned int*)((unsigned long) exports + (char *) na - ExportDirVA);
\r
203 + for (unsigned int j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
\r
205 const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
\r
206 const string signature = dllName + "::" + name;
\r
207 Index: Source/ResourceEditor.cpp
208 --- ../release/nsis-2.17-src/Source/ResourceEditor.cpp 2006-04-05 11:40:09.000000000 -0700
209 +++ ./Source/ResourceEditor.cpp 2006-07-31 05:48:44.000000000 -0700
211 rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
\r
213 CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
\r
214 - crd->m_dwWrittenAt = DWORD(seeker);
\r
215 + crd->m_dwWrittenAt = ULONG_PTR(seeker);
\r
216 seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);
\r
218 for (int i = 0; i < crd->CountEntries(); i++) {
\r
220 rDirE.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;
\r
222 CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));
\r
223 - crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);
\r
224 + crd->GetEntry(i)->m_dwWrittenAt = ULONG_PTR(seeker);
\r
225 seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);
\r
229 rDataE.Size = ConvertEndianness(cRDataE->GetSize());
\r
231 CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));
\r
232 - cRDataE->m_dwWrittenAt = DWORD(seeker);
\r
233 + cRDataE->m_dwWrittenAt = ULONG_PTR(seeker);
\r
234 seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);
\r
236 qDataEntries.pop();
\r
238 while (!qStrings.empty()) {
\r
239 CResourceDirectoryEntry* cRDirE = qStrings.front();
\r
241 - PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));
\r
242 + PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(ULONG_PTR(seeker) - ULONG_PTR(pbRsrcSec)));
\r
244 char* szName = cRDirE->GetName();
\r
245 WORD iLen = strlen(szName) + 1;
\r
247 while (!qDataEntries2.empty()) {
\r
248 CResourceDataEntry* cRDataE = qDataEntries2.front();
\r
249 CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize());
\r
250 - PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA);
\r
251 + PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(DWORD(seeker - pbRsrcSec + m_dwResourceSectionVA));
\r
253 seeker += RALIGN(cRDataE->GetSize(), 8);
\r
257 * Set all of the directory entries offsets.
\r
259 - SetOffsets(m_cResDir, DWORD(pbRsrcSec));
\r
260 + SetOffsets(m_cResDir, ULONG_PTR(pbRsrcSec));
\r
263 // Sets the offsets in directory entries
\r
265 SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt);
\r
268 - rde->OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt);
\r
269 + rde->OffsetToData = ConvertEndianness(DWORD(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt));
\r
274 // Returns -1 if can not be found
\r
275 int CResourceDirectory::Find(char* szName) {
\r
276 if (IS_INTRESOURCE(szName))
\r
277 - return Find((WORD) (DWORD) szName);
\r
278 + return Find((WORD) (ULONG_PTR) szName);
\r
280 if (szName[0] == '#')
\r
281 return Find(WORD(atoi(szName + 1)));
\r
283 if (IS_INTRESOURCE(szName)) {
\r
284 m_bHasName = false;
\r
286 - m_wId = (WORD) (DWORD) szName;
\r
287 + m_wId = (WORD) (ULONG_PTR) szName;
\r
292 if (IS_INTRESOURCE(szName)) {
\r
293 m_bHasName = false;
\r
295 - m_wId = (WORD) (DWORD) szName;
\r
296 + m_wId = (WORD) (ULONG_PTR) szName;
\r
300 Index: Source/ResourceEditor.h
301 --- ../release/nsis-2.17-src/Source/ResourceEditor.h 2006-04-28 08:54:42.000000000 -0700
302 +++ ./Source/ResourceEditor.h 2006-07-31 05:48:44.000000000 -0700
307 - DWORD m_dwWrittenAt;
\r
308 + ULONG_PTR m_dwWrittenAt;
\r
311 IMAGE_RESOURCE_DIRECTORY m_rdDir;
\r
314 CResourceDataEntry* GetDataEntry();
\r
316 - DWORD m_dwWrittenAt;
\r
317 + ULONG_PTR m_dwWrittenAt;
\r
323 DWORD GetCodePage();
\r
325 - DWORD m_dwWrittenAt;
\r
326 + ULONG_PTR m_dwWrittenAt;
\r
330 Index: Source/script.cpp
331 --- ../release/nsis-2.17-src/Source/script.cpp 2006-03-28 10:22:34.000000000 -0800
332 +++ ./Source/script.cpp 2006-07-31 20:56:03.000000000 -0700
333 @@ -4748,8 +4748,8 @@
344 @@ -6075,8 +6075,8 @@
355 Index: Source/util.cpp
356 --- ../release/nsis-2.17-src/Source/util.cpp 2006-04-28 08:54:42.000000000 -0700
357 +++ ./Source/util.cpp 2006-07-31 05:48:44.000000000 -0700
359 FIX_ENDIAN_INT32_INPLACE(rdEntry.OffsetToData);
\r
360 MY_ASSERT(!rdEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
362 - PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
\r
363 + PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
\r
365 MY_ASSERT((size_t)rdIcons - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
368 FIX_ENDIAN_INT32_INPLACE(icoEntry.OffsetToData);
\r
370 MY_ASSERT(!icoEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
371 - PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
\r
372 + PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
\r
374 MY_ASSERT((size_t)rd - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
378 MY_ASSERT(datEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
380 - PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + DWORD(rdRoot));
\r
381 + PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + ULONG_PTR(rdRoot));
\r
383 MY_ASSERT((size_t)rde - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
385 @@ -355,10 +355,10 @@
389 - DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader);
\r
390 + DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + ULONG_PTR(rdRoot) - dwResourceSectionVA - ULONG_PTR(exeHeader);
\r
391 *(LPDWORD) seeker = FIX_ENDIAN_INT32(dwOffset);
\r
393 - MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (DWORD)rdRoot - (DWORD)exeHeader, "invalid data offset - icon resource probably compressed");
\r
394 + MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (ULONG_PTR)rdRoot - (ULONG_PTR)exeHeader, "invalid data offset - icon resource probably compressed");
\r
397 LPBYTE seeker = uninstIconData;
\r
398 Index: Source/writer.cpp
399 --- ../release/nsis-2.17-src/Source/writer.cpp 2006-03-11 03:13:07.000000000 -0800
400 +++ ./Source/writer.cpp 2006-07-31 13:27:37.000000000 -0700
404 #ifdef NSIS_CONFIG_CRC_SUPPORT
\r
405 -extern "C" unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
\r
406 +extern "C" unsigned int NSISCALL CRC32(unsigned int crc, const unsigned char *buf, unsigned int len);
\r
408 void crc_writer_sink::write_data(const void *data, const size_t size)
\r
410 Index: Source/writer.h
411 --- ../release/nsis-2.17-src/Source/writer.h 2006-03-11 03:13:07.000000000 -0800
412 +++ ./Source/writer.h 2006-07-31 13:27:58.000000000 -0700
414 #ifdef NSIS_CONFIG_CRC_SUPPORT
\r
415 class crc_writer_sink : public writer_sink {
\r
417 - crc_writer_sink(unsigned long *crc) : m_crc(crc) {}
\r
418 + crc_writer_sink(unsigned int *crc) : m_crc(crc) {}
\r
420 virtual void write_data(const void *data, const size_t size);
\r
423 - unsigned long *m_crc;
\r
424 + unsigned int *m_crc;
\r