x64.nsh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ; ---------------------
  2. ; x64.nsh
  3. ; ---------------------
  4. ;
  5. ; A few simple macros to handle installations on x64 machines.
  6. ;
  7. ; RunningX64 checks if the installer is running on a 64-bit OS.
  8. ; IsWow64 checks if the installer is a 32-bit application running on a 64-bit OS.
  9. ;
  10. ; ${If} ${RunningX64}
  11. ; MessageBox MB_OK "running on x64"
  12. ; ${EndIf}
  13. ;
  14. ; DisableX64FSRedirection disables file system redirection.
  15. ; EnableX64FSRedirection enables file system redirection.
  16. ;
  17. ; SetOutPath $SYSDIR
  18. ; ${DisableX64FSRedirection}
  19. ; File some.dll # extracts to C:\Windows\System32
  20. ; ${EnableX64FSRedirection}
  21. ; File some.dll # extracts to C:\Windows\SysWOW64
  22. ;
  23. !ifndef ___X64__NSH___
  24. !define ___X64__NSH___
  25. !include LogicLib.nsh
  26. !define IsWow64 `"" IsWow64 ""`
  27. !macro _IsWow64 _a _b _t _f
  28. !insertmacro _LOGICLIB_TEMP
  29. System::Call kernel32::GetCurrentProcess()p.s
  30. System::Call kernel32::IsWow64Process(ps,*i0s)
  31. Pop $_LOGICLIB_TEMP
  32. !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
  33. !macroend
  34. !define RunningX64 `"" RunningX64 ""`
  35. !macro _RunningX64 _a _b _t _f
  36. !if ${NSIS_PTR_SIZE} > 4
  37. !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
  38. !else
  39. !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
  40. !endif
  41. !macroend
  42. !define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
  43. !macro DisableX64FSRedirection
  44. System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
  45. !macroend
  46. !define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
  47. !macro EnableX64FSRedirection
  48. System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
  49. !macroend
  50. !endif # !___X64__NSH___