Skip to content

Commit da3e432

Browse files
author
DelphiDabbler
committed
Updated DelphiDabbler System Information Unit to latest 5.3.0 version.
This adds support for Windows 10 Anniversary Update (version 1607) and tech previews of Windows 2016 Server.
1 parent 5d2524b commit da3e432

File tree

1 file changed

+82
-28
lines changed

1 file changed

+82
-28
lines changed

Src/3rdParty/PJSysInfo.pas

Lines changed: 82 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
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-2015, Peter Johnson (@delphidabbler).
6+
* Copyright (C) 2001-2016, Peter Johnson (@delphidabbler).
77
*
8-
* $Rev: 2002 $
9-
* $Date: 2015-11-30 14:45:35 +0000 (Mon, 30 Nov 2015) $
8+
* $Rev: 2015 $
9+
* $Date: 2016-09-12 00:47:45 +0100 (Mon, 12 Sep 2016) $
1010
*
1111
* This unit contains various static classes, constants, type definitions and
1212
* global variables for use in providing information about the host computer and
@@ -443,8 +443,7 @@ interface
443443
osWin8Point1, // Windows 8.1
444444
osWinSvr2012R2, // Windows Server 2012 R2
445445
osWin10, // Windows 10
446-
// TODO: Update following comment to correct name once released
447-
osWin10Svr // Windows 10 Server Technical Preview
446+
osWin10Svr // Windows 2016 Server
448447
);
449448

450449
type
@@ -582,7 +581,7 @@ TPJOSInfo = class(TObject)
582581
/// <remarks>
583582
/// <para>Windows has added significant OS updates that bump the build
584583
/// number but do not declare themselves as service packs: e.g. the Windows
585-
/// 10 TH2 update.</para>
584+
/// 10 TH2 update, aka Version 1511.</para>
586585
/// <para>This method is used to report such updates in addition to
587586
/// updates that declare themselves as service packs, while the ServicePack
588587
/// method only reports declared 'official' service packs.</para>
@@ -1498,10 +1497,16 @@ procedure InitPlatformIdEx;
14981497
WinVistaBaseBuild = 6000;
14991498
Win7BaseBuild = 7600;
15001499
// for Win 8 onwards we just use the build numbers as is
1501-
Win8Build = 9200;
1502-
Win8Point1Build = 9600;
1503-
Win10TH1Build = 10240;
1504-
Win10TH2Build = 10586;
1500+
Win8Build = 9200; // Only build number used for Win 8 / Svr 2012
1501+
Win8Point1Build = 9600; // Only build number used for Win 8.1 / Svr 2012 R2
1502+
Win10TH1Build = 10240; // Initial Windows 10 release (not Server 2016)
1503+
Win10TH2Build = 10586; // Windows 10 TH2 (shared with Win 2016 TP4 - below)
1504+
Win10RS1Build = 14393; // Windows 10 RS1
1505+
Win2016TP1Build = 9841; // Windows 2016 Server Technical Preview 1
1506+
Win2016TP2Build = 10074; // Windows 2016 Server Technical Preview 2
1507+
Win2016TP3Build = 10514; // Windows 2016 Server Technical Preview 3
1508+
Win2016TP4Build = 10586; // Windows 2016 Server Technical Preview 4
1509+
Win2016TP5Build = 14300; // Windows 2016 Server Technical Preview 5
15051510
begin
15061511
// Load version query functions used externally to this routine
15071512
VerSetConditionMask := LoadKernelFunc('VerSetConditionMask');
@@ -1530,6 +1535,15 @@ procedure InitPlatformIdEx;
15301535
InternalMajorVersion, InternalMinorVersion,
15311536
Win32ServicePackMajor, Win32ServicePackMinor
15321537
);
1538+
// Test possible product types to see which one we have
1539+
if IsWindowsProductType(VER_NT_WORKSTATION) then
1540+
Win32ProductType := VER_NT_WORKSTATION
1541+
else if IsWindowsProductType(VER_NT_DOMAIN_CONTROLLER) then
1542+
Win32ProductType := VER_NT_DOMAIN_CONTROLLER
1543+
else if IsWindowsProductType(VER_NT_SERVER) then
1544+
Win32ProductType := VER_NT_SERVER
1545+
else
1546+
Win32ProductType := 0;
15331547
// NOTE: It's going to be very slow to test for all possible build numbers,
15341548
// so I've just narrowed the search down using the information at
15351549
// http://en.wikipedia.org/wiki/Windows_NT
@@ -1551,7 +1565,14 @@ procedure InitPlatformIdEx;
15511565
// Windows 8.1 (no known SPs)
15521566
if Win32ServicePackMajor = 0 then
15531567
InternalBuildNumber := Win8Point1Build;
1554-
1568+
4:
1569+
if (Win32ProductType = VER_NT_DOMAIN_CONTROLLER)
1570+
or (Win32ProductType = VER_NT_SERVER) then
1571+
begin
1572+
// Windows 2016 Server tech preview 1
1573+
InternalBuildNumber := Win2016TP1Build;
1574+
InternalExtraUpdateInfo := 'Technical Preview 6';
1575+
end;
15551576
end;
15561577
if Win32ServicePackMajor > 0 then
15571578
// ** Tried to read this info from registry, but for some weird
@@ -1567,18 +1588,52 @@ procedure InitPlatformIdEx;
15671588
begin
15681589
case InternalMinorVersion of
15691590
0:
1591+
if (Win32ProductType <> VER_NT_DOMAIN_CONTROLLER)
1592+
and (Win32ProductType <> VER_NT_SERVER) then
15701593
begin
1571-
// TODO: Revist when server version released to check if same build
1572-
// number(s)
15731594
// Windows 10 TH1 branch release
15741595
if IsBuildNumber(Win10TH1Build) then
15751596
InternalBuildNumber := Win10TH1Build
15761597
// Windows 10 TH2 branch release
15771598
else if IsBuildNumber(Win10TH2Build) then
15781599
begin
15791600
InternalBuildNumber := Win10TH2Build;
1580-
InternalExtraUpdateInfo := 'TH2: November Update';
1601+
InternalExtraUpdateInfo := 'Version 1511';
1602+
end
1603+
else if IsBuildNumber(Win10RS1Build) then
1604+
begin
1605+
InternalBuildNumber := Win10RS1Build;
1606+
InternalExtraUpdateInfo := 'Version 1607';
15811607
end;
1608+
end
1609+
else
1610+
begin
1611+
{ TODO: Revisit when Windows 2016 Server is released to add its
1612+
build number }
1613+
// Check for Technical previews. We don't check for TP1 here because
1614+
// that reported version 6.4, not version 10!
1615+
// Source of these build numbers:
1616+
// https://en.wikipedia.org/wiki/Windows_Server_2016#Version_history
1617+
if IsBuildNumber(Win2016TP2Build) then
1618+
begin
1619+
InternalBuildNumber := Win2016TP2Build;
1620+
InternalExtraUpdateInfo := 'Technical Preview 2';
1621+
end
1622+
else if IsBuildNumber(Win2016TP3Build) then
1623+
begin
1624+
InternalBuildNumber := Win2016TP3Build;
1625+
InternalExtraUpdateInfo := 'Technical Preview 3';
1626+
end
1627+
else if IsBuildNumber(Win2016TP4Build) then
1628+
begin
1629+
InternalBuildNumber := Win2016TP4Build;
1630+
InternalExtraUpdateInfo := 'Technical Preview 4';
1631+
end
1632+
else if IsBuildNumber(Win2016TP5Build) then
1633+
begin
1634+
InternalBuildNumber := Win2016TP5Build;
1635+
InternalExtraUpdateInfo := 'Technical Preview 5';
1636+
end
15821637
end;
15831638
end;
15841639
end;
@@ -1591,17 +1646,10 @@ procedure InitPlatformIdEx;
15911646
// 10586 !
15921647
// So we must now consider a build number of 0 as indicating an unknown
15931648
// build number.
1649+
// But note that some users report that their registry is returning
1650+
// correct value. I really hate Windows!!!
15941651
// ** Seems like more registry spoofing (see above).
15951652

1596-
// Test possible product types to see which one we have
1597-
if IsWindowsProductType(VER_NT_WORKSTATION) then
1598-
Win32ProductType := VER_NT_WORKSTATION
1599-
else if IsWindowsProductType(VER_NT_DOMAIN_CONTROLLER) then
1600-
Win32ProductType := VER_NT_DOMAIN_CONTROLLER
1601-
else if IsWindowsProductType(VER_NT_SERVER) then
1602-
Win32ProductType := VER_NT_SERVER
1603-
else
1604-
Win32ProductType := 0;
16051653
end
16061654
else
16071655
begin
@@ -1702,14 +1750,14 @@ class function TPJOSInfo.Description: string;
17021750
// For NT3/4 append version number after product
17031751
AppendToResult(Format('%d.%d', [MajorVersion, MinorVersion]));
17041752
AppendToResult(Edition);
1705-
AppendToResult(ServicePack); // does nothing if no service pack
1753+
AppendToResult(ServicePackEx); // does nothing if no service pack etc
17061754
AppendToResult(Format('(Build %d)', [BuildNumber]));
17071755
end
17081756
else
17091757
begin
17101758
// Windows 2000 and later: don't include version number
17111759
AppendToResult(Edition);
1712-
AppendToResult(ServicePack); // does nothing if no service pack
1760+
AppendToResult(ServicePackEx); // does nothing if no service pack
17131761
AppendToResult(Format('(Build %d)', [BuildNumber]));
17141762
end;
17151763
end;
@@ -2242,6 +2290,13 @@ class function TPJOSInfo.Product: TPJOSProduct;
22422290
Result := osWin8Point1
22432291
else
22442292
Result := osWinSvr2012R2;
2293+
4:
2294+
// Version 6.4 was used for Windows 2016 server tech preview 1.
2295+
// This version *may* only be detected by Windows if the
2296+
// application is "manifested" for the correct Windows version.
2297+
// See http://bit.ly/MJSO8Q.
2298+
if IsServer then
2299+
Result := osWin10Svr;
22452300
else
22462301
// Higher minor version: must be an unknown later OS
22472302
Result := osWinLater
@@ -2305,8 +2360,7 @@ class function TPJOSInfo.ProductName: string;
23052360
osWin8Point1: Result := 'Windows 8.1';
23062361
osWinSvr2012R2: Result := 'Windows Server 2012 R2';
23072362
osWin10: Result := 'Windows 10';
2308-
// TODO: Update osWin10Svr description once OS is released and named
2309-
osWin10Svr: Result := 'Windows Server Technical Preview';
2363+
osWin10Svr: Result := 'Windows Server 2016';
23102364
else
23112365
raise EPJSysInfo.Create(sUnknownProduct);
23122366
end;
@@ -2337,7 +2391,7 @@ class function TPJOSInfo.RegisteredOwner: string;
23372391

23382392
class function TPJOSInfo.ServicePack: string;
23392393
begin
2340-
// Assume to service pack
2394+
// Assume no service pack
23412395
Result := '';
23422396
case Platform of
23432397
ospWin9x:

0 commit comments

Comments
 (0)