-01_64bit_fixes.patch
-Andreas Jochens <aj@andaco.de>, Andreas Barth <aba@not.so.argh.org>,
-Steve Langasek <vorlon@debian.org>, Paul Wise <pabs@debian.org>
-Fix some issues with building and running makensis on 64-bit platforms
-Index: Source/DialogTemplate.cpp
-===================================================================
---- Source/DialogTemplate.cpp.orig 2007-01-30 09:03:35.000000000 +0100
-+++ Source/DialogTemplate.cpp 2007-01-30 09:03:56.000000000 +0100
-@@ -93,7 +93,7 @@
- if (IS_INTRESOURCE(x)) { \\r
- *(WORD*)seeker = 0xFFFF; \\r
- seeker += sizeof(WORD); \\r
-- *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \\r
-+ *(WORD*)seeker = ConvertEndianness(WORD(long(x))); \\r
- seeker += sizeof(WORD); \\r
- } \\r
- else { \\r
-@@ -629,7 +629,7 @@
- }\r
- }\r
- \r
-- assert((DWORD) seeker - (DWORD) pbDlg == dwSize);\r
-+ assert((long) seeker - (long) pbDlg == dwSize);\r
- \r
- // DONE!\r
- return pbDlg;\r
-Index: Source/Platform.h
-===================================================================
---- Source/Platform.h.orig 2007-01-30 09:03:35.000000000 +0100
-+++ Source/Platform.h 2007-01-30 09:05:35.000000000 +0100
-@@ -135,7 +135,7 @@
- # define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))\r
- # endif\r
- # ifndef IMAGE_FIRST_SECTION\r
--# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \\r
-+# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (long) h + \\r
- FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \\r
- FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )\r
- # endif\r
-@@ -147,7 +147,7 @@
- # endif\r
- #endif\r
- #ifndef IS_INTRESOURCE\r
--# define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0)\r
-+# define IS_INTRESOURCE(_r) (((unsigned long)(_r) >> 16) == 0)\r
- #endif\r
- \r
- // functions\r
-@@ -666,7 +666,7 @@
- WORD e_oemid;\r
- WORD e_oeminfo;\r
- WORD e_res2[10];\r
-- LONG e_lfanew;\r
-+ DWORD e_lfanew;\r
- } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;\r
- # pragma pack()\r
- # pragma pack(4)\r
-Index: Source/ResourceEditor.cpp
-===================================================================
---- Source/ResourceEditor.cpp.orig 2007-01-30 09:03:35.000000000 +0100
-+++ Source/ResourceEditor.cpp 2007-01-30 09:03:56.000000000 +0100
-@@ -545,7 +545,7 @@
- rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);\r
- \r
- CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));\r
-- crd->m_dwWrittenAt = DWORD(seeker);\r
-+ crd->m_dwWrittenAt = long(seeker);\r
- seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);\r
- \r
- for (int i = 0; i < crd->CountEntries(); i++) {\r
-@@ -566,7 +566,7 @@
- rDirE.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;\r
- \r
- CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));\r
-- crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);\r
-+ crd->GetEntry(i)->m_dwWrittenAt = long(seeker);\r
- seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);\r
- }\r
- qDirs.pop();\r
-@@ -582,7 +582,7 @@
- rDataE.Size = ConvertEndianness(cRDataE->GetSize());\r
- \r
- CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));\r
-- cRDataE->m_dwWrittenAt = DWORD(seeker);\r
-+ cRDataE->m_dwWrittenAt = long(seeker);\r
- seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);\r
- \r
- qDataEntries.pop();\r
-@@ -594,7 +594,7 @@
- while (!qStrings.empty()) {\r
- CResourceDirectoryEntry* cRDirE = qStrings.front();\r
- \r
-- PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));\r
-+ PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->NameString.NameOffset = ConvertEndianness(long(seeker) - long(pbRsrcSec));\r
- \r
- char* szName = cRDirE->GetName();\r
- WORD iLen = strlen(szName) + 1;\r
-@@ -636,7 +636,7 @@
- /*\r
- * Set all of the directory entries offsets.\r
- */\r
-- SetOffsets(m_cResDir, DWORD(pbRsrcSec));\r
-+ SetOffsets(m_cResDir, long(pbRsrcSec));\r
- }\r
- \r
- // Sets the offsets in directory entries\r
-@@ -758,7 +758,7 @@
- // Returns -1 if can not be found\r
- int CResourceDirectory::Find(char* szName) {\r
- if (IS_INTRESOURCE(szName))\r
-- return Find((WORD) (DWORD) szName);\r
-+ return Find((WORD) (long) szName);\r
- else\r
- if (szName[0] == '#')\r
- return Find(WORD(atoi(szName + 1)));\r
-@@ -836,7 +836,7 @@
- if (IS_INTRESOURCE(szName)) {\r
- m_bHasName = false;\r
- m_szName = 0;\r
-- m_wId = (WORD) (DWORD) szName;\r
-+ m_wId = (WORD) (long) szName;\r
- }\r
- else {\r
- m_bHasName = true;\r
-@@ -851,7 +851,7 @@
- if (IS_INTRESOURCE(szName)) {\r
- m_bHasName = false;\r
- m_szName = 0;\r
-- m_wId = (WORD) (DWORD) szName;\r
-+ m_wId = (WORD) (long) szName;\r
- }\r
- else {\r
- m_bHasName = true;\r
-Index: Source/util.cpp
-===================================================================
---- Source/util.cpp.orig 2007-01-30 09:03:35.000000000 +0100
-+++ Source/util.cpp 2007-01-30 09:07:54.000000000 +0100
-@@ -57,9 +57,9 @@
- }\r
- \r
- if (width != 0) {\r
-- LONG biWidth;\r
-+ DWORD biWidth;\r
- fseek(f, 18, SEEK_SET); // Seek to the width member of the header\r
-- fread(&biWidth, sizeof(LONG), 1, f);\r
-+ fread(&biWidth, sizeof(DWORD), 1, f);\r
- FIX_ENDIAN_INT32_INPLACE(biWidth);\r
- if (width != biWidth) {\r
- fclose(f);\r
-@@ -68,12 +68,12 @@
- }\r
- \r
- if (height != 0) {\r
-- LONG biHeight;\r
-+ DWORD biHeight;\r
- fseek(f, 22, SEEK_SET); // Seek to the height member of the header\r
-- fread(&biHeight, sizeof(LONG), 1, f);\r
-+ fread(&biHeight, sizeof(DWORD), 1, f);\r
- FIX_ENDIAN_INT32_INPLACE(biHeight);\r
- // Bitmap height can be negative too...\r
-- if (height != abs(biHeight)) {\r
-+ if (height != abs((long int)biHeight)) {\r
- fclose(f);\r
- return -3;\r
- }\r
-@@ -312,7 +312,7 @@
- FIX_ENDIAN_INT32_INPLACE(rdEntry.OffsetToData);\r
- MY_ASSERT(!rdEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");\r
- \r
-- PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));\r
-+ PRESOURCE_DIRECTORY rdIcons = PRESOURCE_DIRECTORY(rdEntry.DirectoryOffset.OffsetToDirectory + long(rdRoot));\r
- \r
- MY_ASSERT((size_t)rdIcons - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");\r
- \r
-@@ -325,7 +325,7 @@
- FIX_ENDIAN_INT32_INPLACE(icoEntry.OffsetToData);\r
- \r
- MY_ASSERT(!icoEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");\r
-- PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + DWORD(rdRoot));\r
-+ PRESOURCE_DIRECTORY rd = PRESOURCE_DIRECTORY(icoEntry.DirectoryOffset.OffsetToDirectory + long(rdRoot));\r
- \r
- MY_ASSERT((size_t)rd - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");\r
- \r
-@@ -334,7 +334,7 @@
- \r
- MY_ASSERT(datEntry.DirectoryOffset.DataIsDirectory, "bad resource directory");\r
- \r
-- PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + DWORD(rdRoot));\r
-+ PIMAGE_RESOURCE_DATA_ENTRY rde = PIMAGE_RESOURCE_DATA_ENTRY(datEntry.OffsetToData + long(rdRoot));\r
- \r
- MY_ASSERT((size_t)rde - (size_t)exeHeader > exeHeaderSize, "corrupted EXE - invalid pointer");\r
- \r
-@@ -355,10 +355,10 @@
- }\r
- \r
- // Set offset\r
-- DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + DWORD(rdRoot) - dwResourceSectionVA - DWORD(exeHeader);\r
-+ DWORD dwOffset = FIX_ENDIAN_INT32(rde->OffsetToData) + long(rdRoot) - dwResourceSectionVA - long(exeHeader);\r
- *(LPDWORD) seeker = FIX_ENDIAN_INT32(dwOffset);\r
- \r
-- MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (DWORD)rdRoot - (DWORD)exeHeader, "invalid data offset - icon resource probably compressed");\r
-+ MY_ASSERT(dwOffset > exeHeaderSize || dwOffset < (long)rdRoot - (long)exeHeader, "invalid data offset - icon resource probably compressed");\r
- }\r
- \r
- LPBYTE seeker = uninstIconData;\r
-Index: Source/Plugins.cpp
-===================================================================
---- Source/Plugins.cpp.orig 2007-01-30 09:05:50.000000000 +0100
-+++ Source/Plugins.cpp 2007-01-30 09:07:05.000000000 +0100
-@@ -120,7 +120,7 @@
- DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData);\r
- PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va);\r
- DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames);\r
-- unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA);\r
-+ unsigned int *names = (unsigned int*)((unsigned long) exports + (char *) na - ExportDirVA);\r
- for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)\r
- {\r
- const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);\r