Support major.minor.build versions in <sparkle:minimumSystemVersion>
Previously much less useful major.minor.servicepack was used, which was of limited practical applicability and is completely useless since Windows 10. To preserve backwards compatiblity, treat low values in the 3rd value of the tuple as service pack version.
This commit is contained in:
1 parent
f3708c79f2
commit
da4e7e2b5d
2 files changed
+25
-4
No files matched your search
@@ -1,6 +1,8 @@
|
||||
Version 0.8.2
|
||||
-------------
|
||||
|
||||
- Support major.minor.build versioning scheme in <sparkle:minimumSystemVersion>;
|
||||
previously only much less useful major.minor.servicepack was used.
|
||||
- Added support for gzip/deflate-compressed appcasts.
|
||||
- Added support for ARM-specific enclosures.
|
||||
- Fixed handling of multiple enclosures to correctly pick the most-specific
|
||||
|
||||
+23
-4
@@ -54,12 +54,18 @@ namespace
|
||||
|
||||
// Misc helper functions:
|
||||
|
||||
bool is_compatible_with_windows_version(const Appcast &item)
|
||||
bool is_compatible_with_windows_version(const Appcast &item_)
|
||||
{
|
||||
Appcast item(item_);
|
||||
|
||||
item.MinOSVersion = "10";
|
||||
|
||||
if (item.MinOSVersion.empty())
|
||||
return true;
|
||||
|
||||
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, { 0 }, 0, 0 };
|
||||
OSVERSIONINFOEXW osvi = {};
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
|
||||
DWORDLONG const dwlConditionMask = VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
@@ -67,8 +73,21 @@ bool is_compatible_with_windows_version(const Appcast &item)
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
|
||||
sscanf(item.MinOSVersion.c_str(), "%lu.%lu.%hu", &osvi.dwMajorVersion,
|
||||
&osvi.dwMinorVersion, &osvi.wServicePackMajor);
|
||||
const int parsed = sscanf(item.MinOSVersion.c_str(), "%lu.%lu.%lu",
|
||||
&osvi.dwMajorVersion, &osvi.dwMinorVersion, &osvi.dwBuildNumber);
|
||||
if (parsed == 0)
|
||||
{
|
||||
// failed to parse version number, ignore the value
|
||||
return true;
|
||||
}
|
||||
|
||||
// backwards compatibility with WinSparkle < 0.8.2 which used major.minor.sp
|
||||
// instead of major.minor.build for the version number:
|
||||
if (parsed == 3 && osvi.dwBuildNumber < 100)
|
||||
{
|
||||
osvi.wServicePackMajor = static_cast<WORD>(osvi.dwBuildNumber);
|
||||
osvi.dwBuildNumber = 0;
|
||||
}
|
||||
|
||||
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION |
|
||||
VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
|
||||
|
||||
Reference in new issue
Block a user