diff --git a/DerpingDrivers/DerpingDrivers.csproj b/DerpingDrivers/DerpingDrivers.csproj index 550d149..229f3eb 100644 --- a/DerpingDrivers/DerpingDrivers.csproj +++ b/DerpingDrivers/DerpingDrivers.csproj @@ -155,6 +155,14 @@ SettingsSingleFileGenerator Settings.Designer.cs + + + + + + + + diff --git a/DerpingDrivers/MainWindow.xaml b/DerpingDrivers/MainWindow.xaml index 426e42e..1741c3d 100644 --- a/DerpingDrivers/MainWindow.xaml +++ b/DerpingDrivers/MainWindow.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:DerpingDrivers" xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" + xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf" mc:Ignorable="d" Title="Derping Drivers - Windows driver compatibility detection tool" Height="440" Width="700" @@ -15,6 +16,10 @@ BorderThickness="0" GlowBrush="{DynamicResource AccentColorBrush}" DataContext="{Binding RelativeSource={RelativeSource Self}}"> + + + + @@ -74,7 +79,7 @@ - + diff --git a/DerpingDrivers/MainWindow.xaml.cs b/DerpingDrivers/MainWindow.xaml.cs index 3760771..872995a 100644 --- a/DerpingDrivers/MainWindow.xaml.cs +++ b/DerpingDrivers/MainWindow.xaml.cs @@ -22,6 +22,15 @@ namespace DerpingDrivers public MainWindow() { InitializeComponent(); + + Loaded += OnLoaded; + } + + private void OnLoaded(object sender, RoutedEventArgs e) + { + SummaryViewer.Pipeline = new MarkdownPipelineBuilder().UseSupportedExtensions().Build(); + + SummaryViewer.Markdown = MatchingSummaryContent; } /// @@ -68,32 +77,22 @@ namespace DerpingDrivers /// public string TestSigningStatus => CodeIntegrityHelper.IsTestSignEnabled ? "Enabled" : "Disabled"; - public FlowDocument SummaryDocument + private string MatchingSummaryContent { get { - var markdown = Encoding.UTF8.GetString(Properties.Resources.testsigning); - - // Convert Markdown to XAML - var xaml = Markdown.ToXaml(markdown, BuildPipeline()); - - // Render XAML for FlowDocument Control - using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml))) + if (!CodeIntegrityHelper.IsTestSignEnabled) { - var reader = new XamlXmlReader(stream, new MyXamlSchemaContext()); - - if (XamlReader.Load(reader) is FlowDocument document) return document; + return Encoding.UTF8.GetString(Properties.Resources.testsigning); } - return null; - } - } + if (OsVersionInfo.IsWindows10) + { - private static MarkdownPipeline BuildPipeline() - { - return new MarkdownPipelineBuilder() - .UseSupportedExtensions() - .Build(); + } + + return "*None available*"; + } } private void Web_OnClick(object sender, RoutedEventArgs e) @@ -110,20 +109,10 @@ namespace DerpingDrivers { Process.Start("https://forums.vigem.org"); } - } - internal class MyXamlSchemaContext : XamlSchemaContext - { - public override bool TryGetCompatibleXamlNamespace(string xamlNamespace, out string compatibleNamespace) + private void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { - if (xamlNamespace.Equals("clr-namespace:Markdig.Wpf")) - { - compatibleNamespace = - $"clr-namespace:Markdig.Wpf;assembly={Assembly.GetAssembly(typeof(Styles)).FullName}"; - return true; - } - - return base.TryGetCompatibleXamlNamespace(xamlNamespace, out compatibleNamespace); + Process.Start(e.Parameter.ToString()); } } } \ No newline at end of file diff --git a/DerpingDrivers/Properties/Resources.Designer.cs b/DerpingDrivers/Properties/Resources.Designer.cs index d00fba3..10ee6f7 100644 --- a/DerpingDrivers/Properties/Resources.Designer.cs +++ b/DerpingDrivers/Properties/Resources.Designer.cs @@ -69,5 +69,85 @@ namespace DerpingDrivers.Properties { return ((byte[])(obj)); } } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x64_uefi_clean { + get { + object obj = ResourceManager.GetObject("win10_x64_uefi_clean", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x64_uefi_secure_clean { + get { + object obj = ResourceManager.GetObject("win10_x64_uefi_secure_clean", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x64_uefi_secure_upgraded { + get { + object obj = ResourceManager.GetObject("win10_x64_uefi_secure_upgraded", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x64_uefi_upgraded { + get { + object obj = ResourceManager.GetObject("win10_x64_uefi_upgraded", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x86_uefi_clean { + get { + object obj = ResourceManager.GetObject("win10_x86_uefi_clean", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x86_uefi_secure_clean { + get { + object obj = ResourceManager.GetObject("win10_x86_uefi_secure_clean", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x86_uefi_secure_upgraded { + get { + object obj = ResourceManager.GetObject("win10_x86_uefi_secure_upgraded", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] win10_x86_uefi_upgraded { + get { + object obj = ResourceManager.GetObject("win10_x86_uefi_upgraded", resourceCulture); + return ((byte[])(obj)); + } + } } } diff --git a/DerpingDrivers/Properties/Resources.resx b/DerpingDrivers/Properties/Resources.resx index 2f9f8a4..5bced40 100644 --- a/DerpingDrivers/Properties/Resources.resx +++ b/DerpingDrivers/Properties/Resources.resx @@ -121,4 +121,28 @@ ..\Resources\testsigning.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\win10_x64_uefi_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x64_uefi_secure_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x64_uefi_secure_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x64_uefi_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x86_uefi_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x86_uefi_secure_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x86_uefi_secure_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\win10_x86_uefi_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/DerpingDrivers/Resources/testsigning.md b/DerpingDrivers/Resources/testsigning.md index 5404861..e89ea82 100644 --- a/DerpingDrivers/Resources/testsigning.md +++ b/DerpingDrivers/Resources/testsigning.md @@ -1,5 +1,7 @@ -# Hello +# ☠️ TESTSIGNING enabled ☠️ -## Second +To disable test-signing, execute the following command in an [elevated prompt](https://www.thewindowsclub.com/how-to-run-command-prompt-as-an-administrator): -🎃 Waddup! \ No newline at end of file +```cmd +bcdedit.exe -set TESTSIGNING OFF +``` \ No newline at end of file diff --git a/DerpingDrivers/Resources/win10_x64_uefi_clean.md b/DerpingDrivers/Resources/win10_x64_uefi_clean.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x64_uefi_secure_clean.md b/DerpingDrivers/Resources/win10_x64_uefi_secure_clean.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x64_uefi_secure_upgraded.md b/DerpingDrivers/Resources/win10_x64_uefi_secure_upgraded.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x64_uefi_upgraded.md b/DerpingDrivers/Resources/win10_x64_uefi_upgraded.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x86_uefi_clean.md b/DerpingDrivers/Resources/win10_x86_uefi_clean.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x86_uefi_secure_clean.md b/DerpingDrivers/Resources/win10_x86_uefi_secure_clean.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x86_uefi_secure_upgraded.md b/DerpingDrivers/Resources/win10_x86_uefi_secure_upgraded.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Resources/win10_x86_uefi_upgraded.md b/DerpingDrivers/Resources/win10_x86_uefi_upgraded.md new file mode 100644 index 0000000..e69de29 diff --git a/DerpingDrivers/Util/OSVersionInfo.cs b/DerpingDrivers/Util/OSVersionInfo.cs index 534427c..cff1b20 100644 --- a/DerpingDrivers/Util/OSVersionInfo.cs +++ b/DerpingDrivers/Util/OSVersionInfo.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; -using System.Windows; using Markdig.Helpers; using Microsoft.Win32; @@ -55,13 +54,16 @@ namespace DerpingDrivers.Util #region Windows 10/Server 2016+ Detection - private static bool IsWindows10() + public static bool IsWindows10 { - var releaseId = (string) Registry.GetValue( - @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion", - "ReleaseId", null); + get + { + var releaseId = (string) Registry.GetValue( + @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion", + "ReleaseId", null); - return !string.IsNullOrEmpty(releaseId) && Windows10ReleaseIds.Any(id => id.Contains(releaseId)); + return !string.IsNullOrEmpty(releaseId) && Windows10ReleaseIds.Any(id => id.Contains(releaseId)); + } } #endregion @@ -613,7 +615,7 @@ namespace DerpingDrivers.Util minorVersion = Convert.ToInt32(splitResult[1]); } - if (IsWindows10()) + if (IsWindows10) { majorVersion = 10; minorVersion = 0; @@ -1038,7 +1040,7 @@ namespace DerpingDrivers.Util { get { - if (IsWindows10()) return 10; + if (IsWindows10) return 10; var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion", ""); if (!string.IsNullOrEmpty(exactVersion)) @@ -1062,7 +1064,7 @@ namespace DerpingDrivers.Util { get { - if (IsWindows10()) return 0; + if (IsWindows10) return 0; var exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion", ""); if (!string.IsNullOrEmpty(exactVersion)) @@ -1086,7 +1088,7 @@ namespace DerpingDrivers.Util { get { - if (IsWindows10()) return 0; + if (IsWindows10) return 0; return Environment.OSVersion.Version.Revision; } }