3
3
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
4
* obtain one at http://mozilla.org/MPL/2.0/
5
5
*
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).
10
7
*
11
8
* This unit contains various static classes, constants, type definitions and
12
9
* global variables for use in providing information about the host computer and
@@ -419,7 +416,8 @@ interface
419
416
osWin10Svr, // Windows 2016 Server
420
417
osWinSvr2019, // Windows 2019 Server
421
418
osWin11, // Windows 11
422
- osWinSvr2022 // Windows 2022 Server
419
+ osWinSvr2022, // Windows 2022 Server
420
+ osWinServer // Windows Server (between Server 2019 & 2022)
423
421
);
424
422
425
423
type
@@ -1209,6 +1207,7 @@ implementation
1209
1207
Win8Point1Build = 9600 ; // Build number used for all Win 8.1/Svr 2012 R2
1210
1208
1211
1209
// Windows 10 ----------------------------------------------------------------
1210
+
1212
1211
Win10TH1Build = 10240 ; // Windows 10 TH1 - version 1507 (1st release)
1213
1212
Win10TH2Build = 10586 ; // Windows 10 TH2 - version 1511
1214
1213
Win10RS1Build = 14393 ; // Windows 10 RS1 - version 1607
@@ -1221,9 +1220,28 @@ implementation
1221
1220
Win1020H1Build = 19041 ; // Windows 10 20H1 - version 2004
1222
1221
Win1020H2Build = 19042 ; // Windows 10 20H2 - version 20H2
1223
1222
Win1021H1Build = 19043 ; // Windows 10 21H1 - version 21H1
1223
+ // revisions 844..964 were beta
1224
1224
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
+ );
1225
1242
1226
1243
// Windows 11 ----------------------------------------------------------------
1244
+
1227
1245
// NOTE: Preview and beta & release versions of Windows 11 report version 10.0
1228
1246
Win11DevBuild = 21996 ; // Windows 11 version Dev
1229
1247
// - 10.0.21996.1 (Insider version)
@@ -1237,28 +1255,28 @@ implementation
1237
1255
// Revision # 194
1238
1256
// Windows 11 version 21H2
1239
1257
// - ** 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
+ );
1262
1280
1263
1281
Win11FirstBuild = Win11DevBuild; // First build number of Windows 11
1264
1282
@@ -1275,23 +1293,23 @@ implementation
1275
1293
// After this it's Win 2019 Server
1276
1294
1277
1295
// 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
1288
1301
Win2019v1809Build = 17763 ; // Win Server 2019 version 1809
1289
1302
Win2019v1903Build = 18362 ; // Win Server 2019 version 1903
1290
1303
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
1295
1313
1296
1314
// Windows 2022 Server -------------------------------------------------------
1297
1315
Win2022v21H2Build = 20348 ; // Win Server 2022 version 21H2
@@ -1510,6 +1528,14 @@ function ExcludeTrailingPathDelimiter(const DirOrPath: string) : string;
1510
1528
end ;
1511
1529
{ $ENDIF}
1512
1530
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
+
1513
1539
// Returns the value of the given environment variable.
1514
1540
function GetEnvVar (const VarName: string): string;
1515
1541
var
@@ -1823,15 +1849,38 @@ procedure InitPlatformIdEx;
1823
1849
begin
1824
1850
InternalBuildNumber := Win1021H1Build;
1825
1851
InternalExtraUpdateInfo := ' Version 21H1' ;
1852
+ if IsInRange(InternalRevisionNumber, 844 , 964 ) then
1853
+ InternalExtraUpdateInfo := InternalExtraUpdateInfo + ' (beta)' ;
1826
1854
end
1827
1855
else if IsBuildNumber(Win1021H2Build) then
1828
1856
begin
1829
1857
// From 21H2 Windows 10 moves from a 6 monthly update cycle to a
1830
1858
// yearly cycle
1831
1859
InternalBuildNumber := Win1021H2Build;
1832
1860
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
+ );
1833
1874
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
1835
1884
// Details taken from: https://tinyurl.com/usupsz4a
1836
1885
// Correct according to above web page as of 2021-09-11
1837
1886
else if IsBuildNumber(Win11DevBuild) then
@@ -1872,19 +1921,32 @@ procedure InitPlatformIdEx;
1872
1921
end ;
1873
1922
end
1874
1923
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
1884
1945
) then
1885
1946
begin
1947
+ // Win 11 Dev & Beta channel builds with verison string "22H2"
1886
1948
InternalExtraUpdateInfo := Format(
1887
- ' Version 21H2 [RSPRERELEASE v10.0.%d.%d] ' ,
1949
+ ' Dev & Beta Channels v10.0.%d.%d (22H2) ' ,
1888
1950
[InternalBuildNumber, InternalRevisionNumber]
1889
1951
);
1890
1952
end
@@ -1930,14 +1992,7 @@ procedure InitPlatformIdEx;
1930
1992
InternalExtraUpdateInfo := ' Version 1803' ;
1931
1993
end
1932
1994
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
1941
1996
) then
1942
1997
begin
1943
1998
InternalExtraUpdateInfo := Format(
@@ -1959,14 +2014,14 @@ procedure InitPlatformIdEx;
1959
2014
InternalBuildNumber := Win2019v1909Build;
1960
2015
InternalExtraUpdateInfo := ' Version 1909' ;
1961
2016
end
1962
- else if IsBuildNumber(Win2019v2004Build ) then
2017
+ else if IsBuildNumber(WinServerv2004Build ) then
1963
2018
begin
1964
- InternalBuildNumber := Win2019v2004Build ;
2019
+ InternalBuildNumber := WinServerv2004Build ;
1965
2020
InternalExtraUpdateInfo := ' Version 2004' ;
1966
2021
end
1967
- else if IsBuildNumber(Win2019v20H2Build ) then
2022
+ else if IsBuildNumber(WinServerv20H2Build ) then
1968
2023
begin
1969
- InternalBuildNumber := Win2019v20H2Build ;
2024
+ InternalBuildNumber := WinServerv20H2Build ;
1970
2025
InternalExtraUpdateInfo := ' Version 20H2' ;
1971
2026
end
1972
2027
else if IsBuildNumber(Win2022v21H2Build) then
@@ -2132,7 +2187,7 @@ class function TPJOSInfo.Edition: string;
2132
2187
osWin7, osWinSvr2008R2,
2133
2188
osWin8, osWinSvr2012,
2134
2189
osWin8Point1, osWinSvr2012R2,
2135
- osWin10, osWin11, osWin10Svr, osWinSvr2019, osWinSvr2022:
2190
+ osWin10, osWin11, osWin10Svr, osWinSvr2019, osWinSvr2022, osWinServer :
2136
2191
begin
2137
2192
// For v6.0 and later we ignore the suite mask and use the new
2138
2193
// PRODUCT_ flags from the GetProductInfo() function to determine the
@@ -2682,8 +2737,9 @@ class function TPJOSInfo.Product: TPJOSProduct;
2682
2737
Result := osWin10Svr
2683
2738
else if InternalBuildNumber <= Win2019LastBuild then
2684
2739
Result := osWinSvr2019
2740
+ else if InternalBuildNumber <= WinServerLastBuild then
2741
+ Result := osWinServer
2685
2742
else
2686
- //
2687
2743
Result := osWinSvr2022;
2688
2744
end ;
2689
2745
end ;
@@ -2734,6 +2790,7 @@ class function TPJOSInfo.ProductName: string;
2734
2790
osWinSvr2019: Result := ' Windows Server 2019' ;
2735
2791
osWin11: Result := ' Windows 11' ;
2736
2792
osWinSvr2022: Result := ' Windows Server 2022' ;
2793
+ osWinServer: Result := ' Windows Server' ;
2737
2794
else
2738
2795
raise EPJSysInfo.Create(sUnknownProduct);
2739
2796
end ;
0 commit comments