1
1
{
2
2
* This Source Code Form is subject to the terms of the Mozilla Public License,
3
3
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
- * obtain one at http ://mozilla.org/MPL/2.0/
4
+ * obtain one at https ://mozilla.org/MPL/2.0/
5
5
*
6
- * Copyright (C) 2001-2022, Peter Johnson (@ delphidabbler).
6
+ * Copyright (C) 2001-2022, Peter Johnson (https://gravatar.com/ delphidabbler).
7
7
*
8
8
* This unit contains various static classes, constants, type definitions and
9
9
* global variables for use in providing information about the host computer and
@@ -232,7 +232,7 @@ interface
232
232
// GetProductInfo API call used with Windows Vista and later
233
233
// ** Thanks to Laurent Pierre for providing these definitions.
234
234
// ** Additional definitions were obtained from
235
- // http ://msdn.microsoft.com/en-us/library/ms724358
235
+ // https ://msdn.microsoft.com/en-us/library/ms724358
236
236
PRODUCT_BUSINESS = $00000006 ;
237
237
PRODUCT_BUSINESS_N = $00000010 ;
238
238
PRODUCT_CLUSTER_SERVER = $00000012 ;
@@ -324,7 +324,7 @@ interface
324
324
// These constants are required for use with GetSystemMetrics to detect
325
325
// certain editions. GetSystemMetrics returns non-zero when passed these flags
326
326
// if the associated edition is present.
327
- // Obtained from http ://msdn.microsoft.com/en-us/library/ms724385
327
+ // Obtained from https ://msdn.microsoft.com/en-us/library/ms724385
328
328
SM_TABLETPC = 86 ; // Detects XP Tablet Edition
329
329
SM_MEDIACENTER = 87 ; // Detects XP Media Center Edition
330
330
SM_STARTER = 88 ; // Detects XP Starter Edition
@@ -806,7 +806,7 @@ TPJComputerInfo = class(TObject)
806
806
// / <para>WARNING: True is also returned when running in Windows 9x
807
807
// / compatibility mode on a Windows NT platform system, regardless of
808
808
// / whether the user has admin privileges or not.</para>
809
- // / <para>Based on code at http://edn.embarcadero.com/ article/26752 </para>
809
+ // / <para>Based on a former Embarcadero article. </para>
810
810
// / </remarks>
811
811
class function IsAdmin : Boolean;
812
812
@@ -818,7 +818,7 @@ TPJComputerInfo = class(TObject)
818
818
// / earlier compatibility mode on Windows Vista or later, regardless of
819
819
// / whether UAC is enabled or not.</para>
820
820
// / <para>Based on code on Stack Overflow, answer by norgepaul, at
821
- // / http ://tinyurl.com/avlztmg</para>
821
+ // / https ://tinyurl.com/avlztmg</para>
822
822
// / </remarks>
823
823
class function IsUACActive : Boolean;
824
824
@@ -983,7 +983,7 @@ implementation
983
983
// Map of product codes per GetProductInfo API to product names
984
984
// ** Laurent Pierre supplied original code on which this map is based
985
985
// It has been modified and extended using MSDN documentation at
986
- // http ://msdn.microsoft.com/en-us/library/ms724358
986
+ // https ://msdn.microsoft.com/en-us/library/ms724358
987
987
cProductMap: array [1 ..87 ] of record
988
988
Id: Cardinal; // product ID
989
989
Name : string; // product name
@@ -1246,6 +1246,10 @@ TBuildNameMap = record
1246
1246
// * later revisions were Public Release builds
1247
1247
Win1021H2Build = 19044 ;
1248
1248
1249
+ // Windows 10 version 22H2
1250
+ // * revision 1865 was Release Preview build (KB5015878)
1251
+ Win1022H2Build = 19045 ;
1252
+
1249
1253
// Fast ring
1250
1254
Win10FastRing: array [0 ..21 ] of Integer = (
1251
1255
19536 , 19541 , 19546 , 19551 , 19555 , 19559 , 19564 , 19569 , 19577 , 19582 , 19587 ,
@@ -1270,16 +1274,22 @@ TBuildNameMap = record
1270
1274
Win11DevBuild = 21996 ;
1271
1275
1272
1276
// Windows 11 version 21H2:
1273
- // * revisions 51,65,71,100,120,132,168 were Insider builds
1274
- // * revision 184 was Beta build
1275
- // * revision 194 and later were Public Release builds
1277
+ // * Dev channel: revs 51,65,71
1278
+ // * Dev & Beta channels: revs 100,120,132,160,168
1279
+ // * Beta & Release Preview channels: revs 176,184
1280
+ // * Public Release: rev 194 and later
1276
1281
Win11v21H2Build = 22000 ;
1277
1282
1278
- // Windows 11 version 22H2:
1279
- // * revision 1 was Beta & Release Preview build
1280
- // * revisions 105 & 169 were Release Preview builds
1281
- // * revision 160 was Beta build
1283
+ // Windows 11 version 22H2
1284
+ //
1285
+ // Build 22631 was the original beta build.
1286
+ // * Beta & Release Preview channels: rev 1
1287
+ // * Beta channel: revs 160,290,436,440,450,575,586,590
1288
+ // * Release Preview channel: revs 105,169,232,317,382,457
1282
1289
Win11v22H2Build = 22621 ;
1290
+ // Build 22632 was added as an alternative Beta channel build as of rev 290:
1291
+ // * Beta channel: revs 290,436,440,450,575,586,590
1292
+ Win11v22H2BuildAlt = 22622 ;
1283
1293
1284
1294
// Dev channel release - different sources give different names.
1285
1295
// From what I can gather (and take this with a pinch of salt!):
@@ -1289,14 +1299,15 @@ TBuildNameMap = record
1289
1299
// * From build 22567 the release string changed from "Dev" to "22H"
1290
1300
1291
1301
// Builds with version string "Dev"
1292
- Win11DevChannelDevBuilds: array [0 ..28 ] of Integer = (
1302
+ Win11DevChannelDevBuilds: array [0 ..36 ] of Integer = (
1293
1303
// pre Win 11 release
1294
1304
22449 , 22454 , 22458 , 22463 , 22468 ,
1295
1305
// post Win 11 release, pre Win 11 22H2 beta release
1296
1306
22471 , 22478 , 22483 , 22489 , 22494 , 22499 , 22504 , 22509 , 22518 , 22523 , 22526 ,
1297
1307
22533 , 22538 , 22543 , 22557 , 22563 ,
1298
1308
// post Win 11 22H2 beta release
1299
- 25115 , 25120 , 25126 , 25131 , 25136 , 25140 , 25145 , 25151
1309
+ 25115 , 25120 , 25126 , 25131 , 25136 , 25140 , 25145 , 25151 , 25158 , 25163 , 25169 ,
1310
+ 25174 , 25179 , 25182 , 25188 , 25193
1300
1311
);
1301
1312
// Builds with version string "22H2" in Dev channel
1302
1313
Win11DevChannel22H2Builds: array [0 ..2 ] of Integer = (
@@ -1813,7 +1824,7 @@ procedure InitPlatformIdEx;
1813
1824
Win32ProductType := 0 ;
1814
1825
// NOTE: It's going to be very slow to test for all possible build numbers,
1815
1826
// so I've narrowed the search down using the information at
1816
- // http ://en.wikipedia.org/wiki/Windows_NT
1827
+ // https ://en.wikipedia.org/wiki/Windows_NT
1817
1828
case InternalMajorVersion of
1818
1829
6 :
1819
1830
begin
@@ -1884,6 +1895,13 @@ procedure InitPlatformIdEx;
1884
1895
InternalExtraUpdateInfo := InternalExtraUpdateInfo
1885
1896
+ ' (preview)' ;
1886
1897
end
1898
+ else if IsBuildNumber(Win1022H2Build) then
1899
+ begin
1900
+ InternalBuildNumber := Win1022H2Build;
1901
+ { TODO: As of 1 Aug 2022 all rev numbers are previews.
1902
+ Change following once this is no longer the case. }
1903
+ InternalExtraUpdateInfo := ' Version 22H2 (preview)' ;
1904
+ end
1887
1905
else if FindBuildNumberFrom(
1888
1906
Win10DevChannel, InternalBuildNumber
1889
1907
) then
@@ -1924,14 +1942,20 @@ procedure InitPlatformIdEx;
1924
1942
194 ..MaxInt:
1925
1943
// Public releases of Windows 11 have build number >= 194
1926
1944
InternalExtraUpdateInfo := ' Version 21H2' ;
1927
- 51 , 65 , 71 , 100 , 120 , 132 , 168 :
1945
+ 51 , 65 , 71 :
1946
+ InternalExtraUpdateInfo := Format(
1947
+ ' Version 21H2 [Dev Channel v10.0.%d.%d]' ,
1948
+ [InternalBuildNumber, InternalRevisionNumber]
1949
+ );
1950
+ 100 , 120 , 132 , 160 , 168 :
1928
1951
InternalExtraUpdateInfo := Format(
1929
- ' Version 21H2 [Insider v10.0.%d.%d]' ,
1952
+ ' Version 21H2 [Dev & Beta Channels v10.0.%d.%d]' ,
1930
1953
[InternalBuildNumber, InternalRevisionNumber]
1931
1954
);
1932
- 184 :
1955
+ 176 , 184 :
1933
1956
InternalExtraUpdateInfo := Format(
1934
- ' Version 21H2 [Beta v10.0.%d.%d]' ,
1957
+ ' Version 21H2 '
1958
+ + ' [Beta & Release Preview Channels v10.0.%d.%d]' ,
1935
1959
[InternalBuildNumber, InternalRevisionNumber]
1936
1960
);
1937
1961
else
@@ -1943,21 +1967,40 @@ procedure InitPlatformIdEx;
1943
1967
end
1944
1968
else if IsBuildNumber(Win11v22H2Build) then
1945
1969
begin
1970
+ // See comments with declarations of Win11v22H2Build and
1971
+ // Win11v22H2BuildAlt for details of naming of revisions.
1946
1972
InternalBuildNumber := Win11v22H2Build;
1947
- // See comments with declaration of Win11v22H2Build for details
1948
- // of naming of revisions
1949
1973
case InternalRevisionNumber of
1950
1974
1 :
1951
1975
InternalExtraUpdateInfo := Format(
1952
1976
' Version 22H2 [Beta & Release Preview v10.0.%d.%d]' ,
1953
1977
[InternalBuildNumber, InternalRevisionNumber]
1954
1978
);
1955
- 105 , 169 :
1979
+ 105 , 169 , 232 , 317 , 382 , 457 :
1956
1980
InternalExtraUpdateInfo := Format(
1957
1981
' Version 22H2 [Release Preview v10.0.%d.%d]' ,
1958
1982
[InternalBuildNumber, InternalRevisionNumber]
1959
1983
);
1960
- 160 :
1984
+ 160 , 290 , 436 , 440 , 450 , 575 , 586 , 590 :
1985
+ InternalExtraUpdateInfo := Format(
1986
+ ' Version 22H2 [Beta v10.0.%d.%d]' ,
1987
+ [InternalBuildNumber, InternalRevisionNumber]
1988
+ );
1989
+ else
1990
+ InternalExtraUpdateInfo := Format(
1991
+ ' Version 22H2 [Unknown release v10.0.%d.%d]' ,
1992
+ [InternalBuildNumber, InternalRevisionNumber]
1993
+ );
1994
+ end ;
1995
+ end
1996
+ else if IsBuildNumber(Win11v22H2BuildAlt) then
1997
+ begin
1998
+ // See comments with declarations of Win11v22H2Build and
1999
+ // Win11v22H2BuildAlt for details of naming of revisions.
2000
+ InternalBuildNumber := Win11v22H2BuildAlt;
2001
+ // Set fallback update info for unknown revisions
2002
+ case InternalRevisionNumber of
2003
+ 290 , 436 , 440 , 450 , 575 , 586 , 590 :
1961
2004
InternalExtraUpdateInfo := Format(
1962
2005
' Version 22H2 [Beta v10.0.%d.%d]' ,
1963
2006
[InternalBuildNumber, InternalRevisionNumber]
@@ -2196,8 +2239,8 @@ class function TPJOSInfo.Edition: string;
2196
2239
osWinSvr2003, osWinSvr2003R2:
2197
2240
begin
2198
2241
// We check different processor architectures and act accordingly
2199
- // This code closely based on MS's sample code found at
2200
- // http://msdn2.microsoft.com/en-us/library/ms724429
2242
+ // This code closely based on sample code by Microsoft that is no longer
2243
+ // available
2201
2244
if InternalProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64 then
2202
2245
begin
2203
2246
if CheckSuite(VER_SUITE_DATACENTER) then
@@ -2688,9 +2731,9 @@ class function TPJOSInfo.Product: TPJOSProduct;
2688
2731
3 :
2689
2732
// NOTE: Version 6.3 may only be reported by Windows if the
2690
2733
// application is "manifested" for Windows 8.1. See
2691
- // http ://bit.ly/MJSO8Q . Getting the OS via VerifyVersionInfo
2692
- // instead of GetVersion or GetVersionEx should work round this
2693
- // for Windows 8.1 (i.e. version 6.3).
2734
+ // https ://tinyurl.com/2s384ha4 . Getting the OS via
2735
+ // VerifyVersionInfo instead of GetVersion or GetVersionEx should
2736
+ // work round this for Windows 8.1 (i.e. version 6.3).
2694
2737
if not IsServer then
2695
2738
Result := osWin8Point1
2696
2739
else
@@ -2699,7 +2742,7 @@ class function TPJOSInfo.Product: TPJOSProduct;
2699
2742
// Version 6.4 was used for Windows 2016 server tech preview 1.
2700
2743
// This version *may* only be detected by Windows if the
2701
2744
// application is "manifested" for the correct Windows version.
2702
- // See http ://bit.ly/MJSO8Q.
2745
+ // See https ://bit.ly/MJSO8Q.
2703
2746
if IsServer then
2704
2747
Result := osWin10Svr;
2705
2748
else
@@ -2711,7 +2754,7 @@ class function TPJOSInfo.Product: TPJOSProduct;
2711
2754
begin
2712
2755
// NOTE: Version 10 and later may only be reported by Windows if the
2713
2756
// application is "manifested" for the correct Windows version. See
2714
- // http ://bit.ly/MJSO8Q. Previously, getting the OS from
2757
+ // https ://bit.ly/MJSO8Q. Previously, getting the OS from
2715
2758
// VerifyVersionInfo instead of GetVersion or GetVersionEx worked
2716
2759
// round this, but MS deprecated this in Windows 10, reverting
2717
2760
// VerifyVersionInfo to work like GetVersion. WHY????!!!!
@@ -3001,8 +3044,7 @@ class function TPJComputerInfo.IsUACActive: Boolean;
3001
3044
3002
3045
class function TPJComputerInfo.MACAddress : string;
3003
3046
type
3004
- // Based on code at MSDN knowledge base Q118623 article at
3005
- // http://support.microsoft.com/kb/q118623/}
3047
+ // Based on former MSDN knowledge base article Q118623.
3006
3048
// According to MSDN this method should fail on Windows 6.0 (Vista) and later.
3007
3049
// It has been known to fail on Vista, but works on Vista Home Premium SP1!
3008
3050
// It would seem that the call will succeed if there's an active network with
@@ -3252,4 +3294,3 @@ initialization
3252
3294
InitPlatformIdEx;
3253
3295
3254
3296
end .
3255
-
0 commit comments