Fix an issue with incorrect logging of secure boot state

This commit is contained in:
Gustave Monce
2021-08-13 13:21:15 +02:00
parent 8293c18406
commit 668a9b7fe2
10 changed files with 12 additions and 26 deletions
+1 -2
View File
@@ -570,8 +570,7 @@ namespace WPinternals
{
// This is necessary, because the partitions and backup-partitions can exchange.
// This may cause the startsector to be higher than the maximum allowed sector for flashing with a Lumia V1 programmer (hardcoded in programmer)
List<string> RevisePartitions = new(new string[] { "SBL1", "SBL2", "SBL3", "UEFI", "TZ", "RPM", "WINSECAPP" });
foreach (string RevisePartitionName in RevisePartitions)
foreach (string RevisePartitionName in (List<string>)(new(new string[] { "SBL1", "SBL2", "SBL3", "UEFI", "TZ", "RPM", "WINSECAPP" })))
{
Partition RevisePartition = GetPartition(RevisePartitionName);
Partition ReviseBackupPartition = GetPartition("BACKUP_" + RevisePartitionName);
+1 -2
View File
@@ -41,8 +41,7 @@ namespace WPinternals
{
try
{
ManagementObjectCollection coll = new ManagementObjectSearcher("select * from Win32_LogicalDisk").Get();
foreach (ManagementObject logical in coll)
foreach (ManagementObject logical in new ManagementObjectSearcher("select * from Win32_LogicalDisk").Get())
{
System.Diagnostics.Debug.Print(logical["Name"].ToString());
+3 -5
View File
@@ -206,8 +206,7 @@ namespace WPinternals
if ((TerminalResponse?.Length > 0x20) && (BigEndian.ToUInt32(TerminalResponse, 0x14) == (TerminalResponse.Length - 0x18)) && (BitConverter.ToUInt32(TerminalResponse, 0x1C) == (TerminalResponse.Length - 0x20)))
{
// Parse Terminal Response from offset 0x18
TerminalResponse ParsedResponse = Terminal.Parse(TerminalResponse, 0x18);
return ParsedResponse;
return Terminal.Parse(TerminalResponse, 0x18);
}
else
{
@@ -1216,8 +1215,7 @@ namespace WPinternals
ByteOperations.WriteAsciiString(Request, 0, "NOKXPH" + VariableName + "\0"); // BTR or CTR, CTR is public ProductCode
byte[] Response = ExecuteRawMethod(Request);
UInt16 Length = BigEndian.ToUInt16(Response, 6);
string Result = ByteOperations.ReadAsciiString(Response, 8, Length).Trim(new char[] { ' ', '\0' });
return Result;
return ByteOperations.ReadAsciiString(Response, 8, Length).Trim(new char[] { ' ', '\0' });
}
internal string ReadProductCode()
@@ -1373,7 +1371,7 @@ namespace WPinternals
break;
}
LogFile.Log("SecureBoot: " + ((!PlatformSecureBootEnabled || !UefiSecureBootEnabled) ? "Disabled" : "Enabled") + " (Platform Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ", UEFI Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ")", Type);
LogFile.Log("SecureBoot: " + ((!PlatformSecureBootEnabled || !UefiSecureBootEnabled) ? "Disabled" : "Enabled") + " (Platform Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ", UEFI Secure Boot: " + (UefiSecureBootEnabled ? "Enabled" : "Disabled") + ")", Type);
if ((Type == LogType.ConsoleOnly) || (Type == LogType.FileAndConsole))
{
+1 -2
View File
@@ -33,8 +33,7 @@ namespace WPinternals
try
{
IEnumerable<string> FilePaths = Directory.EnumerateFiles(Path);
foreach (string FilePath in FilePaths)
foreach (string FilePath in Directory.EnumerateFiles(Path))
{
try
{