mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-07 09:36:10 -08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b0253f6fc | ||
|
|
8921bafa90 |
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## 1.3.0 - 2016-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Check Secure Boot status before installing.
|
||||||
|
|
||||||
## 1.2.0 - 2016-06-05
|
## 1.2.0 - 2016-06-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
34
src/Setup.cs
34
src/Setup.cs
@@ -5,6 +5,7 @@ using System.IO;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HackBGRT Setup.
|
* HackBGRT Setup.
|
||||||
@@ -190,7 +191,6 @@ public class Setup {
|
|||||||
throw new SetupException("Couldn't install the new bootmgfw.efi.");
|
throw new SetupException("Couldn't install the new bootmgfw.efi.");
|
||||||
}
|
}
|
||||||
Console.WriteLine("HackBGRT is now enabled.");
|
Console.WriteLine("HackBGRT is now enabled.");
|
||||||
Console.WriteLine("Remember to disable Secure Boot, or HackBGRT will not boot.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,6 +264,38 @@ public class Setup {
|
|||||||
ESP esp = new ESP();
|
ESP esp = new ESP();
|
||||||
try {
|
try {
|
||||||
esp.Mount();
|
esp.Mount();
|
||||||
|
int secureBoot = -1;
|
||||||
|
try {
|
||||||
|
secureBoot = (int) Registry.GetValue(
|
||||||
|
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State",
|
||||||
|
"UEFISecureBootEnabled",
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
} catch (Exception) {
|
||||||
|
}
|
||||||
|
if (secureBoot != 0) {
|
||||||
|
if (secureBoot == 1) {
|
||||||
|
Console.WriteLine("Secure Boot is enabled.");
|
||||||
|
Console.WriteLine("HackBGRT doesn't work with Secure Boot.");
|
||||||
|
Console.WriteLine("If you install HackBGRT, your machine may become unbootable,");
|
||||||
|
Console.WriteLine("unless you manually disable Secure Boot.");
|
||||||
|
} else {
|
||||||
|
Console.WriteLine("Could not determine Secure Boot status.");
|
||||||
|
Console.WriteLine("Your system may be incompatible with HackBGRT.");
|
||||||
|
Console.WriteLine("If you install HackBGRT, your machine may become unbootable.");
|
||||||
|
}
|
||||||
|
Console.WriteLine("Do you still wish to continue? [Y/N]");
|
||||||
|
var k = Console.ReadKey().Key;
|
||||||
|
Console.WriteLine();
|
||||||
|
if (k == ConsoleKey.Y) {
|
||||||
|
Console.WriteLine("Continuing. THIS IS DANGEROUS!");
|
||||||
|
} else if (k == ConsoleKey.N) {
|
||||||
|
Console.WriteLine("Aborting.");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw new SetupException("Invalid choice!");
|
||||||
|
}
|
||||||
|
}
|
||||||
string hackbgrt = esp.Path + "\\EFI\\HackBGRT";
|
string hackbgrt = esp.Path + "\\EFI\\HackBGRT";
|
||||||
string msloader = esp.Path + "\\EFI\\Microsoft\\Boot\\bootmgfw.efi";
|
string msloader = esp.Path + "\\EFI\\Microsoft\\Boot\\bootmgfw.efi";
|
||||||
if (!Directory.Exists(hackbgrt)) {
|
if (!Directory.Exists(hackbgrt)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user