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-2015 , Peter Johnson (@delphidabbler).
6
+ * Copyright (C) 2001-2016 , Peter Johnson (@delphidabbler).
7
7
*
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 ) $
10
10
*
11
11
* This unit contains various static classes, constants, type definitions and
12
12
* global variables for use in providing information about the host computer and
@@ -443,8 +443,7 @@ interface
443
443
osWin8Point1, // Windows 8.1
444
444
osWinSvr2012R2, // Windows Server 2012 R2
445
445
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
448
447
);
449
448
450
449
type
@@ -582,7 +581,7 @@ TPJOSInfo = class(TObject)
582
581
// / <remarks>
583
582
// / <para>Windows has added significant OS updates that bump the build
584
583
// / 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>
586
585
// / <para>This method is used to report such updates in addition to
587
586
// / updates that declare themselves as service packs, while the ServicePack
588
587
// / method only reports declared 'official' service packs.</para>
@@ -1498,10 +1497,16 @@ procedure InitPlatformIdEx;
1498
1497
WinVistaBaseBuild = 6000 ;
1499
1498
Win7BaseBuild = 7600 ;
1500
1499
// 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
1505
1510
begin
1506
1511
// Load version query functions used externally to this routine
1507
1512
VerSetConditionMask := LoadKernelFunc(' VerSetConditionMask' );
@@ -1530,6 +1535,15 @@ procedure InitPlatformIdEx;
1530
1535
InternalMajorVersion, InternalMinorVersion,
1531
1536
Win32ServicePackMajor, Win32ServicePackMinor
1532
1537
);
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 ;
1533
1547
// NOTE: It's going to be very slow to test for all possible build numbers,
1534
1548
// so I've just narrowed the search down using the information at
1535
1549
// http://en.wikipedia.org/wiki/Windows_NT
@@ -1551,7 +1565,14 @@ procedure InitPlatformIdEx;
1551
1565
// Windows 8.1 (no known SPs)
1552
1566
if Win32ServicePackMajor = 0 then
1553
1567
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 ;
1555
1576
end ;
1556
1577
if Win32ServicePackMajor > 0 then
1557
1578
// ** Tried to read this info from registry, but for some weird
@@ -1567,18 +1588,52 @@ procedure InitPlatformIdEx;
1567
1588
begin
1568
1589
case InternalMinorVersion of
1569
1590
0 :
1591
+ if (Win32ProductType <> VER_NT_DOMAIN_CONTROLLER)
1592
+ and (Win32ProductType <> VER_NT_SERVER) then
1570
1593
begin
1571
- // TODO: Revist when server version released to check if same build
1572
- // number(s)
1573
1594
// Windows 10 TH1 branch release
1574
1595
if IsBuildNumber(Win10TH1Build) then
1575
1596
InternalBuildNumber := Win10TH1Build
1576
1597
// Windows 10 TH2 branch release
1577
1598
else if IsBuildNumber(Win10TH2Build) then
1578
1599
begin
1579
1600
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' ;
1581
1607
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
1582
1637
end ;
1583
1638
end ;
1584
1639
end ;
@@ -1591,17 +1646,10 @@ procedure InitPlatformIdEx;
1591
1646
// 10586 !
1592
1647
// So we must now consider a build number of 0 as indicating an unknown
1593
1648
// build number.
1649
+ // But note that some users report that their registry is returning
1650
+ // correct value. I really hate Windows!!!
1594
1651
// ** Seems like more registry spoofing (see above).
1595
1652
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 ;
1605
1653
end
1606
1654
else
1607
1655
begin
@@ -1702,14 +1750,14 @@ class function TPJOSInfo.Description: string;
1702
1750
// For NT3/4 append version number after product
1703
1751
AppendToResult(Format(' %d.%d' , [MajorVersion, MinorVersion]));
1704
1752
AppendToResult(Edition);
1705
- AppendToResult(ServicePack ); // does nothing if no service pack
1753
+ AppendToResult(ServicePackEx ); // does nothing if no service pack etc
1706
1754
AppendToResult(Format(' (Build %d)' , [BuildNumber]));
1707
1755
end
1708
1756
else
1709
1757
begin
1710
1758
// Windows 2000 and later: don't include version number
1711
1759
AppendToResult(Edition);
1712
- AppendToResult(ServicePack ); // does nothing if no service pack
1760
+ AppendToResult(ServicePackEx ); // does nothing if no service pack
1713
1761
AppendToResult(Format(' (Build %d)' , [BuildNumber]));
1714
1762
end ;
1715
1763
end ;
@@ -2242,6 +2290,13 @@ class function TPJOSInfo.Product: TPJOSProduct;
2242
2290
Result := osWin8Point1
2243
2291
else
2244
2292
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;
2245
2300
else
2246
2301
// Higher minor version: must be an unknown later OS
2247
2302
Result := osWinLater
@@ -2305,8 +2360,7 @@ class function TPJOSInfo.ProductName: string;
2305
2360
osWin8Point1: Result := ' Windows 8.1' ;
2306
2361
osWinSvr2012R2: Result := ' Windows Server 2012 R2' ;
2307
2362
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' ;
2310
2364
else
2311
2365
raise EPJSysInfo.Create(sUnknownProduct);
2312
2366
end ;
@@ -2337,7 +2391,7 @@ class function TPJOSInfo.RegisteredOwner: string;
2337
2391
2338
2392
class function TPJOSInfo.ServicePack : string;
2339
2393
begin
2340
- // Assume to service pack
2394
+ // Assume no service pack
2341
2395
Result := ' ' ;
2342
2396
case Platform of
2343
2397
ospWin9x:
0 commit comments