11{
22 * This Source Code Form is subject to the terms of the Mozilla Public License,
33 * 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/
55 *
6- * Copyright (C) 2001-2022, Peter Johnson (@ delphidabbler).
6+ * Copyright (C) 2001-2022, Peter Johnson (https://gravatar.com/ delphidabbler).
77 *
88 * This unit contains various static classes, constants, type definitions and
99 * global variables for use in providing information about the host computer and
@@ -232,7 +232,7 @@ interface
232232 // GetProductInfo API call used with Windows Vista and later
233233 // ** Thanks to Laurent Pierre for providing these definitions.
234234 // ** Additional definitions were obtained from
235- // http ://msdn.microsoft.com/en-us/library/ms724358
235+ // https ://msdn.microsoft.com/en-us/library/ms724358
236236 PRODUCT_BUSINESS = $00000006 ;
237237 PRODUCT_BUSINESS_N = $00000010 ;
238238 PRODUCT_CLUSTER_SERVER = $00000012 ;
@@ -324,7 +324,7 @@ interface
324324 // These constants are required for use with GetSystemMetrics to detect
325325 // certain editions. GetSystemMetrics returns non-zero when passed these flags
326326 // 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
328328 SM_TABLETPC = 86 ; // Detects XP Tablet Edition
329329 SM_MEDIACENTER = 87 ; // Detects XP Media Center Edition
330330 SM_STARTER = 88 ; // Detects XP Starter Edition
@@ -806,7 +806,7 @@ TPJComputerInfo = class(TObject)
806806 // / <para>WARNING: True is also returned when running in Windows 9x
807807 // / compatibility mode on a Windows NT platform system, regardless of
808808 // / 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>
810810 // / </remarks>
811811 class function IsAdmin : Boolean;
812812
@@ -818,7 +818,7 @@ TPJComputerInfo = class(TObject)
818818 // / earlier compatibility mode on Windows Vista or later, regardless of
819819 // / whether UAC is enabled or not.</para>
820820 // / <para>Based on code on Stack Overflow, answer by norgepaul, at
821- // / http ://tinyurl.com/avlztmg</para>
821+ // / https ://tinyurl.com/avlztmg</para>
822822 // / </remarks>
823823 class function IsUACActive : Boolean;
824824
@@ -983,7 +983,7 @@ implementation
983983 // Map of product codes per GetProductInfo API to product names
984984 // ** Laurent Pierre supplied original code on which this map is based
985985 // 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
987987 cProductMap: array [1 ..87 ] of record
988988 Id: Cardinal; // product ID
989989 Name : string; // product name
@@ -1246,6 +1246,10 @@ TBuildNameMap = record
12461246 // * later revisions were Public Release builds
12471247 Win1021H2Build = 19044 ;
12481248
1249+ // Windows 10 version 22H2
1250+ // * revision 1865 was Release Preview build (KB5015878)
1251+ Win1022H2Build = 19045 ;
1252+
12491253 // Fast ring
12501254 Win10FastRing: array [0 ..21 ] of Integer = (
12511255 19536 , 19541 , 19546 , 19551 , 19555 , 19559 , 19564 , 19569 , 19577 , 19582 , 19587 ,
@@ -1270,16 +1274,22 @@ TBuildNameMap = record
12701274 Win11DevBuild = 21996 ;
12711275
12721276 // 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
12761281 Win11v21H2Build = 22000 ;
12771282
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
12821289 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 ;
12831293
12841294 // Dev channel release - different sources give different names.
12851295 // From what I can gather (and take this with a pinch of salt!):
@@ -1289,14 +1299,15 @@ TBuildNameMap = record
12891299 // * From build 22567 the release string changed from "Dev" to "22H"
12901300
12911301 // Builds with version string "Dev"
1292- Win11DevChannelDevBuilds: array [0 ..28 ] of Integer = (
1302+ Win11DevChannelDevBuilds: array [0 ..36 ] of Integer = (
12931303 // pre Win 11 release
12941304 22449 , 22454 , 22458 , 22463 , 22468 ,
12951305 // post Win 11 release, pre Win 11 22H2 beta release
12961306 22471 , 22478 , 22483 , 22489 , 22494 , 22499 , 22504 , 22509 , 22518 , 22523 , 22526 ,
12971307 22533 , 22538 , 22543 , 22557 , 22563 ,
12981308 // 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
13001311 );
13011312 // Builds with version string "22H2" in Dev channel
13021313 Win11DevChannel22H2Builds: array [0 ..2 ] of Integer = (
@@ -1813,7 +1824,7 @@ procedure InitPlatformIdEx;
18131824 Win32ProductType := 0 ;
18141825 // NOTE: It's going to be very slow to test for all possible build numbers,
18151826 // 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
18171828 case InternalMajorVersion of
18181829 6 :
18191830 begin
@@ -1884,6 +1895,13 @@ procedure InitPlatformIdEx;
18841895 InternalExtraUpdateInfo := InternalExtraUpdateInfo
18851896 + ' (preview)' ;
18861897 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
18871905 else if FindBuildNumberFrom(
18881906 Win10DevChannel, InternalBuildNumber
18891907 ) then
@@ -1924,14 +1942,20 @@ procedure InitPlatformIdEx;
19241942 194 ..MaxInt:
19251943 // Public releases of Windows 11 have build number >= 194
19261944 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 :
19281951 InternalExtraUpdateInfo := Format(
1929- ' Version 21H2 [Insider v10.0.%d.%d]' ,
1952+ ' Version 21H2 [Dev & Beta Channels v10.0.%d.%d]' ,
19301953 [InternalBuildNumber, InternalRevisionNumber]
19311954 );
1932- 184 :
1955+ 176 , 184 :
19331956 InternalExtraUpdateInfo := Format(
1934- ' Version 21H2 [Beta v10.0.%d.%d]' ,
1957+ ' Version 21H2 '
1958+ + ' [Beta & Release Preview Channels v10.0.%d.%d]' ,
19351959 [InternalBuildNumber, InternalRevisionNumber]
19361960 );
19371961 else
@@ -1943,21 +1967,40 @@ procedure InitPlatformIdEx;
19431967 end
19441968 else if IsBuildNumber(Win11v22H2Build) then
19451969 begin
1970+ // See comments with declarations of Win11v22H2Build and
1971+ // Win11v22H2BuildAlt for details of naming of revisions.
19461972 InternalBuildNumber := Win11v22H2Build;
1947- // See comments with declaration of Win11v22H2Build for details
1948- // of naming of revisions
19491973 case InternalRevisionNumber of
19501974 1 :
19511975 InternalExtraUpdateInfo := Format(
19521976 ' Version 22H2 [Beta & Release Preview v10.0.%d.%d]' ,
19531977 [InternalBuildNumber, InternalRevisionNumber]
19541978 );
1955- 105 , 169 :
1979+ 105 , 169 , 232 , 317 , 382 , 457 :
19561980 InternalExtraUpdateInfo := Format(
19571981 ' Version 22H2 [Release Preview v10.0.%d.%d]' ,
19581982 [InternalBuildNumber, InternalRevisionNumber]
19591983 );
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 :
19612004 InternalExtraUpdateInfo := Format(
19622005 ' Version 22H2 [Beta v10.0.%d.%d]' ,
19632006 [InternalBuildNumber, InternalRevisionNumber]
@@ -2196,8 +2239,8 @@ class function TPJOSInfo.Edition: string;
21962239 osWinSvr2003, osWinSvr2003R2:
21972240 begin
21982241 // 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
22012244 if InternalProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64 then
22022245 begin
22032246 if CheckSuite(VER_SUITE_DATACENTER) then
@@ -2688,9 +2731,9 @@ class function TPJOSInfo.Product: TPJOSProduct;
26882731 3 :
26892732 // NOTE: Version 6.3 may only be reported by Windows if the
26902733 // 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).
26942737 if not IsServer then
26952738 Result := osWin8Point1
26962739 else
@@ -2699,7 +2742,7 @@ class function TPJOSInfo.Product: TPJOSProduct;
26992742 // Version 6.4 was used for Windows 2016 server tech preview 1.
27002743 // This version *may* only be detected by Windows if the
27012744 // application is "manifested" for the correct Windows version.
2702- // See http ://bit.ly/MJSO8Q.
2745+ // See https ://bit.ly/MJSO8Q.
27032746 if IsServer then
27042747 Result := osWin10Svr;
27052748 else
@@ -2711,7 +2754,7 @@ class function TPJOSInfo.Product: TPJOSProduct;
27112754 begin
27122755 // NOTE: Version 10 and later may only be reported by Windows if the
27132756 // 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
27152758 // VerifyVersionInfo instead of GetVersion or GetVersionEx worked
27162759 // round this, but MS deprecated this in Windows 10, reverting
27172760 // VerifyVersionInfo to work like GetVersion. WHY????!!!!
@@ -3001,8 +3044,7 @@ class function TPJComputerInfo.IsUACActive: Boolean;
30013044
30023045class function TPJComputerInfo.MACAddress : string;
30033046type
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.
30063048 // According to MSDN this method should fail on Windows 6.0 (Vista) and later.
30073049 // It has been known to fail on Vista, but works on Vista Home Premium SP1!
30083050 // It would seem that the call will succeed if there's an active network with
@@ -3252,4 +3294,3 @@ initialization
32523294InitPlatformIdEx;
32533295
32543296end .
3255-
0 commit comments