* Basic System::Call support when compiling with 64-bit MinGW/GCC toolchain

* Win64 fixes


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6607 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-09-17 14:30:07 +00:00
parent 757d16f937
commit 286edd20c4
41 changed files with 335 additions and 232 deletions

View file

@ -290,7 +290,7 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
if (header->install_reg_key_ptr)
{
myRegGetStr(
(HKEY)header->install_reg_rootkey,
(HKEY)(UINT_PTR)header->install_reg_rootkey,
GetNSISStringNP(header->install_reg_key_ptr),
GetNSISStringNP(header->install_reg_value_ptr),
ps_tmpbuf,

View file

@ -77,7 +77,7 @@ LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (header->bg_textcolor != -1)
{
HFONT newFont = CreateFontIndirect((LOGFONT *) header->blocks[NB_BGFONT].offset);
HFONT newFont = CreateFontIndirect((LOGFONT*) header->blocks[NB_BGFONT].offset);
if (newFont)
{
HFONT oldFont;

View file

@ -189,10 +189,10 @@ static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyif
static HKEY NSISCALL GetRegRootKey(int hRootKey)
{
if (hRootKey)
return (HKEY) hRootKey;
return (HKEY) (UINT_PTR) hRootKey;
// HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER == 1
return (HKEY) ((int) HKEY_CURRENT_USER + g_exec_flags.all_user_var);
return (HKEY) ((UINT_PTR) HKEY_CURRENT_USER + g_exec_flags.all_user_var);
}
static HKEY NSISCALL myRegOpenKey(REGSAM samDesired)
@ -870,7 +870,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
TCHAR *buf2=GetStringFromParm(0x22);
GetStringFromParm(0x15); // For update_status_text_buf1
update_status_text_buf1(LANG_EXECSHELL);
x=(int)ShellExecute(g_hwnd,buf0[0]?buf0:NULL,buf3,buf2[0]?buf2:NULL,state_output_directory,parm3);
x=(int)(INT_PTR)ShellExecute(g_hwnd,buf0[0]?buf0:NULL,buf3,buf2[0]?buf2:NULL,state_output_directory,parm3);
if (x < 33)
{
log_printf5(_T("ExecShell: warning: error (\"%s\": file:\"%s\" params:\"%s\")=%d"),buf0,buf3,buf2,x);

View file

@ -17,6 +17,10 @@
*/
#include "../Platform.h"
#if defined(__cplusplus) && defined(truncate_cast)
#undef BUGBUG64TRUNCATE
#define BUGBUG64TRUNCATE truncate_cast
#endif
#include "fileform.h"
#include "util.h"
#include "state.h"
@ -327,7 +331,13 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags)
// set offsets to real memory offsets rather than installer's header offset
left = BLOCKS_NUM;
while (left--)
header->blocks[left].offset += (int)data;
{
#ifdef DEBUG
if (h.length_of_header < header->blocks[left].offset)
return _LANG_GENERIC_ERROR; // Should never happen
#endif
header->blocks[left].offset += BUGBUG64TRUNCATE(UINT, (UINT_PTR) data);
}
#ifdef NSIS_COMPRESS_WHOLE
header->blocks[NB_DATA].offset = dbd_pos;
@ -398,7 +408,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
if (err<0) return -4;
u=BUGBUG64TRUNCATE(int, (char*)g_inflate_stream.next_out - outbuffer);
u=BUGBUG64TRUNCATE(int, (size_t)((char*)g_inflate_stream.next_out - outbuffer));
tc=GetTickCount();
if (g_exec_flags.status_update & 1 && (tc - ltc > 200 || !input_len))
@ -501,7 +511,7 @@ static int NSISCALL __ensuredata(int amount)
{
return -3;
}
r=(DWORD)g_inflate_stream.next_out-(DWORD)_outbuffer;
r=BUGBUG64TRUNCATE(DWORD,(UINT_PTR)g_inflate_stream.next_out)-BUGBUG64TRUNCATE(DWORD,(UINT_PTR)_outbuffer);
if (r)
{
if (!WriteFile(dbd_hFile,_outbuffer,r,&t,NULL) || r != t)

View file

@ -258,7 +258,7 @@ typedef struct
// nsis blocks
struct block_header {
int offset;
/*UINT_PTR*/ int offset; // BUGBUG: This should probably be UINT_PTR but that currently crashes :(
int num;
};
@ -554,10 +554,10 @@ extern int g_flags;
extern int g_filehdrsize;
extern int g_is_uninstaller;
#define g_pages ((page*)g_blocks[NB_PAGES].offset)
#define g_sections ((section*)g_blocks[NB_SECTIONS].offset)
#define num_sections (g_blocks[NB_SECTIONS].num)
#define g_entries ((entry*)g_blocks[NB_ENTRIES].offset)
#define g_pages ( (page*) g_blocks[NB_PAGES].offset )
#define g_sections ( (section*) g_blocks[NB_SECTIONS].offset )
#define num_sections ( g_blocks[NB_SECTIONS].num )
#define g_entries ( (entry*) g_blocks[NB_ENTRIES].offset )
#endif
#endif //_FILEFORM_H_

View file

@ -567,7 +567,9 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName)
*/
void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
{
BOOL fOk = 0;
#ifndef _WIN64 // Shut up GCC unused warning
BOOL fOk = FALSE;
#endif
typedef BOOL (WINAPI *mfea_t)(LPCTSTR lpExistingFileName,LPCTSTR lpNewFileName,DWORD dwFlags);
mfea_t mfea;
#ifdef _WIN64
@ -577,7 +579,10 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
if (mfea)
#endif
{
fOk=mfea(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
#ifndef _WIN64 // Shut up GCC unused warning
fOk=
#endif
mfea(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
}
#ifndef _WIN64
if (!fOk)