Implement a proper check for Win10 in the MSI based on the build number from the registry

This commit is contained in:
Kovid Goyal 2022-07-11 12:00:19 +05:30
parent baf07dde67
commit b8c00070d8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 7 deletions

View File

@ -26,6 +26,11 @@
guarantees of anything. --> guarantees of anything. -->
<Property Id='REINSTALLMODE' Value='amus'/> <Property Id='REINSTALLMODE' Value='amus'/>
<!-- get the windows build number -->
<Property Id="WINDOWSBUILDNUMBER" Secure="yes">
<RegistrySearch Id="BuildNumberSearch" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="CurrentBuildNumber" Type="raw" />
</Property>
<Upgrade Id="{upgrade_code}"> <Upgrade Id="{upgrade_code}">
<UpgradeVersion Maximum="{version}" <UpgradeVersion Maximum="{version}"
IncludeMaximum="yes" IncludeMaximum="yes"
@ -172,9 +177,9 @@
<Property Id='ARPURLUPDATEINFO' Value="https://calibre-ebook.com/download_windows" /> <Property Id='ARPURLUPDATEINFO' Value="https://calibre-ebook.com/download_windows" />
<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" /> <SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" />
<Condition <Condition Message="calibre requires Windows 10 or newer.">
Message="This application is only supported on {minverhuman}, or higher."> <!-- See https://en.wikipedia.org/wiki/Windows_10_version_history for build numbers -->
<![CDATA[Installed OR (VersionNT >= {minver})]]> <![CDATA[Installed OR (WINDOWSBUILDNUMBER >= 10240)]]>
</Condition> </Condition>
<!-- On 64 bit installers there is a bug in WiX that causes the <!-- On 64 bit installers there is a bug in WiX that causes the
WixSetDefaultPerMachineFolder action to incorrectly set WixSetDefaultPerMachineFolder action to incorrectly set

View File

@ -37,10 +37,6 @@ def create_installer(env):
upgrade_code=UPGRADE_CODE, upgrade_code=UPGRADE_CODE,
ProgramFilesFolder='ProgramFiles64Folder' if is64bit else 'ProgramFilesFolder', ProgramFilesFolder='ProgramFiles64Folder' if is64bit else 'ProgramFilesFolder',
x64=' 64bit' if is64bit else '', x64=' 64bit' if is64bit else '',
minverhuman='Windows 10',
# We cant actually check for windows 10 because of
# https://community.flexera.com/t5/InstallShield-Knowledge-Base/Identifying-Windows-10-with-MSI/ta-p/4166
minver='603',
fix_wix='<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />' if is64bit else '', fix_wix='<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />' if is64bit else '',
compression='high', compression='high',
app_components=components, app_components=components,