Win64 fixes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6413 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-09-06 23:48:59 +00:00
parent e23b3db418
commit e63fa6c53b
38 changed files with 389 additions and 331 deletions

View file

@ -20,7 +20,7 @@
# System::Alloc 156
# Pop $0
# System::Call *$0(ir1)
# System::Call kernel32::GetVersionEx(ir0)i.R0
# System::Call kernel32::GetVersionEx(pr0)i.R0
#
# DetailPrint 'StrCpy $2_RES $R0'
#

View file

@ -149,6 +149,7 @@ CEXEBuild::CEXEBuild() :
#ifdef _UNICODE
definedlist.add(_T("NSIS_UNICODE_MAKENSIS")); // This define might go away once makensis.exe is always unicode
#endif
if (sizeof(void*) > 4) definedlist.add(_T("NSIS_MAKENSIS64"));
db_opt_save=db_comp_save=db_full_size=db_opt_save_u=db_comp_save_u=db_full_size_u=0;
@ -3645,6 +3646,7 @@ void CEXEBuild::set_target_architecture_predefines()
{
definedlist.del(_T("NSIS_UNICODE"));
definedlist.del(_T("NSIS_CHAR_SIZE"));
definedlist.del(_T("NSIS_PTR_SIZE"));
if (build_unicode)
{
definedlist.add(_T("NSIS_UNICODE"));
@ -3654,6 +3656,7 @@ void CEXEBuild::set_target_architecture_predefines()
{
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("1"));
}
definedlist.add(_T("NSIS_PTR_SIZE"), m_target_type <= TARGET_X86UNICODE ? _T("4") : _T("8"));
}
int CEXEBuild::change_target_architecture()
@ -3664,7 +3667,7 @@ int CEXEBuild::change_target_architecture()
return PS_ERROR;
}
m_target_type = build_unicode ? TARGET_X86UNICODE : TARGET_X86ANSI;
m_target_type = build_unicode ? TARGET_X86UNICODE : TARGET_X86ANSI; // BUGBUG64
set_target_architecture_predefines();
int ec = load_stub();
@ -3708,6 +3711,9 @@ const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt) const
{
case TARGET_X86ANSI :return _T("x86-ansi");
case TARGET_X86UNICODE:return _T("x86-unicode");
#if !defined(_WIN32) || defined(_WIN64)
case TARGET_AMD64 :return _T("amd64-unicode");
#endif
default:return _T("?");
}
}

View file

@ -120,6 +120,7 @@ class CEXEBuild {
TARGETFIRST,
TARGET_X86ANSI = TARGETFIRST,
TARGET_X86UNICODE,
TARGET_AMD64, // Always Unicode
TARGET_UNKNOWN,
TARGETCOUNT = (TARGET_UNKNOWN-TARGETFIRST)
} TARGETTYPE;

View file

@ -16,13 +16,12 @@
* Unicode support by Jim Park -- 08/10/2007
*/
#include "../Platform.h"
#include <windowsx.h>
#include <shlobj.h>
#include <shellapi.h>
#include <shlwapi.h>
#include "../Platform.h"
#include "resource.h"
#include "fileform.h"
@ -65,15 +64,15 @@ static void NSISCALL outernotify(int delta) {
}
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
#ifdef NSIS_CONFIG_LICENSEPAGE
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
#endif
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
static DWORD WINAPI install_thread(LPVOID p);
@ -119,7 +118,7 @@ static void NSISCALL NotifyCurWnd(UINT uNotifyCode)
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam)
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if ((uMsg - WM_CTLCOLOREDIT) <= (WM_CTLCOLORSTATIC - WM_CTLCOLOREDIT))
{
@ -151,7 +150,7 @@ static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lPara
c->bkb = CreateBrushIndirect(&lh);
}
return (BOOL)c->bkb;
return (INT_PTR)c->bkb;
}
}
return 0;
@ -464,7 +463,7 @@ static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lPara
return 0;
}
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG || uMsg == WM_NOTIFY_OUTER_NEXT)
{
@ -738,7 +737,7 @@ DWORD CALLBACK StreamLicenseRTF(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
}
#endif
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
page *m_this_page=g_this_page;
HWND hwLicense;
@ -847,7 +846,7 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
#endif
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
@ -909,7 +908,7 @@ static int NSISCALL _sumsecsfield(int idx)
#define sumsecsfield(x) _sumsecsfield(SECTION_OFFSET(x))
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static int dontsetdefstyle;
page *thispage = g_this_page;
@ -1279,7 +1278,7 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
return CallWindowProc(oldTreeWndProc,hwnd,uMsg,wParam,lParam);
}
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
const int wParamSelChangeNotifyInstTypeChanged = -1;
static HTREEITEM *hTreeItems;
@ -1636,7 +1635,7 @@ static DWORD WINAPI install_thread(LPVOID p)
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND linsthwnd=insthwnd;
if (uMsg == WM_INITDIALOG)
@ -1724,24 +1723,14 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
HMENU menu = CreatePopupMenu();
POINT pt;
AppendMenu(menu,MF_STRING,1,GetNSISStringTT(LANG_COPYDETAILS));
if (lParam == ((UINT)-1))
pt.x = GET_X_LPARAM(lParam), pt.y = GET_Y_LPARAM(lParam);
if (lParam == ((UINT)-1)) // BUGBUG64?
{
RECT r;
GetWindowRect(linsthwnd, &r);
pt.x = r.left;
pt.y = r.top;
GetWindowRect(linsthwnd,&r);
pt.x = r.left, pt.y = r.top;
}
else
{
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
}
if (1==TrackPopupMenu(
menu,
TPM_NONOTIFY|TPM_RETURNCMD,
pt.x,
pt.y,
0,hwndDlg,0))
if (1==TrackPopupMenu(menu,TPM_NONOTIFY|TPM_RETURNCMD,pt.x,pt.y,0,hwndDlg,0))
{
int i,total = 1; // 1 for the null char
LVITEM item;

View file

@ -83,7 +83,7 @@ static int NSISCALL calc_percent()
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
#if defined(NSIS_CONFIG_CRC_SUPPORT) || defined(NSIS_COMPRESS_WHOLE)
BOOL CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
@ -99,13 +99,11 @@ BOOL CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#else
TCHAR *msg=_LANG_VERIFYINGINST;
#endif
wsprintf(bt,msg,percent);
my_SetWindowText(hwndDlg,bt);
my_SetDialogItemText(hwndDlg,IDC_STR,bt);
}
return 0;
return FALSE;
}
DWORD verify_time;
@ -460,8 +458,8 @@ static char _inbuffer[IBUFSIZE];
static char _outbuffer[OBUFSIZE];
extern int m_length;
extern int m_pos;
extern BOOL CALLBACK verProc(HWND, UINT, WPARAM, LPARAM);
extern BOOL CALLBACK DialogProc(HWND, UINT, WPARAM, LPARAM);
extern INT_PTR CALLBACK verProc(HWND, UINT, WPARAM, LPARAM);
extern INT_PTR CALLBACK DialogProc(HWND, UINT, WPARAM, LPARAM);
static int NSISCALL __ensuredata(int amount)
{
int needed=amount-(dbd_size-dbd_pos);

View file

@ -468,6 +468,7 @@ typedef struct
#define CC_BK_SYS 8
#define CC_BKB 16
#pragma pack(push, 4)
typedef struct {
COLORREF text;
COLORREF bkc;
@ -476,6 +477,7 @@ typedef struct {
int bkmode;
int flags;
} ctlcolors;
#pragma pack(pop)
// constants for myDelete (util.c)
#define DEL_DIR 1

View file

@ -877,8 +877,8 @@ int CEXEBuild::includeScript(const TCHAR *f, NStreamEncoding&enc)
{
NIStream incstrm;
const bool openok = incstrm.OpenFileForReading(f,enc);
if ( // !include defaults to UTF-8 after "Unicode true"
NStreamEncoding::AUTO == enc.GetCodepage() && build_unicode &&
if (NStreamEncoding::AUTO == enc.GetCodepage() && // !include defaults to UTF-8 after "Unicode true"
build_unicode && !enc.IsUnicodeCodepage(enc.GetPlatformDefaultCodepage()) &&
enc.GetPlatformDefaultCodepage() == incstrm.StreamEncoding().GetCodepage()
) incstrm.StreamEncoding().SetCodepage(NStreamEncoding::UTF8);
enc = incstrm.StreamEncoding();