g++ -o build/release/Library/LibraryLocal/ResourceEditor.o -c -Wall -g -O2 -O2 -Wall -fno-strict-aliasing -Ibuild/release/Library/LibraryLocal -IContrib/Library/LibraryLocal Source/ResourceEditor.cpp
Source/ResourceEditor.cpp: In static member function 'static RESOURCE_DIRECTORY* CResourceEditor::GetResourceDirectory(BYTE*, DWORD, _IMAGE_NT_HEADERS*, DWORD*, DWORD*)':
Source/ResourceEditor.cpp:82: error: cast from '_IMAGE_NT_HEADERS*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In function 'WCHAR* ResStringToUnicode(const char*)':
Source/ResourceEditor.cpp:227: error: cast from 'const char*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:228: error: cast from 'const char*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In function 'void FreeUnicodeResString(WCHAR*)':
Source/ResourceEditor.cpp:234: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In member function 'DWORD CResourceEditor::Save(BYTE*, DWORD&)':
Source/ResourceEditor.cpp:371: error: cast from '_IMAGE_NT_HEADERS*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:386: error: cast from '_IMAGE_NT_HEADERS*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:403: error: cast from '_IMAGE_NT_HEADERS*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In member function 'bool CResourceEditor::AddExtraVirtualSize2PESection(const char*, int)':
Source/ResourceEditor.cpp:499: error: cast from '_IMAGE_NT_HEADERS*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In member function 'CResourceDirectory* CResourceEditor::ScanDirectory(RESOURCE_DIRECTORY*, RESOURCE_DIRECTORY*)':
Source/ResourceEditor.cpp:593: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In member function 'void CResourceEditor::WriteRsrcSec(BYTE*)':
Source/ResourceEditor.cpp:620: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:641: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:657: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:669: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:669: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:700: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In member function 'int CResourceDirectory::Find(WCHAR*)':
Source/ResourceEditor.cpp:822: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:823: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In constructor 'CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR*, CResourceDirectory*)':
Source/ResourceEditor.cpp:898: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:901: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp: In constructor 'CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR*, CResourceDataEntry*)':
Source/ResourceEditor.cpp:912: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/ResourceEditor.cpp:915: error: cast from 'WCHAR*' to 'DWORD' loses precision
scons: *** [build/release/Library/LibraryLocal/ResourceEditor.o] Error 1
scons: building terminated because of errors.
g++ -o build/release/tests/required/DialogTemplate.o -c -Wall -g -O2 -DCOMPRESS_MF_BT -Ibuild/release/tests -ISource/Tests Source/DialogTemplate.cpp
Source/DialogTemplate.cpp: In destructor 'virtual CDialogTemplate::~CDialogTemplate()':
Source/DialogTemplate.cpp:223: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:225: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:233: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:235: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp: In member function 'void CDialogTemplate::AddItem(DialogItemTemplate)':
Source/DialogTemplate.cpp:304: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:307: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp: In member function 'void CDialogTemplate::ConvertToRTL()':
Source/DialogTemplate.cpp:440: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:476: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:481: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:494: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp: In member function 'BYTE* CDialogTemplate::Save(DWORD&)':
Source/DialogTemplate.cpp:541: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:541: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:543: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:543: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:545: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:545: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:559: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:559: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:599: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:599: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:601: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:601: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:616: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:616: error: cast from 'BYTE*' to 'DWORD' loses precision
Source/DialogTemplate.cpp: In member function 'DWORD CDialogTemplate::GetSize()':
Source/DialogTemplate.cpp:627: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:629: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:631: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:636: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:646: error: cast from 'WCHAR*' to 'DWORD' loses precision
Source/DialogTemplate.cpp:648: error: cast from 'WCHAR*' to 'DWORD' loses precision
scons: *** [build/release/tests/required/DialogTemplate.o] Error 1
Logged In: YES
user_id=887028
Originator: NO
Happens to us too when we try to build it on an amd64 Gentoo box. Is this source code supposed to be compiled with the host's native compiler? 'cause it looks like Windows source code to me ;)
Workaround: build it with "scons APPEND_CCFLAGS=-m32 APPEND_LINKFLAGS=-m32"
Logged In: YES
user_id=35028
Originator: YES
-m32 is already used. There is a patch in the Debian package to compile it in 64-bit mode, but kichik had problems with it and I've not had time to address his concerns.
Logged In: NO
You are not using -m32, otherwise the compilation were successfull. Just look at g++ command line:
g++ -o build/release/Library/LibraryLocal/ResourceEditor.o -c -Wall -g -O2
-O2 -Wall -fno-strict-aliasing -Ibuild/release/Library/LibraryLocal
-IContrib/Library/LibraryLocal Source/ResourceEditor.cpp
Logged In: YES
user_id=35028
Originator: YES
Only makensis is built with -m32, the other parts are not.
Not all computers have multilib configuration... I cannot execute 32bit code... Any reason why the native executable cannot run as 64bit?
The code simply wasn't written to be portable and no-one has yet stepped up to make it so.
I started to work on a patch enabling the build of NSIS as native 64-bit executable.
The build as such works. However the installer generated from Examples\Modern UI\Basic.nsi
does not display the horizontal ruler next to the branding text. There might be other issues with
this patch but I thought it might be useful to let the interested parties test the patch.
I am not able to attach the patch as a file to this tracker item. Therefore I paste it inline:
Index: Source/ResourceEditor.h
--- Source/ResourceEditor.h (revision 6033)
+++ Source/ResourceEditor.h (working copy)
@@ -156,7 +156,7 @@
CResourceDirectory* ScanDirectory(PRESOURCE_DIRECTORY rdRoot, PRESOURCE_DIRECTORY rdToScan);
void WriteRsrcSec(BYTE* pbRsrcSec);
- void SetOffsets(CResourceDirectory* resDir, DWORD newResDirAt);
+ void SetOffsets(CResourceDirectory* resDir, ULONG newResDirAt);
DWORD AdjustVA(DWORD dwVirtualAddress, DWORD dwAdjustment);
DWORD AlignVA(DWORD dwVirtualAddress);
@@ -180,7 +180,7 @@
void Destroy();
- DWORD m_dwWrittenAt;
+ ULONG m_ulWrittenAt;
private:
IMAGE_RESOURCE_DIRECTORY m_rdDir;
@@ -204,7 +204,7 @@
CResourceDataEntry* GetDataEntry();
- DWORD m_dwWrittenAt;
+ ULONG m_ulWrittenAt;
private:
bool m_bHasName;
@@ -232,7 +232,7 @@
DWORD GetCodePage();
DWORD GetOffset();
- DWORD m_dwWrittenAt;
+ ULONG m_ulWrittenAt;
private:
BYTE* m_pbData;
Index: Source/ResourceVersionInfo.cpp
===================================================================
--- Source/ResourceVersionInfo.cpp (revision 6033)
+++ Source/ResourceVersionInfo.cpp (working copy)
@@ -146,7 +146,7 @@
p += sizeof(WORD);
szKey = (WCHAR*)p;
p += (winchar_strlen(szKey) + 1) * sizeof (WCHAR);
- while ( ((long)p % 4) != 0 )
+ while ( ((ULONG_PTR)p % 4) != 0 )
p++;
return p - baseP;
}
Index: Source/mmap.cpp
===================================================================
--- Source/mmap.cpp (revision 6033)
+++ Source/mmap.cpp (working copy)
@@ -322,7 +322,7 @@
if (!pView)
return;
- unsigned int alignment = ((unsigned int)pView) % m_iAllocationGranularity;
+ unsigned int alignment = ((ULONG_PTR)pView) % m_iAllocationGranularity;
pView = (char *)pView - alignment;
size += alignment;
#ifdef _WIN32
Index: Source/DialogTemplate.cpp
===================================================================
--- Source/DialogTemplate.cpp (revision 6033)
+++ Source/DialogTemplate.cpp (working copy)
@@ -74,7 +74,7 @@
if (IS_INTRESOURCE(x)) { \ *(WORD*)seeker = 0xFFFF; \ seeker += sizeof(WORD); \ - *(WORD*)seeker = ConvertEndianness(WORD(DWORD(x))); \ + *(WORD*)seeker = ConvertEndianness(WORD((ULONG_PTR)(x))); \ seeker += sizeof(WORD); \ } \ else { \ @@ -444,7 +444,7 @@
szClass = winchar_toansi(m_vItems[i]->szClass);
// Button
- if (long(m_vItems[i]->szClass) == 0x80) {
+ if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x80) {
m_vItems[i]->dwStyle ^= BS_LEFTTEXT;
m_vItems[i]->dwStyle ^= BS_RIGHT;
m_vItems[i]->dwStyle ^= BS_LEFT;
@@ -458,13 +458,13 @@
}
}
// Edit
- else if (long(m_vItems[i]->szClass) == 0x81) {
+ else if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x81) {
if ((m_vItems[i]->dwStyle & ES_CENTER) == 0) {
m_vItems[i]->dwStyle ^= ES_RIGHT;
}
}
// Static
- else if (long(m_vItems[i]->szClass) == 0x82) {
+ else if ((ULONG_PTR)(m_vItems[i]->szClass) == 0x82) {
if ((m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFT || (m_vItems[i]->dwStyle & SS_TYPEMASK) == SS_LEFTNOWORDWRAP)
{
m_vItems[i]->dwStyle &= ~SS_TYPEMASK;
@@ -571,7 +571,7 @@
// Write all of the items
for (unsigned int i = 0; i < m_vItems.size(); i++) {
// DLGITEMTEMPLATE[EX]s must be aligned on DWORD boundary
- if (DWORD(seeker - pbDlg) % sizeof(DWORD))
+ if ((seeker - pbDlg) % sizeof(DWORD))
seeker += sizeof(WORD);
if (m_bExtended) {
@@ -622,7 +622,7 @@
}
}
- assert((DWORD) seeker - (DWORD) pbDlg == dwSize);
+ assert((DWORD)(seeker - pbDlg) == dwSize);
// DONE!
return pbDlg;
Index: Source/ResourceEditor.cpp
===================================================================
--- Source/ResourceEditor.cpp (revision 6033)
+++ Source/ResourceEditor.cpp (working copy)
@@ -27,20 +27,14 @@
#define ALIGN(dwToAlign, dwAlignOn) dwToAlign = (dwToAlign%dwAlignOn == 0) ? dwToAlign : dwToAlign - (dwToAlign%dwAlignOn) + dwAlignOn
#define RALIGN(dwToAlign, dwAlignOn) ((dwToAlign%dwAlignOn == 0) ? dwToAlign : dwToAlign - (dwToAlign%dwAlignOn) + dwAlignOn)
-#ifndef _WIN32
-static inline ULONG ConvertEndianness(ULONG u) {
- return FIX_ENDIAN_INT32(u);
+static inline INT32 ConvertEndianness(INT32 i) {
+ return FIX_ENDIAN_INT32(i);
}
-#endif
static inline DWORD ConvertEndianness(DWORD d) {
return FIX_ENDIAN_INT32(d);
}
-static inline LONG ConvertEndianness(LONG l) {
- return FIX_ENDIAN_INT32(l);
-}
-
static inline WORD ConvertEndianness(WORD w) {
return FIX_ENDIAN_INT16(w);
}
@@ -684,7 +678,7 @@
rdDir.NumberOfIdEntries = ConvertEndianness(rdDir.NumberOfIdEntries);
CopyMemory(seeker, &rdDir, sizeof(IMAGE_RESOURCE_DIRECTORY));
- crd->m_dwWrittenAt = DWORD(seeker);
+ crd->m_ulWrittenAt = (ULONG_PTR)(seeker);
seeker += sizeof(IMAGE_RESOURCE_DIRECTORY);
for (int i = 0; i < crd->CountEntries(); i++) {
@@ -705,7 +699,7 @@
rDirE.UName.NameString.NameIsString = (crd->GetEntry(i)->HasName()) ? 1 : 0;
CopyMemory(seeker, &rDirE, sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY));
- crd->GetEntry(i)->m_dwWrittenAt = DWORD(seeker);
+ crd->GetEntry(i)->m_ulWrittenAt = (ULONG_PTR)(seeker);
seeker += sizeof(MY_IMAGE_RESOURCE_DIRECTORY_ENTRY);
}
qDirs.pop();
@@ -721,7 +715,7 @@
rDataE.Size = ConvertEndianness(cRDataE->GetSize());
CopyMemory(seeker, &rDataE, sizeof(IMAGE_RESOURCE_DATA_ENTRY));
- cRDataE->m_dwWrittenAt = DWORD(seeker);
+ cRDataE->m_ulWrittenAt = (ULONG_PTR)(seeker);
seeker += sizeof(IMAGE_RESOURCE_DATA_ENTRY);
qDataEntries.pop();
@@ -733,7 +727,7 @@
while (!qStrings.empty()) {
CResourceDirectoryEntry* cRDirE = qStrings.front();
- PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_dwWrittenAt)->UName.NameString.NameOffset = ConvertEndianness(DWORD(seeker) - DWORD(pbRsrcSec));
+ PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(cRDirE->m_ulWrittenAt)->UName.NameString.NameOffset = ConvertEndianness((DWORD) (seeker - pbRsrcSec));
WCHAR* szName = cRDirE->GetName();
WORD iLen = winchar_strlen(szName) + 1;
@@ -754,7 +748,7 @@
while (!qDataEntries2.empty()) {
CResourceDataEntry* cRDataE = qDataEntries2.front();
CopyMemory(seeker, cRDataE->GetData(), cRDataE->GetSize());
- PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_dwWrittenAt)->OffsetToData = ConvertEndianness(seeker - pbRsrcSec + m_dwResourceSectionVA);
+ PIMAGE_RESOURCE_DATA_ENTRY(cRDataE->m_ulWrittenAt)->OffsetToData = ConvertEndianness((DWORD)(seeker - pbRsrcSec) + m_dwResourceSectionVA);
seeker += RALIGN(cRDataE->GetSize(), 8);
@@ -764,21 +758,21 @@
/*
* Set all of the directory entries offsets.
*/
- SetOffsets(m_cResDir, DWORD(pbRsrcSec));
+ SetOffsets(m_cResDir, (ULONG_PTR)(pbRsrcSec));
}
// Sets the offsets in directory entries
-void CResourceEditor::SetOffsets(CResourceDirectory* resDir, DWORD newResDirAt) {
+void CResourceEditor::SetOffsets(CResourceDirectory* resDir, ULONG newResDirAt) {
for (int i = 0; i < resDir->CountEntries(); i++) {
- PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY rde = PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(resDir->GetEntry(i)->m_dwWrittenAt);
+ PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY rde = PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY(resDir->GetEntry(i)->m_ulWrittenAt);
if (resDir->GetEntry(i)->IsDataDirectory()) {
rde->UOffset.DirectoryOffset.DataIsDirectory = 1;
- rde->UOffset.DirectoryOffset.OffsetToDirectory = resDir->GetEntry(i)->GetSubDirectory()->m_dwWrittenAt - newResDirAt;
+ rde->UOffset.DirectoryOffset.OffsetToDirectory = resDir->GetEntry(i)->GetSubDirectory()->m_ulWrittenAt - newResDirAt;
rde->UOffset.OffsetToData = ConvertEndianness(rde->UOffset.OffsetToData);
SetOffsets(resDir->GetEntry(i)->GetSubDirectory(), newResDirAt);
}
else {
- rde->UOffset.OffsetToData = ConvertEndianness(resDir->GetEntry(i)->GetDataEntry()->m_dwWrittenAt - newResDirAt);
+ rde->UOffset.OffsetToData = ConvertEndianness((DWORD)(resDir->GetEntry(i)->GetDataEntry()->m_ulWrittenAt - newResDirAt));
}
}
}
@@ -887,7 +881,7 @@
// Returns -1 if can not be found
int CResourceDirectory::Find(WCHAR* szName) {
if (IS_INTRESOURCE(szName))
- return Find((WORD) (DWORD) szName);
+ return Find((WORD) (ULONG_PTR) szName);
else
if (szName[0] == '#')
return Find(WORD(winchar_stoi(szName + 1)));
@@ -965,7 +959,7 @@
if (IS_INTRESOURCE(szName)) {
m_bHasName = false;
m_szName = 0;
- m_wId = (WORD) (DWORD) szName;
+ m_wId = (WORD) (ULONG_PTR) szName;
}
else {
m_bHasName = true;
@@ -979,7 +973,7 @@
if (IS_INTRESOURCE(szName)) {
m_bHasName = false;
m_szName = 0;
- m_wId = (WORD) (DWORD) szName;
+ m_wId = (WORD) (ULONG_PTR) szName;
}
else {
m_bHasName = true;
Index: Source/util.cpp
===================================================================
--- Source/util.cpp (revision 6033)
+++ Source/util.cpp (working copy)
@@ -77,9 +77,9 @@
}
if (width != 0) {
- LONG biWidth;
+ INT32 biWidth;
fseek(f, 18, SEEK_SET); // Seek to the width member of the header
- fread(&biWidth, sizeof(LONG), 1, f);
+ fread(&biWidth, sizeof(INT32), 1, f);
FIX_ENDIAN_INT32_INPLACE(biWidth);
if (width != biWidth) {
fclose(f);
@@ -88,9 +88,9 @@
}
if (height != 0) {
- LONG biHeight;
+ INT32 biHeight;
fseek(f, 22, SEEK_SET); // Seek to the height member of the header
- fread(&biHeight, sizeof(LONG), 1, f);
+ fread(&biHeight, sizeof(INT32), 1, f);
FIX_ENDIAN_INT32_INPLACE(biHeight);
// Bitmap height can be negative too...
if (height != abs(biHeight)) {
Index: Source/Plugins.cpp
===================================================================
--- Source/Plugins.cpp (revision 6033)
+++ Source/Plugins.cpp (working copy)
@@ -136,8 +136,8 @@
DWORD prd = FIX_ENDIAN_INT32(sections[i].PointerToRawData);
PIMAGE_EXPORT_DIRECTORY exports = PIMAGE_EXPORT_DIRECTORY(&dlldata[0] + prd + ExportDirVA - va);
DWORD na = FIX_ENDIAN_INT32(exports->AddressOfNames);
- unsigned long *names = (unsigned long*)((unsigned long) exports + (char *) na - ExportDirVA);
- for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
+ LPDWORD names = (LPDWORD)((ULONG_PTR)exports + na - ExportDirVA);
+ for (DWORD j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
{
const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
const string signature = dllName + "::" + name;
Index: Source/Platform.h
===================================================================
--- Source/Platform.h (revision 6033)
+++ Source/Platform.h (working copy)
@@ -166,7 +166,7 @@
# define MAKEINTRESOURCE MAKEINTRESOURCEA
# endif
# ifndef IMAGE_FIRST_SECTION
-# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (DWORD) h + \ +# define IMAGE_FIRST_SECTION(h) ( PIMAGE_SECTION_HEADER( (ULONG_PTR) h + \ FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) + \ FIX_ENDIAN_INT16(PIMAGE_NT_HEADERS(h)->FileHeader.SizeOfOptionalHeader) ) )
# endif
@@ -174,7 +174,7 @@
# define RGB(r,g,b) ((DWORD)(((BYTE)(r)|((WORD)(g)<<8))|(((DWORD)(BYTE)(b))<<16)))
# endif
# ifndef MAKELONG
-# define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
+# define MAKELONG(a,b) ((DWORD)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
# endif
#endif
#ifndef IS_INTRESOURCE
@@ -198,7 +198,7 @@
#endif
#ifndef ULONG_PTR
-# define ULONG_PTR DWORD
+# define ULONG_PTR unsigned long
#endif
#ifndef IDC_HAND
@@ -238,7 +238,7 @@
# undef INVALID_FILE_ATTRIBUTES
#endif
#ifndef INVALID_FILE_ATTRIBUTES
-# define INVALID_FILE_ATTRIBUTES ((unsigned long) -1)
+# define INVALID_FILE_ATTRIBUTES ((DWORD) -1)
#endif
// shell folders
@@ -705,7 +705,7 @@
WORD e_oemid;
WORD e_oeminfo;
WORD e_res2[10];
- LONG e_lfanew;
+ INT32 e_lfanew;
} IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
# pragma pack()
# pragma pack(4)
Index: SCons/Config/gnu
===================================================================
--- SCons/Config/gnu (revision 6033)
+++ SCons/Config/gnu (working copy)
@@ -95,8 +95,6 @@
makensis_env.Append(CXXFLAGS = ['-Wall']) # all warnings
conf = FlagsConfigure(makensis_env)
-conf.CheckCompileFlag('-m32') #
-conf.CheckLinkFlag('-m32') #
conf.CheckLinkFlag('$MAP_FLAG') # generate map file
if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
TestStrip(conf) # strip
@@ -150,8 +148,6 @@
### cross-platform util environment adjustments
conf = FlagsConfigure(cp_util_env)
-conf.CheckCompileFlag('-m32')
-conf.CheckLinkFlag('-m32')
if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_CP']:
TestStrip(conf) # strip
conf.Finish()
@@ -161,8 +157,6 @@
test_env = defenv.Clone()
test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
conf = FlagsConfigure(test_env)
-conf.CheckCompileFlag('-m32')
-conf.CheckLinkFlag('-m32')
conf.Finish()
### weird GCC requirements
The pasted patch is not usable.
Therefore I uploaded the patch to the following location:
http://f0rt.users.sourceforge.net/makensis_64bit.patch
I'm attempting to build the patch, but I'm getting this error on Debian amd64:
Please specify folder of zlib for Win32 via ZLIB_W32
Did something change with zlib? Is it no longer embedded in the package? If so, you'll need to ask the Debian zlib maintainer to add a Win32 variant of the library, preferably with a patch. Since Debian doesn't have multi-arch and doesn't have a Win32 arch, it will need to be an arch-all package.
I would propose to use SKIPUTILS='NSIS Menu,zip2exe' unless the util zip2exe (Win32 only) is requred on Debian.
I fixed the problem that the horizontal ruler next to the branding text is not shown in the Basic.nsi example of the Modern UI. I changed the GDI types COLORREF and HBRUSH from unsigned long to UINT32.
The updated patch is available from:
http://f0rt.users.sourceforge.net/makensis_64bit.patch
So far my conducted tests don't show any regression.
I intend to commit the patch by the end of this month if there are no objections and no error reports regarding this patch.
I updated the patch so that makensis and related utilities can also be built natively for Win64. It is available from:
http://f0rt.users.sourceforge.net/makensis_64bit.patch
See also tracker item #2949102
Changes:
* mingw32 and w64-mingw32 declare ULONG_PTR via typedef. Therefore don't define ULONG_PTR for these compilers in Source/Platform.h
* Convert HKEY type to int via INT_PTR
* Declare type COLORREF as DWORD for non Windows system to comply with official documentation (http://msdn.microsoft.com/en-us/library/aa383751%28VS.85%29.aspx [Window Data Types])
The patch no longer applies after some recent changes:
pabs@chianamo:~/devel/misc/nsis/nsis (master)$ patch -p0 -i ../makensis_64bit.patch
patching file Source/fileform.cpp
Hunk #1 succeeded at 151 (offset 2 lines).
patching file Source/ResourceEditor.h
Hunk #1 FAILED at 27.
Hunk #2 succeeded at 159 (offset 3 lines).
Hunk #3 succeeded at 183 (offset 3 lines).
Hunk #4 succeeded at 207 (offset 3 lines).
Hunk #5 succeeded at 235 (offset 3 lines).
1 out of 5 hunks FAILED -- saving rejects to file Source/ResourceEditor.h.rej
patching file Source/ResourceVersionInfo.cpp
...
In addition, nsis no longer builds with or without the patch:
scons --srcdir=/home/pabs/devel/misc/nsis/nsis --config=force PREFIX=/usr PREFIX_CONF=/etc SKIPUTILS='NSIS Menu,zip2exe' CHMDOCS=no APPEND_CCFLAGS="-Wno-write-strings -Wall -g -O0" APPEND_LINKFLAGS="-Wno-write-strings -Wall -g -O0" STRIP=no DEBUG=yes PREFIX_PLUGINAPI_INC=/usr/i586-mingw32msvc/include/ PREFIX_PLUGINAPI_LIB=/usr/i586-mingw32msvc/lib/ SKIPDOC=COPYING 2>&1 | tee ../logs/build
Mkdir("build/debug/config")
Delete("nsis-27-Mar-2010.cvs")
Delete(".instdist")
Delete(".test")
Using GNU tools configuration
Contrib/InstallOptions/InstallerOptions.cpp: In function 'bool ValidateFields()':
Contrib/InstallOptions/InstallerOptions.cpp:243: error: '_countof' was not declared in this scope
Contrib/InstallOptions/InstallerOptions.cpp: In function 'int ReadSettings()':
Contrib/InstallOptions/InstallerOptions.cpp:535: error: '_countof' was not declared in this scope
Contrib/InstallOptions/InstallerOptions.cpp: In function 'LRESULT WMCommandProc(HWND__*, UINT, HWND__*, UINT)':
Contrib/InstallOptions/InstallerOptions.cpp:623: error: '_countof' was not declared in this scope
scons: *** [build/debug/InstallOptions/InstallerOptions.o] Error 1
The source code introduced with revision 6037 (NSIS Unicode - merge of TCHARs changes) makes use of the _countof macro.
http://msdn.microsoft.com/en-us/library/ms175773%28VS.80%29.aspx [_countof Macro]
This macro is defined in stdlib.h. However mingw32 does not define the _countof macro. On the other hand w64-mingw does it.
So I am undecided how to best fix it.
Probably it needs to be added to Source/Platform.h?
I committed the makensis_64bit.patch together with mingw fixes for the "merge of
TCHARs changes" into the svn repository (revision 6040).
Fixes for the "merge of TCHARs changes":
* Conditionally added _countof macro Contrib/InstallOptions/InstallerOptions.cpp, Contrib/zip2exe/main.cpp, Contrib/Makensisw/utils.cpp, Contrib/Library/LibraryLocal/LibraryLocal.cpp
[Platform.h can not be used, because it is not grabbed by these C++ source files. Ideally the _countof macro should be added to the stdlib.h header file of the mingw32-runtime package.]
* Replaced #include "..\ExDLL\nsis_tchar.h" with "#include <tchar.h>" in Contrib/zip2exe/main.cpp, Contrib/Library/RegTool/RegTool.c because these tools don't deal with plugins (ExDLL).
* Conditionally added _CRT_STRINGIZE macro to Contrib/Library/RegTool/RegTool.c
* Removed the inclusion of "tchar.h" in the case whereby "tchar.h" is included first via "Platform.h": Source/lang.cpp, Source/build.cpp. The inclusion of "tchar.h" in nsis-versio.h is redundant as well. Therefore I removed it from the SConstruct file.
* Added missing TCHAR type and macros and funciton mapping for cross platform build in Source/Platform.h: _T, TEXT, _tctime -> ctime, _strdup -> strdup, _snprintf -> snprintf, _vsnprintf -> vsnprintf