1 Index: SCons/Config/gnu
2 --- ../nsis-2.17-src-rel/SCons/Config/gnu 2006-04-28 08:54:41.000000000 -0700
3 +++ ./SCons/Config/gnu 2006-06-19 23:12:11.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/DialogTemplate.cpp
41 --- ../nsis-2.17-src-rel/Source/DialogTemplate.cpp 2006-03-24 10:36:24.000000000 -0800
42 +++ ./Source/DialogTemplate.cpp 2006-06-20 00:04:01.000000000 -0700
44 if (IS_INTRESOURCE(x)) { \
\r
45 *(WORD*)seeker = 0xFFFF; \
\r
46 seeker += sizeof(WORD); \
\r
47 - *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \
\r
48 + *(WORD*)seeker = ConvertEndianness(WORD(ULONG_PTR(x))); \
\r
49 seeker += sizeof(WORD); \
\r
56 - assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
\r
57 + assert((ULONG_PTR) seeker - (ULONG_PTR) pbDlg == dwSize);
\r
61 Index: Source/Platform.h
62 --- ../nsis-2.17-src-rel/Source/Platform.h 2006-05-03 08:43:54.000000000 -0700
63 +++ ./Source/Platform.h 2006-06-20 00:14:31.000000000 -0700
66 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
\r
67 typedef unsigned short WORD, *LPWORD;
\r
68 -typedef unsigned long DWORD, *LPDWORD;
\r
69 +typedef unsigned int DWORD, *LPDWORD;
\r
70 typedef short SHORT;
\r
71 typedef unsigned short USHORT;
\r
72 typedef unsigned int UINT;
\r
73 typedef unsigned int UINT32;
\r
77 -typedef unsigned long ULONG;
\r
79 +typedef unsigned int ULONG;
\r
80 typedef long long INT64, LARGE_INTEGER;
\r
81 typedef unsigned long long UINT64, ULARGE_INTEGER;
\r
82 typedef int BOOL, *LPBOOL;
\r
84 typedef const char *LPCCH, *PCSTR, *LPCSTR;
\r
85 typedef unsigned short WCHAR, *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR;
\r
86 typedef const unsigned short *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR;
\r
87 -typedef unsigned int UINT_PTR;
\r
88 +typedef unsigned long UINT_PTR;
\r
89 +typedef unsigned long ULONG_PTR;
\r
91 typedef void * HANDLE;
\r
92 -typedef unsigned long HKEY;
\r
93 +typedef unsigned int HKEY;
\r
95 -typedef unsigned long COLORREF;
\r
96 -typedef unsigned long HBRUSH;
\r
97 +typedef unsigned int COLORREF;
\r
98 +typedef unsigned int HBRUSH;
\r
102 @@ -129,13 +130,13 @@
105 # ifndef FIELD_OFFSET
\r
106 -# define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
\r
107 +# define FIELD_OFFSET(t,f) ((ULONG_PTR)&(((t*)0)->f))
\r
109 # ifndef MAKEINTRESOURCE
\r
110 # define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
\r
112 # ifndef IMAGE_FIRST_SECTION
\r
113 -# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \
\r
114 +# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \
\r
115 FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \
\r
116 FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
\r
119 # define FOF_NOERRORUI 0x0400
\r
123 -# define ULONG_PTR DWORD
\r
125 +//#ifndef ULONG_PTR
\r
126 +//# define ULONG_PTR ULONG
\r
130 # define IDC_HAND MAKEINTRESOURCE(32649)
\r
131 Index: Source/ResourceEditor.cpp
132 --- ../nsis-2.17-src-rel/Source/ResourceEditor.cpp 2006-04-05 11:40:09.000000000 -0700
133 +++ ./Source/ResourceEditor.cpp 2006-06-20 00:26:25.000000000 -0700
135 rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
\r
137 CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
\r
138 - crd->m_dwWrittenAt = DWORD(seeker);
\r
139 + crd->m_dwWrittenAt = ULONG_PTR(seeker);
\r
140 seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);
\r
142 for (int i = 0; i < crd->CountEntries(); i++) {
\r
144 rDirE.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;
\r
146 CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));
\r
147 - crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);
\r
148 + crd->GetEntry(i)->m_dwWrittenAt = ULONG_PTR(seeker);
\r
149 seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);
\r
153 rDataE.Size = ConvertEndianness(cRDataE->GetSize());
\r
155 CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));
\r
156 - cRDataE->m_dwWrittenAt = DWORD(seeker);
\r
157 + cRDataE->m_dwWrittenAt = ULONG_PTR(seeker);
\r
158 seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);
\r
160 qDataEntries.pop();
\r
162 while (!qStrings.empty()) {
\r
163 CResourceDirectoryEntry* cRDirE = qStrings.front();
\r
165 - PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));
\r
166 + PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(ULONG_PTR(seeker) - ULONG_PTR(pbRsrcSec)));
\r
168 char* szName = cRDirE->GetName();
\r
169 WORD iLen = strlen(szName) + 1;
\r
171 while (!qDataEntries2.empty()) {
\r
172 CResourceDataEntry* cRDataE = qDataEntries2.front();
\r
173 CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize());
\r
174 - PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA);
\r
175 + PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(DWORD(seeker - pbRsrcSec + m_dwResourceSectionVA));
\r
177 seeker += RALIGN(cRDataE->GetSize(), 8);
\r
181 * Set all of the directory entries offsets.
\r
183 - SetOffsets(m_cResDir, DWORD(pbRsrcSec));
\r
184 + SetOffsets(m_cResDir, ULONG_PTR(pbRsrcSec));
\r
187 // Sets the offsets in directory entries
\r
189 SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt);
\r
192 - rde->OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt);
\r
193 + rde->OffsetToData = ConvertEndianness(DWORD(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt));
\r
198 // Returns -1 if can not be found
\r
199 int CResourceDirectory::Find(char* szName) {
\r
200 if (IS_INTRESOURCE(szName))
\r
201 - return Find((WORD) (DWORD) szName);
\r
202 + return Find((WORD) (ULONG_PTR) szName);
\r
204 if (szName[0] == '#')
\r
205 return Find(WORD(atoi(szName + 1)));
\r
207 if (IS_INTRESOURCE(szName)) {
\r
208 m_bHasName = false;
\r
210 - m_wId = (WORD) (DWORD) szName;
\r
211 + m_wId = (WORD) (ULONG_PTR) szName;
\r
216 if (IS_INTRESOURCE(szName)) {
\r
217 m_bHasName = false;
\r
219 - m_wId = (WORD) (DWORD) szName;
\r
220 + m_wId = (WORD) (ULONG_PTR) szName;
\r
224 Index: Source/ResourceEditor.h
225 --- ../nsis-2.17-src-rel/Source/ResourceEditor.h 2006-04-28 08:54:42.000000000 -0700
226 +++ ./Source/ResourceEditor.h 2006-06-20 00:20:39.000000000 -0700
231 - DWORD m_dwWrittenAt;
\r
232 + ULONG_PTR m_dwWrittenAt;
\r
235 IMAGE_RESOURCE_DIRECTORY m_rdDir;
\r
238 CResourceDataEntry* GetDataEntry();
\r
240 - DWORD m_dwWrittenAt;
\r
241 + ULONG_PTR m_dwWrittenAt;
\r
247 DWORD GetCodePage();
\r
249 - DWORD m_dwWrittenAt;
\r
250 + ULONG_PTR m_dwWrittenAt;
\r
254 Index: Source/util.cpp
255 --- ../nsis-2.17-src-rel/Source/util.cpp 2006-04-28 08:54:42.000000000 -0700
256 +++ ./Source/util.cpp 2006-06-20 00:41:16.000000000 -0700
258 FIX_ENDIAN_INT32_INPLACE(rdEntry.OffsetToData);
\r
259 MY_ASSERT(!rdEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
261 - PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
\r
262 + PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
\r
264 MY_ASSERT((size_t)rdIcons - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
267 FIX_ENDIAN_INT32_INPLACE(icoEntry.OffsetToData);
\r
269 MY_ASSERT(!icoEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
270 - PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));
\r
271 + PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + ULONG_PTR(rdRoot));
\r
273 MY_ASSERT((size_t)rd - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
277 MY_ASSERT(datEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");
\r
279 - PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + DWORD(rdRoot));
\r
280 + PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + ULONG_PTR(rdRoot));
\r
282 MY_ASSERT((size_t)rde - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");
\r
284 @@ -355,10 +355,10 @@
288 - DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader);
\r
289 + DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + ULONG_PTR(rdRoot) - dwResourceSectionVA - ULONG_PTR(exeHeader);
\r
290 *(LPDWORD) seeker = FIX_ENDIAN_INT32(dwOffset);
\r
292 - MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (DWORD)rdRoot - (DWORD)exeHeader, "invalid data offset - icon resource probably compressed");
\r
293 + MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (ULONG_PTR)rdRoot - (ULONG_PTR)exeHeader, "invalid data offset - icon resource probably compressed");
\r
296 LPBYTE seeker = uninstIconData;
\r