1
0

Added summary skeletons

This commit is contained in:
Benjamin Höglinger-Stelzer 2018-10-26 21:26:34 +02:00
parent 41d0b98b20
commit 2b1071408d
15 changed files with 155 additions and 45 deletions

View File

@ -155,6 +155,14 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Resources\win10_x64_uefi_clean.md" />
<None Include="Resources\win10_x64_uefi_secure_clean.md" />
<None Include="Resources\win10_x64_uefi_secure_upgraded.md" />
<None Include="Resources\win10_x64_uefi_upgraded.md" />
<None Include="Resources\win10_x86_uefi_clean.md" />
<None Include="Resources\win10_x86_uefi_secure_clean.md" />
<None Include="Resources\win10_x86_uefi_secure_upgraded.md" />
<None Include="Resources\win10_x86_uefi_upgraded.md" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />

View File

@ -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}}">
<FrameworkElement.CommandBindings>
<CommandBinding Command="{x:Static markdig:Commands.Hyperlink}" Executed="OpenHyperlink" />
</FrameworkElement.CommandBindings>
<TabControl Margin="15">
<!-- System Details -->
<TabItem Header="System Details">
@ -74,7 +79,7 @@
<!-- Compatibility Summary -->
<TabItem Header="Compatibility Summary">
<FlowDocumentScrollViewer VerticalScrollBarVisibility="Auto" Document="{Binding SummaryDocument}" />
<markdig:MarkdownViewer x:Name="SummaryViewer"/>
</TabItem>
<!-- About -->

View File

@ -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;
}
/// <summary>
@ -68,32 +77,22 @@ namespace DerpingDrivers
/// </summary>
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;
}
}
private static MarkdownPipeline BuildPipeline()
if (OsVersionInfo.IsWindows10)
{
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
private void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
{
public override bool TryGetCompatibleXamlNamespace(string xamlNamespace, out string compatibleNamespace)
{
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());
}
}
}

View File

@ -69,5 +69,85 @@ namespace DerpingDrivers.Properties {
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x64_uefi_clean {
get {
object obj = ResourceManager.GetObject("win10_x64_uefi_clean", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x64_uefi_secure_clean {
get {
object obj = ResourceManager.GetObject("win10_x64_uefi_secure_clean", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x64_uefi_secure_upgraded {
get {
object obj = ResourceManager.GetObject("win10_x64_uefi_secure_upgraded", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x64_uefi_upgraded {
get {
object obj = ResourceManager.GetObject("win10_x64_uefi_upgraded", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x86_uefi_clean {
get {
object obj = ResourceManager.GetObject("win10_x86_uefi_clean", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x86_uefi_secure_clean {
get {
object obj = ResourceManager.GetObject("win10_x86_uefi_secure_clean", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x86_uefi_secure_upgraded {
get {
object obj = ResourceManager.GetObject("win10_x86_uefi_secure_upgraded", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] win10_x86_uefi_upgraded {
get {
object obj = ResourceManager.GetObject("win10_x86_uefi_upgraded", resourceCulture);
return ((byte[])(obj));
}
}
}
}

View File

@ -121,4 +121,28 @@
<data name="testsigning" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\testsigning.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x64_uefi_clean" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x64_uefi_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x64_uefi_secure_clean" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x64_uefi_secure_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x64_uefi_secure_upgraded" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x64_uefi_secure_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x64_uefi_upgraded" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x64_uefi_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x86_uefi_clean" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x86_uefi_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x86_uefi_secure_clean" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x86_uefi_secure_clean.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x86_uefi_secure_upgraded" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x86_uefi_secure_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="win10_x86_uefi_upgraded" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\win10_x86_uefi_upgraded.md;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -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!
```cmd
bcdedit.exe -set TESTSIGNING OFF
```

View File

@ -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,7 +54,9 @@ namespace DerpingDrivers.Util
#region Windows 10/Server 2016+ Detection
private static bool IsWindows10()
public static bool IsWindows10
{
get
{
var releaseId = (string) Registry.GetValue(
@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion",
@ -63,6 +64,7 @@ namespace DerpingDrivers.Util
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;
}
}