comparison src/nsis-1-fixes.patch @ 2994:a1d474da2036

Update nsis to mxe devel branch 22-May 2013. * Modify nsis-1 patch to same as mxe devel branch
author John Donoghue <john.donoghue@ieee.org>
date Sat, 25 May 2013 12:38:30 -0400
parents de129d8bdb4b
children 60cd6f076a3d
comparison
equal deleted inserted replaced
2993:1f944d8d6fe5 2994:a1d474da2036
1 This file is part of MXE. 1 This file is part of MXE.
2 See index.html for further information. 2 See index.html for further information.
3 3
4 From 1cc3dd0dfd47bab82e06be916f9e57ef783406f9 Mon Sep 17 00:00:00 2001 4 Contains ad hoc patches for cross building.
5 From: Mark Brand <mabrand@mabrand.nl> 5
6 From a2aff1c5e0febc993545ecd8379135ec7b53358b Mon Sep 17 00:00:00 2001
7 From: MXE
6 Date: Sun, 12 Aug 2012 12:33:26 +0200 8 Date: Sun, 12 Aug 2012 12:33:26 +0200
7 Subject: [PATCH 1/2] explicit mingw cross prefix 9 Subject: [PATCH 1/3] explicit mingw cross prefix
8 10
9 This patch has been taken from: 11 This patch has been taken from:
10 http://sourceforge.net/tracker/index.php?func=detail&aid=3305366&group_id=22049&atid=373085 12 http://sourceforge.net/tracker/index.php?func=detail&aid=3305366&group_id=22049&atid=373085
11 13
12 diff --git a/SCons/Tools/crossmingw.py b/SCons/Tools/crossmingw.py 14 diff --git a/SCons/Tools/crossmingw.py b/SCons/Tools/crossmingw.py
43 + defenv['MINGW_CROSS_PREFIX'] = mingw_cross_prefix 45 + defenv['MINGW_CROSS_PREFIX'] = mingw_cross_prefix
44 46
45 Export('defenv') 47 Export('defenv')
46 48
47 -- 49 --
48 1.7.10.4 50 1.8.2.1
49 51
50 52
51 From 7df0fa80a65279ee7d99da8ec6abdddff7e040b0 Mon Sep 17 00:00:00 2001 53 From d48abdf87538c76261cc447501e0abd755b88c4b Mon Sep 17 00:00:00 2001
52 From: freeman <free.man.uu@gmail.com> 54 From: MXE
53 Date: Sun, 12 Aug 2012 12:36:39 +0200 55 Date: Sun, 12 Aug 2012 12:36:39 +0200
54 Subject: [PATCH 2/2] add missing header 56 Subject: [PATCH 2/3] add missing header
55 57
56 58
57 diff --git a/Source/util.h b/Source/util.h 59 diff --git a/Source/util.h b/Source/util.h
58 index 4259a6a..664923e 100755 60 index 4259a6a..664923e 100755
59 --- a/Source/util.h 61 --- a/Source/util.h
65 +# include <unistd.h> 67 +# include <unistd.h>
66 #endif 68 #endif
67 69
68 70
69 -- 71 --
70 1.7.10.4 72 1.8.2.1
71 73
74
75 From ed27d84aa1de6aee0a2ba788e90a6d0857d2d535 Mon Sep 17 00:00:00 2001
76 From: MXE
77 Date: Fri, 3 May 2013 17:28:44 +1000
78 Subject: [PATCH 3/3] Enable native 64-bit build
79
80 Taken from:
81 http://anonscm.debian.org/gitweb/?p=collab-maint/nsis.git;a=blob;f=debian/patches/makensis_native_64bit.patch;h=2256a0e193db894dd99507ac0de66f8ae060b46b;hb=HEAD
82
83 diff --git a/SCons/Config/gnu b/SCons/Config/gnu
84 index a1f917f..adfcbd1 100755
85 --- a/SCons/Config/gnu
86 +++ b/SCons/Config/gnu
87 @@ -95,8 +95,6 @@ makensis_env.Append(CXXFLAGS = ['-Wno-non-virtual-dtor']) # ignore virtual dtor
88 makensis_env.Append(CXXFLAGS = ['-Wall']) # all warnings
89
90 conf = FlagsConfigure(makensis_env)
91 -conf.CheckCompileFlag('-m32') #
92 -conf.CheckLinkFlag('-m32') #
93 conf.CheckLinkFlag('$MAP_FLAG') # generate map file
94 if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
95 TestStrip(conf) # strip
96 @@ -149,8 +147,6 @@ conf.Finish()
97 ### cross-platform util environment adjustments
98
99 conf = FlagsConfigure(cp_util_env)
100 -conf.CheckCompileFlag('-m32')
101 -conf.CheckLinkFlag('-m32')
102 if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
103 TestStrip(conf) # strip
104 conf.Finish()
105 @@ -160,8 +156,6 @@ conf.Finish()
106 test_env = defenv.Clone()
107 test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
108 conf = FlagsConfigure(test_env)
109 -conf.CheckCompileFlag('-m32')
110 -conf.CheckLinkFlag('-m32')
111 conf.Finish()
112
113 ### weird GCC requirements
114 diff --git a/Source/DialogTemplate.cpp b/Source/DialogTemplate.cpp
115 index 109a1d7..f821a05 100755
116 --- a/Source/DialogTemplate.cpp
117 +++ b/Source/DialogTemplate.cpp
118 @@ -74,7 +74,7 @@ void ReadVarLenArr(LPBYTE &seeker, WCHAR* &readInto, unsigned int uCodePage) {
119 if (IS_INTRESOURCE(x)) { \
120 *(WORD*)seeker = 0xFFFF; \
121 seeker += sizeof(WORD); \
122 - *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \
123 + *(WORD*)seeker = ConvertEndianness(WORD((ULONG_PTR)(x))); \
124 seeker += sizeof(WORD); \
125 } \
126 else { \
127 @@ -444,7 +444,7 @@ void CDialogTemplate::ConvertToRTL() {
128 szClass = winchar_toansi(m_vItems[i]->szClass);
129
130 // Button
131 - if (long(m_vItems[i]->szClass) == 0x80) {
132 + if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x80) {
133 m_vItems[i]->dwStyle ^= BS_LEFTTEXT;
134 m_vItems[i]->dwStyle ^= BS_RIGHT;
135 m_vItems[i]->dwStyle ^= BS_LEFT;
136 @@ -458,13 +458,13 @@ void CDialogTemplate::ConvertToRTL() {
137 }
138 }
139 // Edit
140 - else if (long(m_vItems[i]->szClass) == 0x81) {
141 + else if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x81) {
142 if ((m_vItems[i]->dwStyle & ES_CENTER) == 0) {
143 m_vItems[i]->dwStyle ^= ES_RIGHT;
144 }
145 }
146 // Static
147 - else if (long(m_vItems[i]->szClass) == 0x82) {
148 + else if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x82) {
149 if ((m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFT || (m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFTNOWORDWRAP)
150 {
151 m_vItems[i]->dwStyle &= ~SS_TYPEMASK;
152 @@ -571,7 +571,7 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) {
153 // Write all of the items
154 for (unsigned int i = 0; i < m_vItems.size(); i++) {
155 // DLGITEMTEMPLATE[EX]s must be aligned on DWORD boundary
156 - if (DWORD(seeker - pbDlg) % sizeof(DWORD))
157 + if ((seeker - pbDlg) % sizeof(DWORD))
158 seeker += sizeof(WORD);
159
160 if (m_bExtended) {
161 @@ -622,7 +622,7 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) {
162 }
163 }
164
165 - assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
166 + assert((DWORD)(seeker - pbDlg) == dwSize);
167
168 // DONE!
169 return pbDlg;
170 diff --git a/Source/Platform.h b/Source/Platform.h
171 index 52eb9bc..3cdfe32 100755
172 --- a/Source/Platform.h
173 +++ b/Source/Platform.h
174 @@ -53,6 +53,7 @@ typedef unsigned char UCHAR;
175 typedef const char *LPCCH, *PCSTR, *LPCSTR;
176 typedef unsigned short WCHAR, OLECHAR, *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR, *BSTR;
177 typedef const unsigned short *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR, *LPCOLESTR;
178 +typedef int INT_PTR;
179 typedef unsigned int UINT_PTR;
180 // basic stuff
181 typedef void * HANDLE;
182 @@ -60,8 +61,8 @@ typedef HANDLE HWND;
183 typedef HANDLE HMODULE;
184 typedef unsigned long HKEY;
185 // some gdi
186 -typedef unsigned long COLORREF;
187 -typedef unsigned long HBRUSH;
188 +typedef DWORD COLORREF;
189 +typedef UINT32 HBRUSH;
190 // bool
191 # define FALSE 0
192 # define TRUE 1
193 @@ -166,7 +167,7 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
194 # define MAKEINTRESOURCE MAKEINTRESOURCEA
195 # endif
196 # ifndef IMAGE_FIRST_SECTION
197 -# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \
198 +# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \
199 FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \
200 FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
201 # endif
202 @@ -174,7 +175,7 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
203 # define RGB(r,g,b) ((DWORD)(((BYTE)(r)|((WORD)(g)<<8))|(((DWORD)(BYTE)(b))<<16)))
204 # endif
205 # ifndef MAKELONG
206 -# define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
207 +# define MAKELONG(a,b) ((DWORD)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
208 # endif
209 #endif
210 #ifndef IS_INTRESOURCE
211 @@ -197,8 +198,10 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
212 # define FOF_NOERRORUI 0x0400
213 #endif
214
215 -#ifndef ULONG_PTR
216 -# define ULONG_PTR DWORD
217 +// mingw32 and w64-mingw32 do not define ULONG_PTR
218 +// but rather declare ULONG_PTR via typedef (see basetsd.h)
219 +#if !defined(__MINGW32__) && !defined(ULONG_PTR)
220 +# define ULONG_PTR unsigned long
221 #endif
222
223 #ifndef IDC_HAND
224 @@ -238,7 +241,7 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
225 # undef INVALID_FILE_ATTRIBUTES
226 #endif
227 #ifndef INVALID_FILE_ATTRIBUTES
228 -# define INVALID_FILE_ATTRIBUTES ((unsigned long) -1)
229 +# define INVALID_FILE_ATTRIBUTES ((DWORD) -1)
230 #endif
231
232 // shell folders
233 diff --git a/Source/Plugins.cpp b/Source/Plugins.cpp
234 index 6872b28..90ad393 100755
235 --- a/Source/Plugins.cpp
236 +++ b/Source/Plugins.cpp
237 @@ -29,7 +29,7 @@
238 #include "dirreader.h"
239
240 #ifdef _WIN32
241 -# include <WinNT.h>
242 +# include <winnt.h>
243 #else
244 # include <sys/stat.h>
245 #endif
246 @@ -136,8 +136,8 @@ void Plugins::GetExports(const string &pathToDll, bool displayInfo)
247 DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData);
248 PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va);
249 DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames);
250 - unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA);
251 - for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
252 + LPDWORD names = (LPDWORD)((ULONG_PTR)exports + na - ExportDirVA);
253 + for (DWORD j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
254 {
255 const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
256 const string signature = dllName + "::" + name;
257 diff --git a/Source/ResourceEditor.cpp b/Source/ResourceEditor.cpp
258 index 8509414..b819f4e 100755
259 --- a/Source/ResourceEditor.cpp
260 +++ b/Source/ResourceEditor.cpp
261 @@ -27,20 +27,10 @@ using namespace std;
262 #define ALIGN(dwToAlign, dwAlignOn) dwToAlign = (dwToAlign%dwAlignOn == 0) ? dwToAlign : dwToAlign - (dwToAlign%dwAlignOn) + dwAlignOn
263 #define RALIGN(dwToAlign, dwAlignOn) ((dwToAlign%dwAlignOn == 0) ? dwToAlign : dwToAlign - (dwToAlign%dwAlignOn) + dwAlignOn)
264
265 -#ifndef _WIN32
266 -static inline ULONG ConvertEndianness(ULONG u) {
267 - return FIX_ENDIAN_INT32(u);
268 -}
269 -#endif
270 -
271 static inline DWORD ConvertEndianness(DWORD d) {
272 return FIX_ENDIAN_INT32(d);
273 }
274
275 -static inline LONG ConvertEndianness(LONG l) {
276 - return FIX_ENDIAN_INT32(l);
277 -}
278 -
279 static inline WORD ConvertEndianness(WORD w) {
280 return FIX_ENDIAN_INT16(w);
281 }
282 @@ -52,7 +42,7 @@ PIMAGE_NT_HEADERS CResourceEditor::GetNTHeaders(BYTE* pbPE) {
283 throw runtime_error("PE file contains invalid DOS header");
284
285 // Get NT headers
286 - PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(pbPE + ConvertEndianness(dosHeader->e_lfanew));
287 + PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(pbPE + ConvertEndianness((DWORD)dosHeader->e_lfanew));
288 if (ntHeaders->Signature != IMAGE_NT_SIGNATURE)
289 throw runtime_error("PE file missing NT signature");
290
291 @@ -684,7 +674,7 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
292 rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
293
294 CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
295 - crd->m_dwWrittenAt = DWORD(seeker);
296 + crd->m_ulWrittenAt = (ULONG_PTR)(seeker);
297 seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);
298
299 for (int i = 0; i < crd->CountEntries(); i++) {
300 @@ -705,7 +695,7 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
301 rDirE.UName.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;
302
303 CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));
304 - crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);
305 + crd->GetEntry(i)->m_ulWrittenAt = (ULONG_PTR)(seeker);
306 seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);
307 }
308 qDirs.pop();
309 @@ -721,7 +711,7 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
310 rDataE.Size = ConvertEndianness(cRDataE->GetSize());
311
312 CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));
313 - cRDataE->m_dwWrittenAt = DWORD(seeker);
314 + cRDataE->m_ulWrittenAt = (ULONG_PTR)(seeker);
315 seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);
316
317 qDataEntries.pop();
318 @@ -733,7 +723,7 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
319 while (!qStrings.empty()) {
320 CResourceDirectoryEntry* cRDirE = qStrings.front();
321
322 - PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->UName.NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));
323 + PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_ulWrittenAt)->UName.NameString.NameOffset = ConvertEndianness((DWORD) (seeker - pbRsrcSec));
324
325 WCHAR* szName = cRDirE->GetName();
326 WORD iLen = winchar_strlen(szName) + 1;
327 @@ -754,7 +744,7 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
328 while (!qDataEntries2.empty()) {
329 CResourceDataEntry* cRDataE = qDataEntries2.front();
330 CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize());
331 - PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA);
332 + PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_ulWrittenAt)->OffsetToData = ConvertEndianness((DWORD)(seeker - pbRsrcSec) + m_dwResourceSectionVA);
333
334 seeker += RALIGN(cRDataE->GetSize(), 8);
335
336 @@ -764,21 +754,21 @@ void CResourceEditor::WriteRsrcSec(BYTE* pbRsrcSec) {
337 /*
338 * Set all of the directory entries offsets.
339 */
340 - SetOffsets(m_cResDir, DWORD(pbRsrcSec));
341 + SetOffsets(m_cResDir, (ULONG_PTR)(pbRsrcSec));
342 }
343
344 // Sets the offsets in directory entries
345 -void CResourceEditor::SetOffsets(CResourceDirectory* resDir, DWORD newResDirAt) {
346 +void CResourceEditor::SetOffsets(CResourceDirectory* resDir, ULONG_PTR newResDirAt) {
347 for (int i = 0; i < resDir->CountEntries(); i++) {
348 - PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY rde = PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(resDir->GetEntry(i)->m_dwWrittenAt);
349 + PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY rde = PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(resDir->GetEntry(i)->m_ulWrittenAt);
350 if (resDir->GetEntry(i)->IsDataDirectory()) {
351 rde->UOffset.DirectoryOffset.DataIsDirectory = 1;
352 - rde->UOffset.DirectoryOffset.OffsetToDirectory = resDir->GetEntry(i)->GetSubDirectory()->m_dwWrittenAt - newResDirAt;
353 + rde->UOffset.DirectoryOffset.OffsetToDirectory = resDir->GetEntry(i)->GetSubDirectory()->m_ulWrittenAt - newResDirAt;
354 rde->UOffset.OffsetToData = ConvertEndianness(rde->UOffset.OffsetToData);
355 SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt);
356 }
357 else {
358 - rde->UOffset.OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt);
359 + rde->UOffset.OffsetToData = ConvertEndianness((DWORD)(resDir->GetEntry(i)->GetDataEntry()->m_ulWrittenAt - newResDirAt));
360 }
361 }
362 }
363 @@ -887,7 +877,7 @@ int CResourceDirectory::CountEntries() {
364 // Returns -1 if can not be found
365 int CResourceDirectory::Find(WCHAR* szName) {
366 if (IS_INTRESOURCE(szName))
367 - return Find((WORD) (DWORD) szName);
368 + return Find((WORD) (ULONG_PTR) szName);
369 else
370 if (szName[0] == '#')
371 return Find(WORD(winchar_stoi(szName + 1)));
372 @@ -965,7 +955,7 @@ CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR* szName, CResourceDirecto
373 if (IS_INTRESOURCE(szName)) {
374 m_bHasName = false;
375 m_szName = 0;
376 - m_wId = (WORD) (DWORD) szName;
377 + m_wId = (WORD) (ULONG_PTR) szName;
378 }
379 else {
380 m_bHasName = true;
381 @@ -979,7 +969,7 @@ CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR* szName, CResourceDataEnt
382 if (IS_INTRESOURCE(szName)) {
383 m_bHasName = false;
384 m_szName = 0;
385 - m_wId = (WORD) (DWORD) szName;
386 + m_wId = (WORD) (ULONG_PTR) szName;
387 }
388 else {
389 m_bHasName = true;
390 diff --git a/Source/ResourceEditor.h b/Source/ResourceEditor.h
391 index 59def2e..d25be31 100755
392 --- a/Source/ResourceEditor.h
393 +++ b/Source/ResourceEditor.h
394 @@ -27,7 +27,7 @@
395
396 #include "Platform.h"
397 #ifdef _WIN32
398 -# include <WinNT.h>
399 +# include <winnt.h>
400 #else
401 // all definitions for non Win32 platforms were taken from MinGW's free Win32 library
402 # define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
403 @@ -156,7 +156,7 @@ private:
404 CResourceDirectory* ScanDirectory(PRESOURCE_DIRECTORY rdRoot, PRESOURCE_DIRECTORY rdToScan);
405
406 void WriteRsrcSec(BYTE* pbRsrcSec);
407 - void SetOffsets(CResourceDirectory* resDir, DWORD newResDirAt);
408 + void SetOffsets(CResourceDirectory* resDir, ULONG_PTR newResDirAt);
409
410 DWORD AdjustVA(DWORD dwVirtualAddress, DWORD dwAdjustment);
411 DWORD AlignVA(DWORD dwVirtualAddress);
412 @@ -180,7 +180,7 @@ public:
413
414 void Destroy();
415
416 - DWORD m_dwWrittenAt;
417 + ULONG_PTR m_ulWrittenAt;
418
419 private:
420 IMAGE_RESOURCE_DIRECTORY m_rdDir;
421 @@ -204,7 +204,7 @@ public:
422
423 CResourceDataEntry* GetDataEntry();
424
425 - DWORD m_dwWrittenAt;
426 + ULONG_PTR m_ulWrittenAt;
427
428 private:
429 bool m_bHasName;
430 @@ -232,7 +232,7 @@ public:
431 DWORD GetCodePage();
432 DWORD GetOffset();
433
434 - DWORD m_dwWrittenAt;
435 + ULONG_PTR m_ulWrittenAt;
436
437 private:
438 BYTE* m_pbData;
439 diff --git a/Source/ResourceVersionInfo.cpp b/Source/ResourceVersionInfo.cpp
440 index 71df19e..7ed0ccf 100755
441 --- a/Source/ResourceVersionInfo.cpp
442 +++ b/Source/ResourceVersionInfo.cpp
443 @@ -146,7 +146,7 @@ int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType)
444 p += sizeof(WORD);
445 szKey = (WCHAR*)p;
446 p += (winchar_strlen(szKey) + 1) * sizeof (WCHAR);
447 - while ( ((long)p % 4) != 0 )
448 + while ( ((ULONG_PTR)p % 4) != 0 )
449 p++;
450 return p - baseP;
451 }
452 diff --git a/Source/fileform.cpp b/Source/fileform.cpp
453 index 72296ba..e879ad5 100755
454 --- a/Source/fileform.cpp
455 +++ b/Source/fileform.cpp
456 @@ -149,7 +149,7 @@ void ctlcolors_writer::write(const ctlcolors *data)
457 m_sink->write_int(data->text);
458 m_sink->write_int(data->bkc);
459 m_sink->write_int(data->lbStyle);
460 - m_sink->write_int((int) data->bkb);
461 + m_sink->write_int((INT_PTR) data->bkb);
462 m_sink->write_int(data->bkmode);
463 m_sink->write_int(data->flags);
464 }
465 diff --git a/Source/mmap.cpp b/Source/mmap.cpp
466 index 1e0be7a..562a7ed 100755
467 --- a/Source/mmap.cpp
468 +++ b/Source/mmap.cpp
469 @@ -322,7 +322,7 @@ void MMapFile::release(void *pView, int size)
470 if (!pView)
471 return;
472
473 - unsigned int alignment = ((unsigned int)pView) % m_iAllocationGranularity;
474 + unsigned int alignment = ((ULONG_PTR)pView) % m_iAllocationGranularity;
475 pView = (char *)pView - alignment;
476 size += alignment;
477 #ifdef _WIN32
478 diff --git a/Source/script.cpp b/Source/script.cpp
479 index a492051..2951d98 100755
480 --- a/Source/script.cpp
481 +++ b/Source/script.cpp
482 @@ -2129,7 +2129,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
483 int k=line.gettoken_enum(1,rootkeys[0]);
484 if (k == -1) k=line.gettoken_enum(1,rootkeys[1]);
485 if (k == -1) PRINTHELP()
486 - build_header.install_reg_rootkey=(int)rootkey_tab[k];
487 + build_header.install_reg_rootkey=(INT_PTR)rootkey_tab[k];
488 if (!build_header.install_reg_rootkey) PRINTHELP() // SHCTX is invalid here
489 build_header.install_reg_key_ptr = add_string(line.gettoken_str(2),0);
490 if (line.gettoken_str(2)[0] == '\\')
491 @@ -5184,7 +5184,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
492 int k=line.gettoken_enum(2,rootkeys[0]);
493 if (k == -1) k=line.gettoken_enum(2,rootkeys[1]);
494 if (ent.offsets[0] == -1 || k == -1) PRINTHELP()
495 - ent.offsets[1]=(int)rootkey_tab[k];
496 + ent.offsets[1]=(INT_PTR)rootkey_tab[k];
497 ent.offsets[2]=add_string(line.gettoken_str(3));
498 ent.offsets[3]=add_string(line.gettoken_str(4));
499 if (which_token == TOK_READREGDWORD) ent.offsets[4]=1;
500 @@ -5216,7 +5216,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
501 if (k == -1) k=line.gettoken_enum(a,rootkeys[1]);
502 if (k == -1) PRINTHELP()
503 ent.which=EW_DELREG;
504 - ent.offsets[1]=(int)rootkey_tab[k];
505 + ent.offsets[1]=(INT_PTR)rootkey_tab[k];
506 ent.offsets[2]=add_string(line.gettoken_str(a+1));
507 ent.offsets[3]=(which_token==TOK_DELETEREGKEY)?0:add_string(line.gettoken_str(a+2));
508 if (line.gettoken_str(a+1)[0] == '\\')
509 @@ -5236,7 +5236,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
510 if (k == -1) k=line.gettoken_enum(1,rootkeys[1]);
511 if (k == -1) PRINTHELP()
512 ent.which=EW_WRITEREG;
513 - ent.offsets[0]=(int)rootkey_tab[k];
514 + ent.offsets[0]=(INT_PTR)rootkey_tab[k];
515 ent.offsets[1]=add_string(line.gettoken_str(2));
516 if (line.gettoken_str(2)[0] == '\\')
517 warning_fl("%s: registry path name begins with \'\\\', may cause problems",line.gettoken_str(0));
518 @@ -5305,7 +5305,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
519 int k=line.gettoken_enum(2,rootkeys[0]);
520 if (k == -1) k=line.gettoken_enum(2,rootkeys[1]);
521 if (ent.offsets[0] == -1 || k == -1) PRINTHELP()
522 - ent.offsets[1]=(int)rootkey_tab[k];
523 + ent.offsets[1]=(INT_PTR)rootkey_tab[k];
524 ent.offsets[2]=add_string(line.gettoken_str(3));
525 ent.offsets[3]=add_string(line.gettoken_str(4));
526 ent.offsets[4]=which_token == TOK_ENUMREGKEY;
527 diff --git a/Source/util.cpp b/Source/util.cpp
528 index 2c0b07f..18c31a2 100755
529 --- a/Source/util.cpp
530 +++ b/Source/util.cpp
531 @@ -77,9 +77,9 @@ int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width/
532 }
533
534 if (width != 0) {
535 - LONG biWidth;
536 + INT32 biWidth;
537 fseek(f, 18, SEEK_SET); // Seek to the width member of the header
538 - fread(&biWidth, sizeof(LONG), 1, f);
539 + fread(&biWidth, sizeof(INT32), 1, f);
540 FIX_ENDIAN_INT32_INPLACE(biWidth);
541 if (width != biWidth) {
542 fclose(f);
543 @@ -88,9 +88,9 @@ int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width/
544 }
545
546 if (height != 0) {
547 - LONG biHeight;
548 + INT32 biHeight;
549 fseek(f, 22, SEEK_SET); // Seek to the height member of the header
550 - fread(&biHeight, sizeof(LONG), 1, f);
551 + fread(&biHeight, sizeof(INT32), 1, f);
552 FIX_ENDIAN_INT32_INPLACE(biHeight);
553 // Bitmap height can be negative too...
554 if (height != abs(biHeight)) {
555 @@ -689,8 +689,8 @@ static BOOL GetVxdVersion( LPCSTR szFile, LPDWORD lpdwLen, LPVOID lpData )
556 }
557
558 // Find the beginning of the NT header at offset e_lfanew.
559 - pNtExeHdr = (PIMAGE_NT_HEADERS) ( (DWORD) pView
560 - + (DWORD) pDosExeHdr->e_lfanew );
561 + pNtExeHdr = (PIMAGE_NT_HEADERS) ( (ULONG_PTR) pView
562 + + pDosExeHdr->e_lfanew );
563
564 // Check to make sure the file is a VxD.
565 if ( (DWORD) pNtExeHdr->Signature != IMAGE_VXD_SIGNATURE )
566 @@ -728,8 +728,8 @@ static BOOL GetVxdVersion( LPCSTR szFile, LPDWORD lpdwLen, LPVOID lpData )
567 }
568
569 // e32_winresoff contains the offset of the resource in the VxD.
570 - pVerRes = (VXD_VERSION_RESOURCE *) ( (DWORD) pView
571 - + (DWORD) pLEHdr->e32_winresoff );
572 + pVerRes = (VXD_VERSION_RESOURCE *) ( (ULONG_PTR) pView
573 + + pLEHdr->e32_winresoff );
574 dwSize = pVerRes->dwResSize;
575 pRawRes = &(pVerRes->bVerData);
576
577 @@ -780,7 +780,7 @@ static DWORD GetVxdVersionInfoSize( LPCSTR szFile )
578
579 // GetVxdVersion() will fail with ERROR_INSUFFICIENT_BUFFER and
580 // the required buffer size will be returned in dwResult.
581 - if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER )
582 + if ( dwError == ERROR_INSUFFICIENT_BUFFER )
583 {
584 SetLastError( 0 );
585 return dwResult;
586 --
587 1.8.2.1
588