winapiinstallationnsis

Can I check if it's an ARM64 system in NSIS setup?


I am currently using NSIS 3.10 version.

I was watching NSIS news, and from 3.04 version I have seen the following.

NSIS 3.04 improves Windows 10 and ARM64 detection along with 
the usual collection of improvements, bug fixes and language file updates.

But I couldn't find any API or NSIS plugins available.

Also, I would like to separate the OS that does not support sha256 and decide whether to run or exit the setup process.

The OS is limited to Windows.

  1. Check Arm64 system
  2. Check not support SHA256 OS(system)

Should I rather make a dll and call it? Is it not supported by NSIS?


Solution

  • !include x64.nsh
    
    Function .onInit
    ${IfNot} ${IsNativeARM64}
      MessageBox MB_OK "ARM64 only please"
      Quit
    ${EndIf}
    FunctionEnd
    

    If you are talking about SHA256 hashing with the built-in Crypto API then it is support out of the box on Windows Vista and later. Windows XP needs Service Pack 3. You can hash with the Crypto plug-in:

    !include LogicLib.nsh
    
    Section
    ClearErrors
    Crypto::HashData "SHA2" "Hello world"
    Pop $0
    ${If} ${Errors}
        DetailPrint "SHA2 not supported, cannot calculate hash!"
    ${Else}
        DetailPrint "Hash is $0"
    ${EndIf}
    SectionEnd