• R/O
  • HTTP
  • SSH
  • HTTPS

MUtilities: Commit

MUtilities development repository


Commit MetaInfo

Revision8ec1f693936828083ab538d6cb958b14bce8953a (tree)
Time2021-12-25 08:04:23
AuthorLoRd_MuldeR <mulder2@gmx....>
CommiterLoRd_MuldeR

Log Message

Small improvement in OS detection code.

Change Summary

Incremental Difference

--- a/src/OSSupport_Win32.cpp
+++ b/src/OSSupport_Win32.cpp
@@ -277,20 +277,21 @@ static QReadWriteLock g_os_version_lock;
277277 static const struct
278278 {
279279 MUtils::OS::Version::os_version_t version;
280+ bool checkBuildNo;
280281 const char friendlyName[64];
281282 }
282283 g_os_version_lut[] =
283284 {
284- { MUtils::OS::Version::WINDOWS_WIN2K, "Windows 2000" }, //2000
285- { MUtils::OS::Version::WINDOWS_WINXP, "Windows XP or Windows XP Media Center Edition" }, //XP
286- { MUtils::OS::Version::WINDOWS_XPX64, "Windows Server 2003 or Windows XP x64" }, //XP_x64
287- { MUtils::OS::Version::WINDOWS_VISTA, "Windows Vista or Windows Server 2008" }, //Vista
288- { MUtils::OS::Version::WINDOWS_WIN70, "Windows 7 or Windows Server 2008 R2" }, //7
289- { MUtils::OS::Version::WINDOWS_WIN80, "Windows 8 or Windows Server 2012" }, //8
290- { MUtils::OS::Version::WINDOWS_WIN81, "Windows 8.1 or Windows Server 2012 R2" }, //8.1
291- { MUtils::OS::Version::WINDOWS_WIN10, "Windows 10 or Windows Server 2016/2019" }, //10
292- { MUtils::OS::Version::WINDOWS_WIN11, "Windows 11 or Windows Server 2022" }, //11
293- { MUtils::OS::Version::UNKNOWN_OPSYS, "N/A" }
285+ { MUtils::OS::Version::WINDOWS_WIN2K, 0, "Windows 2000" }, //2000
286+ { MUtils::OS::Version::WINDOWS_WINXP, 0, "Windows XP or Windows XP Media Center Edition" }, //XP
287+ { MUtils::OS::Version::WINDOWS_XPX64, 0, "Windows Server 2003 or Windows XP x64" }, //XP_x64
288+ { MUtils::OS::Version::WINDOWS_VISTA, 0, "Windows Vista or Windows Server 2008" }, //Vista
289+ { MUtils::OS::Version::WINDOWS_WIN70, 0, "Windows 7 or Windows Server 2008 R2" }, //7
290+ { MUtils::OS::Version::WINDOWS_WIN80, 0, "Windows 8 or Windows Server 2012" }, //8
291+ { MUtils::OS::Version::WINDOWS_WIN81, 0, "Windows 8.1 or Windows Server 2012 R2" }, //8.1
292+ { MUtils::OS::Version::WINDOWS_WIN10, 0, "Windows 10 or Windows Server 2016" }, //10
293+ { MUtils::OS::Version::WINDOWS_WIN11, 1, "Windows 11 or Windows Server 2022" }, //11
294+ { MUtils::OS::Version::UNKNOWN_OPSYS, 0, "N/A" }
294295 };
295296
296297 //OS version data dtructures
@@ -315,7 +316,7 @@ namespace MUtils
315316 const os_version_t WINDOWS_WIN80 = { OS_WINDOWS, 6, 2, 9200, 0 }; // 8
316317 const os_version_t WINDOWS_WIN81 = { OS_WINDOWS, 6, 3, 9600, 0 }; // 8.1
317318 const os_version_t WINDOWS_WIN10 = { OS_WINDOWS, 10, 0, 10240, 0 }; // 10
318- const os_version_t WINDOWS_WIN11 = { OS_WINDOWS, 10, 0, 20348, 0 }; // 11
319+ const os_version_t WINDOWS_WIN11 = { OS_WINDOWS, 10, 0, 22000, 0 }; // 11
319320
320321 //Unknown OS
321322 const os_version_t UNKNOWN_OPSYS = { OS_UNKNOWN, 0, 0, 0, 0 }; // N/A
@@ -453,7 +454,7 @@ const char *MUtils::OS::os_friendly_name(const MUtils::OS::Version::os_version_t
453454 for (size_t i = 0; g_os_version_lut[i].version.type != MUtils::OS::Version::OS_UNKNOWN; i++)
454455 {
455456 const MUtils::OS::Version::os_version_t &version = g_os_version_lut[i].version;
456- if ((os_version.versionMajor == version.versionMajor) && (os_version.versionMinor == version.versionMinor) && (os_version.versionBuild >= version.versionBuild))
457+ if ((os_version.versionMajor == version.versionMajor) && (os_version.versionMinor == version.versionMinor) && ((!g_os_version_lut[i].checkBuildNo) || (os_version.versionBuild >= version.versionBuild)))
457458 {
458459 friendly_name = g_os_version_lut[i].friendlyName;
459460 }
--- a/test/MUtilitiesTest_VS2017.vcxproj
+++ b/test/MUtilitiesTest_VS2017.vcxproj
@@ -32,14 +32,14 @@
3232 <ProjectGuid>{B7BCA0A5-17AD-4F20-A42C-CD6FFBD55D89}</ProjectGuid>
3333 <Keyword>Win32Proj</Keyword>
3434 <RootNamespace>MUtilitiesTest_VS2017</RootNamespace>
35- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
35+ <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
3636 <ProjectName>MUtilitiesTest</ProjectName>
3737 </PropertyGroup>
3838 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
3939 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
4040 <ConfigurationType>Application</ConfigurationType>
4141 <UseDebugLibraries>true</UseDebugLibraries>
42- <PlatformToolset>v141_xp</PlatformToolset>
42+ <PlatformToolset>v141</PlatformToolset>
4343 <CharacterSet>Unicode</CharacterSet>
4444 </PropertyGroup>
4545 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@@ -133,6 +133,7 @@
133133 <AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\lib;$(SolutionDir)\..\Prerequisites\GoogleTest\lib\$(PlatformToolset)\Shared;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
134134 <AdditionalDependencies>notelemetry.obj;gtest.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>
135135 <ShowProgress>LinkVerboseLib</ShowProgress>
136+ <MinimumRequiredVersion>5.1</MinimumRequiredVersion>
136137 </Link>
137138 </ItemDefinitionGroup>
138139 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
@@ -160,6 +161,7 @@
160161 <AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Static\lib;$(SolutionDir)\..\Prerequisites\GoogleTest\lib\$(PlatformToolset)\Static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
161162 <AdditionalDependencies>notelemetry.obj;gtest.lib;QtCore.lib;QtGui.lib;Ws2_32.lib;Winmm.lib;Imm32.lib;PowrProf.lib;Version.lib;Psapi.lib;Sensapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
162163 <ShowProgress>LinkVerboseLib</ShowProgress>
164+ <MinimumRequiredVersion>5.1</MinimumRequiredVersion>
163165 </Link>
164166 </ItemDefinitionGroup>
165167 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Show on old repository browser