Skip to content

Commit

Permalink
SQLOLEDB TLS 1.2 support reporting fixes
Browse files Browse the repository at this point in the history
Changed the logic to use WindowsDisplayVersion rather than ReleaseID, which diverge in Windows 11 and 2022.
Added more server versions.
Added a catch-all for Windows versions 11 and 2022 and later as a default option for non-enumerated versions.
  • Loading branch information
Malcolm-Stewart committed Sep 26, 2024
1 parent f6e6848 commit c146812
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Binary file modified SQLCheck/.vs/SQLCheck/v15/Server/sqlite3/storage.ide
Binary file not shown.
5 changes: 4 additions & 1 deletion SQLCheck/SQLCheck/Collectors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public static void CollectComputer(DataSet ds)
DisplayVersion = Utility.RegistryTryGetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DisplayVersion", "");
Computer["WindowsReleaseID"] = releaseID;
if (DisplayVersion == "") DisplayVersion = releaseID; // Windows 2022 uses DisplayVersion, Windows 2019 and earlier do not have this, use ReleaseID instead
Computer["WindowsDisplayVersion"] = DisplayVersion;
ubr = Utility.RegistryTryGetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR", 0); // UBR = Update Build Revision
Computer["WindowsUBR"] = ubr.ToString();

Expand Down Expand Up @@ -1460,6 +1461,7 @@ public static void CollectDatabaseDriver(DataSet ds)
FileVersionInfo versionInfo = null;
string windowsVersion = Computer.GetString("WindowsVersion");
string windowsReleaseID = Computer.GetString("WindowsReleaseID");
string windowsDisplayVersion = Computer.GetString("WindowsDisplayVersion"); // use instead of ReleaseID for GetDriverInfo call
string badPath = "";

foreach (DataRow Provider in OLEDBProviders.Rows)
Expand Down Expand Up @@ -1500,7 +1502,8 @@ public static void CollectDatabaseDriver(DataSet ds)
versionInfo = null;
DatabaseDriver["Message"] = badPath + "File not found";
}
info = DriverInfo.GetDriverInfo(Provider["ProgID"].ToString(), versionInfo, windowsVersion, windowsReleaseID);
// info = DriverInfo.GetDriverInfo(Provider["ProgID"].ToString(), versionInfo, windowsVersion, windowsReleaseID); // okay for Win 2019 and prior, need display version for 2022 and later
info = DriverInfo.GetDriverInfo(Provider["ProgID"].ToString(), versionInfo, windowsVersion, windowsDisplayVersion);
DatabaseDriver["Version"] = versionInfo == null ? "Unknown" : versionInfo.ProductVersion;
DatabaseDriver["TLS12"] = info == null ? "" : info.MinTLS12Version;
DatabaseDriver["TLS13"] = info == null ? "" : info.MinTLS13Version;
Expand Down
15 changes: 10 additions & 5 deletions SQLCheck/SQLCheck/DriverInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public DriverInfo(string driverName, string driverType, string minTLS12Version,
MultiSubnetFailover = multiSubnetFailover;
}

public static DriverInfo GetDriverInfo(string driverName, FileVersionInfo versionInfo, string WindowsVersion, string WindowsReleaseID) // TODO - fix up MinTLSVersion and Server Support
public static DriverInfo GetDriverInfo(string driverName, FileVersionInfo versionInfo, string WindowsVersion, string WindowsDisplayVersion) // TODO - fix up MinTLSVersion and Server Support
{
string TLS12 = "No";
string TLS13 = "No";
Expand All @@ -60,7 +60,8 @@ public static DriverInfo GetDriverInfo(string driverName, FileVersionInfo versio
{
case "SQLOLEDB":
case "SQL Server":
switch (WindowsReleaseID.ToUpper())
// switch (WindowsReleaseID.ToUpper()) // okay for pre-Win 11 or Win 2022
switch (WindowsDisplayVersion.ToUpper())
{
case "": // Windows 8.1/2012 R2 and earlier - Won't fix these versions: Windows 2003, XP, 2008, 2008 R2, 2012
// Windows 8.1 and Windows 2012 R2 = version 6.3.9600 - what build supports the updated DBNETLIB.DLL???
Expand Down Expand Up @@ -104,11 +105,15 @@ public static DriverInfo GetDriverInfo(string driverName, FileVersionInfo versio
if (Utility.CompareVersion(WindowsVersion, "10.0.19042") == "=" && Utility.CompareVersion(WindowsVersion, "10.0.19042.609") == ">") TLS12 = "Yes";
break;
case "21H1": // Windows 10/2019 21H1 ???? build 19043 ????
case "IRON": // more at https://microsoft.visualstudio.com/OS/_workitems/edit/27324781
case "21H2":
case "22H2":
case "23H2":
case "24H2":
TLS12 = "Yes";
break;
case "IRON": // Windows 10/2019 Iron ???? build 20207???? ???? April 16, 2021????
// more at https://microsoft.visualstudio.com/OS/_workitems/edit/27324781
TLS12 = "Yes";
default: // all versions of Winodws 11 or 2022 or greater support TLS 1.2
if (Utility.CompareVersion(WindowsVersion, "10.0.19999") == ">") TLS12 = "Yes";
break;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions SQLCheck/SQLCheck/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1422.0")]
[assembly: AssemblyFileVersion("1.0.1422.0")]
[assembly: AssemblyVersion("1.0.1435.0")]
[assembly: AssemblyFileVersion("1.0.1435.0")]
1 change: 1 addition & 0 deletions SQLCheck/SQLCheck/Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public static DataSet CreateDataSet(String ComputerName)
dt.AddColumn("MinorVersion", "String");
dt.AddColumn("WindowsBuild", "String");
dt.AddColumn("WindowsReleaseID", "String");
dt.AddColumn("WindowsDisplayVersion", "String"); // in Windows 2022, this is separate from RelaseID, for prior versions, ReleaseID is copied here
dt.AddColumn("WindowsUBR", "String");
dt.AddColumn("CLR4Version", "String");
dt.AddColumn("CLR4StrongCrypto", "String");
Expand Down

0 comments on commit c146812

Please sign in to comment.