diff --git a/Docs/src/history.but b/Docs/src/history.but index c4919226..73f7afe0 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -34,6 +34,8 @@ Released on ?, 2014 \b Fixed !macroundef +\b Added IsWow64 to x64.nsh + \S2{} Translations \b Added Armenian (Hrant Ohanyan) diff --git a/Include/LogicLib.nsh b/Include/LogicLib.nsh index 4fdd527f..dc1c05d0 100644 --- a/Include/LogicLib.nsh +++ b/Include/LogicLib.nsh @@ -93,6 +93,10 @@ !endif !macroend + !macro LogicLib_JumpToBranch _Jump _Skip + StrCmp "" "" `${_Jump}` ${_Skip} + !macroend + !macro _IncreaseCounter !define _LOGICLIB_COUNTER ${LOGICLIB_COUNTER} !undef LOGICLIB_COUNTER diff --git a/Include/x64.nsh b/Include/x64.nsh index a35e0990..e66fb859 100644 --- a/Include/x64.nsh +++ b/Include/x64.nsh @@ -4,7 +4,8 @@ ; ; 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} ; MessageBox MB_OK "running on x64" @@ -25,30 +26,36 @@ !include LogicLib.nsh -!macro _RunningX64 _a _b _t _f + +!define IsWow64 `"" IsWow64 ""` +!macro _IsWow64 _a _b _t _f !insertmacro _LOGICLIB_TEMP System::Call kernel32::GetCurrentProcess()p.s - System::Call kernel32::IsWow64Process(ps,*i.s) + System::Call kernel32::IsWow64Process(ps,*i0s) Pop $_LOGICLIB_TEMP !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` !macroend + !define RunningX64 `"" RunningX64 ""` - -!macro DisableX64FSRedirection - - System::Call kernel32::Wow64EnableWow64FsRedirection(i0) - +!macro _RunningX64 _a _b _t _f + !if ${NSIS_PTR_SIZE} > 4 + !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}` + !else + !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}` + !endif !macroend + !define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" - -!macro EnableX64FSRedirection - - System::Call kernel32::Wow64EnableWow64FsRedirection(i1) - +!macro DisableX64FSRedirection + System::Call kernel32::Wow64EnableWow64FsRedirection(i0) !macroend !define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" +!macro EnableX64FSRedirection + System::Call kernel32::Wow64EnableWow64FsRedirection(i1) +!macroend + !endif # !___X64__NSH___ diff --git a/Source/build.cpp b/Source/build.cpp index 09a4a6fc..93e03728 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -3767,6 +3767,13 @@ int CEXEBuild::set_target_architecture_data() } 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; }