Prevent the portable installer from running on windows older than w10

This commit is contained in:
Kovid Goyal 2022-07-11 11:22:32 +05:30
parent 58e8bf98cd
commit baf07dde67
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 5 deletions

View File

@ -76,9 +76,6 @@ EXE_MANIFEST = '''\
</trustInfo> </trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<supportedOS Id="{w7}"/>
<supportedOS Id="{w8}"/>
<supportedOS Id="{w81}"/>
<supportedOS Id="{w10}"/> <supportedOS Id="{w10}"/>
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings"> <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware> <ws2:longPathAware>true</ws2:longPathAware>

View File

@ -16,6 +16,7 @@
#include <io.h> #include <io.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <VersionHelpers.h>
#include <easylzma/decompress.h> #include <easylzma/decompress.h>
#include "XUnzip.h" #include "XUnzip.h"
@ -525,6 +526,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
WCHAR buf[4*MAX_PATH] = {0}, mb_msg[4*MAX_PATH] = {0}, fdest[4*MAX_PATH] = {0}; WCHAR buf[4*MAX_PATH] = {0}, mb_msg[4*MAX_PATH] = {0}, fdest[4*MAX_PATH] = {0};
if (!load_data(&cdata, &csz)) return ret; if (!load_data(&cdata, &csz)) return ret;
if (!IsWindows10OrGreater()) { show_error(L"Your version of Windows is tool old. calibre requires Windows 10 or greater."); return ret; }
hr = CoInitialize(NULL); hr = CoInitialize(NULL);
if (FAILED(hr)) { show_error(L"Failed to initialize COM"); return ret; } if (FAILED(hr)) { show_error(L"Failed to initialize COM"); return ret; }

View File

@ -14,7 +14,6 @@ if is64bit:
UPGRADE_CODE = '5DD881FF-756B-4097-9D82-8C0F11D521EA' UPGRADE_CODE = '5DD881FF-756B-4097-9D82-8C0F11D521EA'
else: else:
UPGRADE_CODE = 'BEB2A80D-E902-4DAD-ADF9-8BD2DA42CFE1' UPGRADE_CODE = 'BEB2A80D-E902-4DAD-ADF9-8BD2DA42CFE1'
MINVERHUMAN = 'Windows 10'
calibre_constants = globals()['calibre_constants'] calibre_constants = globals()['calibre_constants']
CANDLE = WIXP + r'\bin\candle.exe' CANDLE = WIXP + r'\bin\candle.exe'
@ -38,7 +37,9 @@ 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=MINVERHUMAN, 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', 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',