* Added IsWow64 to x64.nsh and fixed RunningX64 for 64-bit installers.

* NSIS_AMD64 and NSIS_IX86 defines added for CPU target detection



git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6538 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2014-08-15 20:25:18 +00:00
parent 3c2a937cab
commit 7ae2e8f84f
4 changed files with 33 additions and 13 deletions

View file

@ -34,6 +34,8 @@ Released on ?, 2014
\b Fixed !macroundef \b Fixed !macroundef
\b Added IsWow64 to x64.nsh
\S2{} Translations \S2{} Translations
\b Added Armenian (Hrant Ohanyan) \b Added Armenian (Hrant Ohanyan)

View file

@ -93,6 +93,10 @@
!endif !endif
!macroend !macroend
!macro LogicLib_JumpToBranch _Jump _Skip
StrCmp "" "" `${_Jump}` ${_Skip}
!macroend
!macro _IncreaseCounter !macro _IncreaseCounter
!define _LOGICLIB_COUNTER ${LOGICLIB_COUNTER} !define _LOGICLIB_COUNTER ${LOGICLIB_COUNTER}
!undef LOGICLIB_COUNTER !undef LOGICLIB_COUNTER

View file

@ -4,7 +4,8 @@
; ;
; A few simple macros to handle installations on x64 machines. ; A few simple macros to handle installations on x64 machines.
; ;
; RunningX64 checks if the installer is running on x64. ; RunningX64 checks if the installer is running on a 64-bit OS.
; IsWow64 checks if the installer is a 32-bit application running on a 64-bit OS.
; ;
; ${If} ${RunningX64} ; ${If} ${RunningX64}
; MessageBox MB_OK "running on x64" ; MessageBox MB_OK "running on x64"
@ -25,30 +26,36 @@
!include LogicLib.nsh !include LogicLib.nsh
!macro _RunningX64 _a _b _t _f
!define IsWow64 `"" IsWow64 ""`
!macro _IsWow64 _a _b _t _f
!insertmacro _LOGICLIB_TEMP !insertmacro _LOGICLIB_TEMP
System::Call kernel32::GetCurrentProcess()p.s System::Call kernel32::GetCurrentProcess()p.s
System::Call kernel32::IsWow64Process(ps,*i.s) System::Call kernel32::IsWow64Process(ps,*i0s)
Pop $_LOGICLIB_TEMP Pop $_LOGICLIB_TEMP
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
!macroend !macroend
!define RunningX64 `"" RunningX64 ""` !define RunningX64 `"" RunningX64 ""`
!macro _RunningX64 _a _b _t _f
!macro DisableX64FSRedirection !if ${NSIS_PTR_SIZE} > 4
!insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
System::Call kernel32::Wow64EnableWow64FsRedirection(i0) !else
!insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
!endif
!macroend !macroend
!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" !define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
!macro DisableX64FSRedirection
!macro EnableX64FSRedirection System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
!macroend !macroend
!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" !define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
!macro EnableX64FSRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
!macroend
!endif # !___X64__NSH___ !endif # !___X64__NSH___

View file

@ -3767,6 +3767,13 @@ int CEXEBuild::set_target_architecture_data()
} }
definedlist.set(_T("NSIS_PTR_SIZE"), is_target_64bit() ? _T("8") : _T("4")); definedlist.set(_T("NSIS_PTR_SIZE"), is_target_64bit() ? _T("8") : _T("4"));
definedlist.del(_T("NSIS_IX86"));
definedlist.del(_T("NSIS_AMD64"));
if (TARGET_AMD64 == m_target_type)
definedlist.set(_T("NSIS_AMD64"));
else
definedlist.set(_T("NSIS_IX86"), build_unicode ? _T("400") : _T("300"));
return PS_OK; return PS_OK;
} }