1
0

Renamed property

This commit is contained in:
Benjamin Höglinger-Stelzer 2018-11-04 01:08:39 +01:00
parent 9033065e39
commit f5d607120a
2 changed files with 42 additions and 41 deletions

View File

@ -69,10 +69,6 @@ namespace DerpingDrivers
{ {
get get
{ {
BcdHelper.DisableTestSigning();
var t = BcdHelper.IsTestSignEnabled;
#region TESTSIGNING mode #region TESTSIGNING mode
if (CodeIntegrityHelper.IsTestSignEnabled) if (CodeIntegrityHelper.IsTestSignEnabled)

View File

@ -6,7 +6,10 @@ namespace DerpingDrivers.Util
{ {
public static class BcdHelper public static class BcdHelper
{ {
public static bool IsTestSignEnabled /// <summary>
/// Gets or sets the current value if BCDE_LIBRARY_TYPE_ALLOW_PRERELEASE_SIGNATURES from the default boot entry.
/// </summary>
public static bool AllowPrereleaseSignatures
{ {
get get
{ {
@ -20,48 +23,50 @@ namespace DerpingDrivers.Util
return allowPrereleaseSignatures != null && int.Parse(allowPrereleaseSignatures[0].ToString()) > 0; return allowPrereleaseSignatures != null && int.Parse(allowPrereleaseSignatures[0].ToString()) > 0;
} }
}
public static void EnableTestSigning() set
{
// NOTE: haven't found an API for this (yet), so system() we go!
var cmd = new Process
{ {
StartInfo = if (value)
{ {
FileName = "Bcdedit.exe", // NOTE: haven't found an API for this (yet), so system() we go!
Arguments = "-set TESTSIGNING ON", var cmd = new Process
WindowStyle = ProcessWindowStyle.Hidden, {
CreateNoWindow = true StartInfo =
{
FileName = "Bcdedit.exe",
Arguments = "-set TESTSIGNING ON",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true
}
};
cmd.Start();
cmd.WaitForExit();
if (cmd.ExitCode != 0)
throw new BcdAlterAllowPrereleaseSignaturesFailedException("Couldn't enable TESTSIGNING");
} }
}; else
cmd.Start();
cmd.WaitForExit();
if (cmd.ExitCode != 0)
throw new BcdAlterAllowPrereleaseSignaturesFailedException("Couldn't enable TESTSIGNING");
}
public static void DisableTestSigning()
{
// NOTE: haven't found an API for this (yet), so system() we go!
var cmd = new Process
{
StartInfo =
{ {
FileName = "Bcdedit.exe", // NOTE: haven't found an API for this (yet), so system() we go!
Arguments = "-set TESTSIGNING OFF", var cmd = new Process
WindowStyle = ProcessWindowStyle.Hidden, {
CreateNoWindow = true StartInfo =
{
FileName = "Bcdedit.exe",
Arguments = "-set TESTSIGNING OFF",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true
}
};
cmd.Start();
cmd.WaitForExit();
if (cmd.ExitCode != 0)
throw new BcdAlterAllowPrereleaseSignaturesFailedException("Couldn't disable TESTSIGNING");
} }
}; }
cmd.Start();
cmd.WaitForExit();
if (cmd.ExitCode != 0)
throw new BcdAlterAllowPrereleaseSignaturesFailedException("Couldn't disable TESTSIGNING");
} }
} }
} }