64bit fixes and optimizations
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6486 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
0bcb8f40ed
commit
36deb84820
14 changed files with 74 additions and 51 deletions
|
@ -83,7 +83,7 @@ typedef HANDLE HMODULE;
|
|||
typedef unsigned long HKEY;
|
||||
// some gdi
|
||||
typedef DWORD COLORREF;
|
||||
typedef UINT32 HBRUSH;
|
||||
typedef HANDLE HBRUSH;
|
||||
// bool
|
||||
# define FALSE 0
|
||||
# define TRUE 1
|
||||
|
|
|
@ -2316,7 +2316,7 @@ void CEXEBuild::AddStandardStrings()
|
|||
}
|
||||
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
cur_header->str_wininit = add_asciistring(_T("$WINDIR\\wininit.ini"));
|
||||
cur_header->str_wininit = is_target_64bit() ? 0 : add_asciistring(_T("$WINDIR\\wininit.ini"));
|
||||
#endif//NSIS_SUPPORT_MOVEONREBOOT
|
||||
}
|
||||
|
||||
|
@ -2816,7 +2816,7 @@ int CEXEBuild::write_output(void)
|
|||
|
||||
if (db_opt_save)
|
||||
{
|
||||
UINT32 total_out_size_estimate=
|
||||
size_t total_out_size_estimate=
|
||||
m_exehead_size+sizeof(fh)+build_datablock.getlen()+(build_crcchk?sizeof(crc32_t):0);
|
||||
int pc=(int)((db_opt_save*1000)/(db_opt_save+total_out_size_estimate));
|
||||
FriendlySize fs(db_opt_save);
|
||||
|
|
|
@ -320,14 +320,14 @@ end:
|
|||
BOOL (WINAPI *OPT)(HANDLE, DWORD,PHANDLE);
|
||||
BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID);
|
||||
BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
|
||||
#ifndef _WIN64
|
||||
#ifdef _WIN64
|
||||
OPT=OpenProcessToken, LPV=LookupPrivilegeValue, ATP=AdjustTokenPrivileges;
|
||||
#else
|
||||
OPT=myGetProcAddress(MGA_OpenProcessToken);
|
||||
LPV=myGetProcAddress(MGA_LookupPrivilegeValue);
|
||||
ATP=myGetProcAddress(MGA_AdjustTokenPrivileges);
|
||||
#else
|
||||
OPT=OpenProcessToken, LPV=LookupPrivilegeValue, ATP=AdjustTokenPrivileges;
|
||||
#endif
|
||||
if (OPT && LPV && ATP)
|
||||
#endif
|
||||
{
|
||||
HANDLE hToken;
|
||||
TOKEN_PRIVILEGES tkp;
|
||||
|
|
|
@ -236,16 +236,17 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
|
||||
LANGID (WINAPI *GUDUIL)();
|
||||
|
||||
#ifndef _WIN64
|
||||
GUDUIL = myGetProcAddress(MGA_GetUserDefaultUILanguage);
|
||||
#else
|
||||
#ifdef _WIN64
|
||||
GUDUIL = GetUserDefaultUILanguage;
|
||||
#endif
|
||||
#else
|
||||
GUDUIL = myGetProcAddress(MGA_GetUserDefaultUILanguage);
|
||||
if (GUDUIL)
|
||||
#endif
|
||||
{
|
||||
// Windows ME/2000+
|
||||
myitoa(state_language, GUDUIL());
|
||||
}
|
||||
#ifndef _WIN64
|
||||
else
|
||||
{
|
||||
static const TCHAR reg_9x_locale[] = _T("Control Panel\\Desktop\\ResourceLocale");
|
||||
|
@ -270,6 +271,7 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
|
||||
mystrcat(state_language, g_tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
// set default language
|
||||
set_language();
|
||||
|
|
|
@ -457,6 +457,7 @@ BOOL NSISCALL myReadFile(HANDLE h, LPVOID buf, DWORD cb)
|
|||
}
|
||||
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
#ifndef _WIN64
|
||||
/** Modifies the wininit.ini file to rename / delete a file.
|
||||
*
|
||||
* @param prevName The previous / current name of the file.
|
||||
|
@ -555,6 +556,7 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName)
|
|||
CloseHandle(hfile);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MoveFileOnReboot tries to move a file by the name of pszExisting to the
|
||||
|
@ -577,11 +579,12 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
{
|
||||
fOk=mfea(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
if (!fOk && sizeof(void*) <= 4)
|
||||
#ifndef _WIN64
|
||||
if (!fOk)
|
||||
{
|
||||
RenameViaWininit(pszExisting, pszNew);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
g_exec_flags.exec_reboot++;
|
||||
|
@ -610,7 +613,7 @@ void NSISCALL myRegGetStr(HKEY root, const TCHAR *sub, const TCHAR *name, TCHAR
|
|||
void NSISCALL iptrtostr(TCHAR *s, INT_PTR d)
|
||||
{
|
||||
#ifdef _WIN64
|
||||
static const TCHAR c[] = _T("%I64d");
|
||||
static const TCHAR c[] = _T("%Id");
|
||||
#else
|
||||
static const TCHAR c[] = _T("%d");
|
||||
#endif
|
||||
|
|
|
@ -723,8 +723,11 @@ void CEXEBuild::ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hi
|
|||
if (t)
|
||||
{
|
||||
UINT32 codpts[]={utf32,UNICODE_REPLACEMENT_CHARACTER,'?'};
|
||||
for(UINT i=0; i < COUNTOF(codpts); ++i)
|
||||
if (WCFromCodePoint(dyndefbuf,COUNTOF(dyndefbuf),codpts[i])) break;
|
||||
for(size_t i=0, cch; i < COUNTOF(codpts); ++i)
|
||||
{
|
||||
cch = WCFromCodePoint(dyndefbuf,COUNTOF(dyndefbuf),codpts[i]);
|
||||
if (cch) { dyndefbuf[cch] = _T('\0'); break; }
|
||||
}
|
||||
t=dyndefbuf;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ unsigned int ExeHeadStringList::find(const void *ptr, unsigned int cchF, WORD co
|
|||
else
|
||||
delete[] bufMB;
|
||||
}
|
||||
return retval;
|
||||
return BUGBUG64TRUNCATE(unsigned int, retval);
|
||||
}
|
||||
|
||||
int ExeHeadStringList::add(const TCHAR *str, WORD codepage, bool processed)
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef wchar_t TCHAR, _TUCHAR;
|
|||
#define _tprintf wprintf
|
||||
#define _vftprintf vfwprintf
|
||||
#define _vsntprintf _vsnwprintf
|
||||
#if defined(_MSC_VER) && (_MSC_VER<=1310)
|
||||
#if defined(_MSC_VER) && (_MSC_VER<=1310||_MSC_FULL_VER<=140040310)
|
||||
# define _vstprintf vswprintf
|
||||
#else
|
||||
# define _vstprintf _vswprintf
|
||||
|
@ -242,10 +242,11 @@ typedef unsigned char _TUCHAR;
|
|||
|
||||
#endif
|
||||
|
||||
// is functions (the same in Unicode / ANSI)
|
||||
#ifndef _istgraph
|
||||
#define _istgraph isgraph
|
||||
#endif
|
||||
// is functions (the same in Unicode / ANSI on MinGW? MSVC does not agree!)
|
||||
#ifndef _istascii
|
||||
#define _istascii __isascii
|
||||
#if defined(_MSC_VER) && defined(_UNICODE)
|
||||
#define _istascii iswascii
|
||||
#else
|
||||
#define _istascii __isascii
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue