nsis: custom error message for Qt5 OS version check

The CheckPlatform macro will prompt the user user to use the 32bit installer
if they are on a 32bit system. But we don't provide a 32bit installer anymore.

This commit changes the OS version check for Qt5 builds to be based on checking
version numbers ourselves too, so that we can have our own error message.

Also moves the Qt5 conditionals to be compile time ones.
This commit is contained in:
bitraid 2023-08-13 12:38:19 +12:00 committed by toofar
parent 6f7b76f066
commit 7599dbc209
1 changed files with 23 additions and 15 deletions

View File

@ -432,24 +432,32 @@ Function .onInit
StrCpy $KeepReg 1
; OS version check
${If} ${QT5} == "True"
!insertmacro CheckPlatform ${PLATFORM}
!insertmacro CheckMinWinVer ${MIN_WIN_VER}
Goto _os_check_pass
${ElseIf} ${RunningX64}
${If} ${RunningX64}
; https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoa#remarks
GetWinVer $R0 Major
IntCmpU $R0 10 0 _os_check_fail _os_check_pass
GetWinVer $R1 Build
${If} $R1 >= 22000 ; Windows 11 21H2
Goto _os_check_pass
${ElseIf} $R1 >= 14393 ; Windows 10 1607
${AndIf} ${IsNativeAMD64} ; Windows 10 has no x86_64 emulation on arm64
Goto _os_check_pass
${EndIf}
!if "${QT5}" == "True"
IntCmpU $R0 6 0 _os_check_fail _os_check_pass
GetWinVer $R1 Minor
IntCmpU $R1 2 _os_check_pass _os_check_fail _os_check_pass
!else
IntCmpU $R0 10 0 _os_check_fail _os_check_pass
GetWinVer $R1 Build
${If} $R1 >= 22000 ; Windows 11 21H2
Goto _os_check_pass
${ElseIf} $R1 >= 14393 ; Windows 10 1607
${AndIf} ${IsNativeAMD64} ; Windows 10 has no x86_64 emulation on arm64
Goto _os_check_pass
${EndIf}
!endif
${EndIf}
_os_check_fail:
MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\
version of Windows 10 1607 or later."
!if "${QT5}" == "True"
MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\
version of Windows 8 or later."
!else
MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\
version of Windows 10 1607 or later."
!endif
Abort
_os_check_pass: