Skip to content

Commit 3aa37bc

Browse files
committed
Update 3rd party PJSysInfo unit to v5.11.0
Fixes #49
1 parent ff0400d commit 3aa37bc

File tree

1 file changed

+123
-66
lines changed

1 file changed

+123
-66
lines changed

Src/3rdParty/PJSysInfo.pas

Lines changed: 123 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
44
* obtain one at http://mozilla.org/MPL/2.0/
55
*
6-
* Copyright (C) 2001-2021, Peter Johnson (@delphidabbler).
7-
*
8-
* $Rev: 2082 $
9-
* $Date: 2022-01-01 10:12:03 +0000 (Sat, 01 Jan 2022) $
6+
* Copyright (C) 2001-2022, Peter Johnson (@delphidabbler).
107
*
118
* This unit contains various static classes, constants, type definitions and
129
* global variables for use in providing information about the host computer and
@@ -419,7 +416,8 @@ interface
419416
osWin10Svr, // Windows 2016 Server
420417
osWinSvr2019, // Windows 2019 Server
421418
osWin11, // Windows 11
422-
osWinSvr2022 // Windows 2022 Server
419+
osWinSvr2022, // Windows 2022 Server
420+
osWinServer // Windows Server (between Server 2019 & 2022)
423421
);
424422

425423
type
@@ -1209,6 +1207,7 @@ implementation
12091207
Win8Point1Build = 9600; // Build number used for all Win 8.1/Svr 2012 R2
12101208

12111209
// Windows 10 ----------------------------------------------------------------
1210+
12121211
Win10TH1Build = 10240; // Windows 10 TH1 - version 1507 (1st release)
12131212
Win10TH2Build = 10586; // Windows 10 TH2 - version 1511
12141213
Win10RS1Build = 14393; // Windows 10 RS1 - version 1607
@@ -1221,9 +1220,28 @@ implementation
12211220
Win1020H1Build = 19041; // Windows 10 20H1 - version 2004
12221221
Win1020H2Build = 19042; // Windows 10 20H2 - version 20H2
12231222
Win1021H1Build = 19043; // Windows 10 21H1 - version 21H1
1223+
// revisions 844..964 were beta
12241224
Win1021H2Build = 19044; // Windows 10 21H2 - version 21H2
1225+
// revisions 1147..1266 were previews
1226+
1227+
// Fast ring
1228+
Win10FastRing: array[0..21] of Integer = (
1229+
19536, 19541, 19546, 19551, 19555, 19559, 19564, 19569, 19577, 19582, 19587,
1230+
19592, 19603, 19608, 19613, 19619, 19624, 19628, 19631, 19635, 19640, 19645
1231+
);
1232+
1233+
// Dev channel
1234+
// Assuming all Dev channel releases had version string "Dev"
1235+
Win10DevChannel: array[0..44] of Integer = (
1236+
20150, 20152, 20161, 20170, 20175, 20180, 20185, 20190, 20197, 20201, 20206,
1237+
20211, 20215, 20221, 20226, 20231, 20236, 20241, 20246, 20251, 20257, 20262,
1238+
20270, 20277, 21277, 20279, 21286, 21292, 21296, 21301, 21313, 21318, 21322,
1239+
21327, 21332, 21337, 21343, 21354, 21359, 21364, 21370, 21376, 21382, 21387,
1240+
21390 // transitioned to Windows 11 after here
1241+
);
12251242

12261243
// Windows 11 ----------------------------------------------------------------
1244+
12271245
// NOTE: Preview and beta & release versions of Windows 11 report version 10.0
12281246
Win11DevBuild = 21996; // Windows 11 version Dev
12291247
// - 10.0.21996.1 (Insider version)
@@ -1237,28 +1255,28 @@ implementation
12371255
// Revision # 194
12381256
// Windows 11 version 21H2
12391257
// - ** 1st Public Release **
1240-
Win11v21H2PreRel1Build = 22449; // Windows 11 version 21H2
1241-
// - 10.0.22449.000 (RSPRERELEASE)
1242-
Win11v21H2PreRel2Build = 22454; // Windows 11 version 21H2
1243-
// - 10.0.22454.1000 (RSPRERELEASE)
1244-
Win11v21H2PreRel3Build = 22458; // Windows 11 version 21H2
1245-
// - 10.0.22458.1000 (RSPRERELEASE)
1246-
Win11v21H2PreRel4Build = 22463; // Windows 11 version 21H2
1247-
// - 10.0.22463.1000 (RSPRERELEASE)
1248-
Win11v21H2PreRel5Build = 22468; // Windows 11 version 21H2
1249-
// - 10.0.22468.1000 (RSPRERELEASE)
1250-
Win11v21H2PreRel6Build = 22471; // Windows 11 version 21H2
1251-
// - 10.0.22471.1000 (RSPRERELEASE)
1252-
Win11v21H2PreRel7Build = 22478; // Windows 11 version 21H2
1253-
// - 10.0.22478.1000 (RSPRERELEASE)
1254-
Win11v21H2PreRel8Build = 22483; // Windows 11 version 21H2
1255-
// - 10.0.22483.1000 (RSPRERELEASE)
1256-
Win11v21H2PreRel9Build = 22489; // Windows 11 version 21H2
1257-
// - 10.0.22489.1000 (RSPRERELEASE)
1258-
Win11v21H2PreRel10Build = 22494;// Windows 11 version 21H2
1259-
// - 10.0.22494.1000 (RSPRERELEASE)
1260-
Win11v21H2PreRel11Build = 22509;// Windows 11 version 21H2
1261-
// - 10.0.22509.1000 (RSPRERELEASE)
1258+
1259+
// Dev channel release - different sources give different names.
1260+
// From what I can gather (and take this with a pinch of salt!):
1261+
// * Insider Dev channel releases from the RS_PRERELEASE branch weren't
1262+
// matched to a Windows 11 release and had version string "Dev").
1263+
// * The NI_RELEASE channel was used from 2022/02/16 (build 2257).
1264+
// * From build 22567 the release string changed from "Dev" to "22H"
1265+
1266+
// Builds with version string "Dev"
1267+
Win11DevChannelDevBuilds: array[0..20] of Integer = (
1268+
22449, 22454, 22458, 22463, 22468, // pre Win 11 release
1269+
22471, 22478, 22483, 22489, 22494, 22499, 22504, 22509, 22518, 22523, 22526,
1270+
22533, 22538, 22543, 22557, 22563
1271+
);
1272+
// Builds with version string "22H2" in Dev channel
1273+
Win11DevChannel22H2Builds: array[0..2] of Integer = (
1274+
22567, 22572, 22579
1275+
);
1276+
// Builds with version string "22H2" in Dev & Beta channels
1277+
Win11DevBetaChannels22H2Builds: array[0..3] of Integer = (
1278+
22581, 22593, 22598, 22610
1279+
);
12621280

12631281
Win11FirstBuild = Win11DevBuild; // First build number of Windows 11
12641282

@@ -1275,23 +1293,23 @@ implementation
12751293
// After this it's Win 2019 Server
12761294

12771295
// Windows 2019 Server -------------------------------------------------------
1278-
Win2019IP180320Build = 17623; // Win Server 2019 Insider Preview Build 17623
1279-
Win2019IP180324Build = 17627; // Win Server 2019 Insider Preview Build 17627
1280-
Win2019IP180515Build = 17666; // Win Server 2019 Insider Preview Build 17666
1281-
Win2019IP180619Build = 17692; // Win Server 2019 Insider Preview Build 17692
1282-
Win2019IP180710Build = 17709; // Win Server 2019 Insider Preview Build 17709
1283-
Win2019IP180716Build = 17713; // Win Server 2019 Insider Preview Build 17713
1284-
Win2019IP180731Build = 17723; // Win Server 2019 Insider Preview Build 17723
1285-
Win2019IP180814Build = 17733; // Win Server 2019 Insider Preview Build 17733
1286-
Win2019IP180821Build = 17738; // Win Server 2019 Insider Preview Build 17738
1287-
Win2019IP180828Build = 17744; // Win Server 2019 Insider Preview Build 17744
1296+
// Insider Preview builds
1297+
Win2019IPBuilds: array[0..9] of Integer = (
1298+
17623, 17627, 17666, 17692, 17709, 17713, 17723, 17733, 17738, 17744
1299+
);
1300+
// Release builds
12881301
Win2019v1809Build = 17763; // Win Server 2019 version 1809
12891302
Win2019v1903Build = 18362; // Win Server 2019 version 1903
12901303
Win2019v1909Build = 18363; // Win Server 2019 version 1909
1291-
Win2019v2004Build = 19041; // Win Server 2019 version 2004
1292-
Win2019v20H2Build = 19042; // Win Server 2019 version 20H2
1293-
Win2019LastBuild = Win2019v20H2Build; // Last build number of Win 2019 Server
1294-
// After this it's Win 2022 Server
1304+
Win2019LastBuild = Win2019v1909Build; // Last build number of Win 2019 Server
1305+
// After this it's Windows Server
1306+
1307+
// Windows Server ------------------------------------------------------------
1308+
WinServerv2004Build = 19041; // Win Server version 2004
1309+
WinServerv20H2Build = 19042; // Win Server version 20H2
1310+
WinServerLastBuild = WinServerv20H2Build; // Last build number of Windows
1311+
// Server. After this it's Window
1312+
// 2022 Sever
12951313

12961314
// Windows 2022 Server -------------------------------------------------------
12971315
Win2022v21H2Build = 20348; // Win Server 2022 version 21H2
@@ -1510,6 +1528,14 @@ function ExcludeTrailingPathDelimiter(const DirOrPath: string) : string;
15101528
end;
15111529
{$ENDIF}
15121530

1531+
// Checks if integer V is in the range of values defined by VLo and VHi,
1532+
// inclusive.
1533+
function IsInRange(const V, VLo, VHi: Integer): Boolean;
1534+
begin
1535+
Assert(VLo <= VHi);
1536+
Result := (V >= VLo) and (V <= VHi);
1537+
end;
1538+
15131539
// Returns the value of the given environment variable.
15141540
function GetEnvVar(const VarName: string): string;
15151541
var
@@ -1823,15 +1849,38 @@ procedure InitPlatformIdEx;
18231849
begin
18241850
InternalBuildNumber := Win1021H1Build;
18251851
InternalExtraUpdateInfo := 'Version 21H1';
1852+
if IsInRange(InternalRevisionNumber, 844, 964) then
1853+
InternalExtraUpdateInfo := InternalExtraUpdateInfo + ' (beta)';
18261854
end
18271855
else if IsBuildNumber(Win1021H2Build) then
18281856
begin
18291857
// From 21H2 Windows 10 moves from a 6 monthly update cycle to a
18301858
// yearly cycle
18311859
InternalBuildNumber := Win1021H2Build;
18321860
InternalExtraUpdateInfo := 'Version 21H2';
1861+
if IsInRange(InternalRevisionNumber, 1147, 1266) then
1862+
InternalExtraUpdateInfo := InternalExtraUpdateInfo
1863+
+ ' (preview)';
1864+
end
1865+
else if FindBuildNumberFrom(
1866+
Win10DevChannel, InternalBuildNumber
1867+
) then
1868+
begin
1869+
// Windows 10 Dev Channel releases
1870+
InternalExtraUpdateInfo := Format(
1871+
'Dev Channel v10.0.%d.%d (Dev)',
1872+
[InternalBuildNumber, InternalRevisionNumber]
1873+
);
18331874
end
1834-
// As of 2021-09-11, Win 11 pre-releases are reporting v10.0
1875+
else if FindBuildNumberFrom(Win10FastRing, InternalBuildNumber) then
1876+
begin
1877+
// Windows 10 Fast Ring releases
1878+
InternalExtraUpdateInfo := Format(
1879+
'Fast ring v10.0.%d.%d',
1880+
[InternalBuildNumber, InternalRevisionNumber]
1881+
);
1882+
end
1883+
// Win 11 releases are reporting v10.0
18351884
// Details taken from: https://tinyurl.com/usupsz4a
18361885
// Correct according to above web page as of 2021-09-11
18371886
else if IsBuildNumber(Win11DevBuild) then
@@ -1872,19 +1921,32 @@ procedure InitPlatformIdEx;
18721921
end;
18731922
end
18741923
else if FindBuildNumberFrom(
1875-
[
1876-
Win11v21H2PreRel1Build, Win11v21H2PreRel2Build,
1877-
Win11v21H2PreRel3Build, Win11v21H2PreRel4Build,
1878-
Win11v21H2PreRel5Build, Win11v21H2PreRel6Build,
1879-
Win11v21H2PreRel7Build, Win11v21H2PreRel8Build,
1880-
Win11v21H2PreRel9Build, Win11v21H2PreRel10Build,
1881-
Win11v21H2PreRel11Build
1882-
],
1883-
InternalBuildNumber
1924+
Win11DevChannelDevBuilds, InternalBuildNumber
1925+
) then
1926+
begin
1927+
// Win11 Dev Channel builds with version string "Dev"
1928+
InternalExtraUpdateInfo := Format(
1929+
'Dev Channel v10.0.%d.%d (Dev)',
1930+
[InternalBuildNumber, InternalRevisionNumber]
1931+
);
1932+
end
1933+
else if FindBuildNumberFrom(
1934+
Win11DevChannel22H2Builds, InternalBuildNumber
1935+
) then
1936+
begin
1937+
// Win11 Dev channel builds with version string "22H2"
1938+
InternalExtraUpdateInfo := Format(
1939+
'Dev Channel v10.0.%d.%d (22H2)',
1940+
[InternalBuildNumber, InternalRevisionNumber]
1941+
);
1942+
end
1943+
else if FindBuildNumberFrom(
1944+
Win11DevBetaChannels22H2Builds, InternalBuildNumber
18841945
) then
18851946
begin
1947+
// Win 11 Dev & Beta channel builds with verison string "22H2"
18861948
InternalExtraUpdateInfo := Format(
1887-
'Version 21H2 [RSPRERELEASE v10.0.%d.%d]',
1949+
'Dev & Beta Channels v10.0.%d.%d (22H2)',
18881950
[InternalBuildNumber, InternalRevisionNumber]
18891951
);
18901952
end
@@ -1930,14 +1992,7 @@ procedure InitPlatformIdEx;
19301992
InternalExtraUpdateInfo := 'Version 1803';
19311993
end
19321994
else if FindBuildNumberFrom(
1933-
[
1934-
Win2019IP180320Build, Win2019IP180324Build,
1935-
Win2019IP180515Build, Win2019IP180619Build,
1936-
Win2019IP180710Build, Win2019IP180716Build,
1937-
Win2019IP180731Build, Win2019IP180814Build,
1938-
Win2019IP180821Build, Win2019IP180828Build
1939-
],
1940-
InternalBuildNumber
1995+
Win2019IPBuilds, InternalBuildNumber
19411996
) then
19421997
begin
19431998
InternalExtraUpdateInfo := Format(
@@ -1959,14 +2014,14 @@ procedure InitPlatformIdEx;
19592014
InternalBuildNumber := Win2019v1909Build;
19602015
InternalExtraUpdateInfo := 'Version 1909';
19612016
end
1962-
else if IsBuildNumber(Win2019v2004Build) then
2017+
else if IsBuildNumber(WinServerv2004Build) then
19632018
begin
1964-
InternalBuildNumber := Win2019v2004Build;
2019+
InternalBuildNumber := WinServerv2004Build;
19652020
InternalExtraUpdateInfo := 'Version 2004';
19662021
end
1967-
else if IsBuildNumber(Win2019v20H2Build) then
2022+
else if IsBuildNumber(WinServerv20H2Build) then
19682023
begin
1969-
InternalBuildNumber := Win2019v20H2Build;
2024+
InternalBuildNumber := WinServerv20H2Build;
19702025
InternalExtraUpdateInfo := 'Version 20H2';
19712026
end
19722027
else if IsBuildNumber(Win2022v21H2Build) then
@@ -2132,7 +2187,7 @@ class function TPJOSInfo.Edition: string;
21322187
osWin7, osWinSvr2008R2,
21332188
osWin8, osWinSvr2012,
21342189
osWin8Point1, osWinSvr2012R2,
2135-
osWin10, osWin11, osWin10Svr, osWinSvr2019, osWinSvr2022:
2190+
osWin10, osWin11, osWin10Svr, osWinSvr2019, osWinSvr2022, osWinServer:
21362191
begin
21372192
// For v6.0 and later we ignore the suite mask and use the new
21382193
// PRODUCT_ flags from the GetProductInfo() function to determine the
@@ -2682,8 +2737,9 @@ class function TPJOSInfo.Product: TPJOSProduct;
26822737
Result := osWin10Svr
26832738
else if InternalBuildNumber <= Win2019LastBuild then
26842739
Result := osWinSvr2019
2740+
else if InternalBuildNumber <= WinServerLastBuild then
2741+
Result := osWinServer
26852742
else
2686-
//
26872743
Result := osWinSvr2022;
26882744
end;
26892745
end;
@@ -2734,6 +2790,7 @@ class function TPJOSInfo.ProductName: string;
27342790
osWinSvr2019: Result := 'Windows Server 2019';
27352791
osWin11: Result := 'Windows 11';
27362792
osWinSvr2022: Result := 'Windows Server 2022';
2793+
osWinServer: Result := 'Windows Server';
27372794
else
27382795
raise EPJSysInfo.Create(sUnknownProduct);
27392796
end;

0 commit comments

Comments
 (0)