mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
Enhancements
- Improved error messages - Added shutdown functionality from mass stoage - Fixed an issue where 9006 would incorrectly be used for rebooting from mass storage - Added support for gathering security information from older flash apps - Added a new indicator in the empty view when a phone in bootloader mode is detected - Fixed an issue where interrupting the bootloader may fail - Added more checks to some functions - Started to work on a bootloader view - Fixed an issue where x50 phones in label mode would not get detected once being disconnected - Added logging for Qualcomm Emergency Charging mode - General bug fixes
This commit is contained in:
+11
-7
@@ -52,17 +52,21 @@ namespace WPinternals
|
||||
if (Environment.GetCommandLineArgs().Count() > 1)
|
||||
CommandLine.OpenConsole();
|
||||
|
||||
if (!mutex.WaitOne(0, false))
|
||||
try
|
||||
{
|
||||
if (Environment.GetCommandLineArgs().Count() > 1)
|
||||
if (!mutex.WaitOne(0, false))
|
||||
{
|
||||
Console.WriteLine("Windows Phone Internals is already running");
|
||||
CommandLine.CloseConsole();
|
||||
if (Environment.GetCommandLineArgs().Count() > 1)
|
||||
{
|
||||
Console.WriteLine("Windows Phone Internals is already running");
|
||||
CommandLine.CloseConsole();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Windows Phone Internals is already running.", "Windows Phone Internals", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Windows Phone Internals is already running.", "Windows Phone Internals", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
catch (AbandonedMutexException) { };
|
||||
|
||||
Registration.CheckExpiration();
|
||||
|
||||
|
||||
+21
-21
@@ -465,7 +465,7 @@ namespace WPinternals
|
||||
if (FFUs.Count() > 0)
|
||||
ProfileFFU = new FFU(FFUs[0].Path);
|
||||
else
|
||||
throw new WPinternalsException("Profile FFU missing");
|
||||
throw new WPinternalsException("Profile FFU missing", "No profile FFU has been found in the repository for your device. You can add a profile FFU within the download section of the tool or by using the command line.");
|
||||
}
|
||||
LogFile.Log("Profile FFU: " + ProfileFFU.Path);
|
||||
|
||||
@@ -601,7 +601,7 @@ namespace WPinternals
|
||||
if (FFUs.Count() > 0)
|
||||
ProfileFFU = new FFU(FFUs[0].Path);
|
||||
else
|
||||
throw new WPinternalsException("Profile FFU missing");
|
||||
throw new WPinternalsException("Profile FFU missing", "No profile FFU has been found in the repository for your device. You can add a profile FFU within the download section of the tool or by using the command line.");
|
||||
}
|
||||
LogFile.Log("Profile FFU: " + ProfileFFU.Path);
|
||||
|
||||
@@ -611,7 +611,7 @@ namespace WPinternals
|
||||
if (FFUs.Count() > 0)
|
||||
SupportedFFU = new FFU(FFUs[0].Path);
|
||||
else
|
||||
throw new WPinternalsException("No donor-FFU found with supported OS version");
|
||||
throw new WPinternalsException("No donor-FFU found with supported OS version", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
|
||||
await LumiaUnlockBootloaderViewModel.LumiaUnlockUEFI(Notifier, ProfileFFU.Path, null, SupportedFFU.Path);
|
||||
@@ -695,7 +695,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = Drive + "\\";
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Patch failed");
|
||||
throw new WPinternalsException("Patch failed", "An error occured while patching Operating System files on the MainOS partition of your phone. Make sure your phone runs a supported Operating System version.");
|
||||
LogFile.Log("Fixed bootloader", LogType.FileAndConsole);
|
||||
LogFile.Log("The phone is left in Mass Storage mode", LogType.FileAndConsole);
|
||||
LogFile.Log("Press and hold the power-button of the phone for at least 10 seconds to reset the phone", LogType.FileAndConsole);
|
||||
@@ -721,14 +721,14 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = Drive + "\\EFIESP\\";
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-V2-EFIESP");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Patch failed");
|
||||
throw new WPinternalsException("Patch failed", "An error occured while patching Operating System files on the EFIESP partition of your phone. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported.");
|
||||
App.PatchEngine.TargetPath = Drive + "\\";
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Patch failed");
|
||||
throw new WPinternalsException("Patch failed", "An error occured while patching Operating System files on the MainOS partition of your phone. Make sure your phone runs a supported Operating System version.");
|
||||
PatchResult = App.PatchEngine.Patch("RootAccess-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Patch failed");
|
||||
throw new WPinternalsException("Patch failed", "An error occured while modifying Operating System files on the MainOS partition of your phone for Root Access. Make sure your phone runs a supported Operating System version.");
|
||||
LogFile.Log("Root Access enabled!", LogType.FileAndConsole);
|
||||
LogFile.Log("The phone is left in Mass Storage mode", LogType.FileAndConsole);
|
||||
LogFile.Log("Press and hold the power-button of the phone for at least 10 seconds to reset the phone", LogType.FileAndConsole);
|
||||
@@ -785,7 +785,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetImage = UnlockedEFIESPFileSystem;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-V2-EFIESP");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch bootloader");
|
||||
throw new WPinternalsException("Failed to patch bootloader", "An error occured while patching Operating System files on the EFIESP partition provided. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported, unless the replacement files have been tampered with or are not compatible.");
|
||||
|
||||
// Edit BCD
|
||||
LogFile.Log("Edit BCD");
|
||||
@@ -820,7 +820,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetImage = UnlockedMainOsFileSystem;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while patching Operating System files on the MainOS partition you provided. Make sure your phone runs a supported Operating System version.");
|
||||
}
|
||||
}
|
||||
LogFile.Log("Bootloader unlocked on image", LogType.FileAndConsole);
|
||||
@@ -863,7 +863,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetImage = UnlockedEFIESPFileSystem;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-V2-EFIESP");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch bootloader");
|
||||
throw new WPinternalsException("Failed to patch bootloader", "An error occured while patching Operating System files on the EFIESP partition provided. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported, unless the replacement files have been tampered with or are not compatible.");
|
||||
|
||||
// Edit BCD
|
||||
LogFile.Log("Edit BCD");
|
||||
@@ -896,10 +896,10 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetImage = UnlockedMainOsFileSystem;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while patching Operating System files on the MainOS partition you provided. Make sure your phone runs a supported Operating System version.");
|
||||
PatchResult = App.PatchEngine.Patch("RootAccess-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while modifying Operating System files on the MainOS partition you provided for Root Access. Make sure your phone runs a supported Operating System version.");
|
||||
}
|
||||
LogFile.Log("Root access enabled on image", LogType.FileAndConsole);
|
||||
break;
|
||||
@@ -942,7 +942,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = EfiEspImagePath;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-V2-EFIESP");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch bootloader");
|
||||
throw new WPinternalsException("Failed to patch bootloader", "An error occured while patching Operating System files on the EFIESP partition provided. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported, unless the replacement files have been tampered with or are not compatible.");
|
||||
|
||||
// Edit BCD
|
||||
LogFile.Log("Edit BCD");
|
||||
@@ -972,7 +972,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = MainOsImagePath;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while patching Operating System files on the MainOS partition you provided. Make sure your phone runs a supported Operating System version.");
|
||||
}
|
||||
LogFile.Log("Bootloader unlocked on image", LogType.FileAndConsole);
|
||||
break;
|
||||
@@ -1010,7 +1010,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = EfiEspImagePath;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-V2-EFIESP");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch bootloader");
|
||||
throw new WPinternalsException("Failed to patch bootloader", "An error occured while patching Operating System files on the EFIESP partition provided. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported, unless the replacement files have been tampered with or are not compatible.");
|
||||
|
||||
// Edit BCD
|
||||
LogFile.Log("Edit BCD");
|
||||
@@ -1038,10 +1038,10 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = MainOsImagePath;
|
||||
PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while patching Operating System files on the MainOS partition you provided. Make sure your phone runs a supported Operating System version.");
|
||||
PatchResult = App.PatchEngine.Patch("RootAccess-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch MainOS");
|
||||
throw new WPinternalsException("Failed to patch MainOS", "An error occured while modifying Operating System files on the MainOS partition you provided for Root Access. Make sure your phone runs a supported Operating System version.");
|
||||
LogFile.Log("Root access enabled on image", LogType.FileAndConsole);
|
||||
break;
|
||||
case "downloadffu":
|
||||
@@ -1362,7 +1362,7 @@ namespace WPinternals
|
||||
App.Config.AddFfuToRepository(FFUFilePath);
|
||||
|
||||
if (App.Config.FFURepository.Where(e => App.PatchEngine.PatchDefinitions.Where(p => p.Name == "SecureBootHack-V2-EFIESP").First().TargetVersions.Any(v => v.Description == e.OSVersion)).Count() == 0)
|
||||
throw new WPinternalsException("Unable to find compatible FFU");
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
Notifier.Stop();
|
||||
break;
|
||||
@@ -1443,7 +1443,7 @@ namespace WPinternals
|
||||
App.Config.AddFfuToRepository(FFUFilePath);
|
||||
|
||||
if (App.Config.FFURepository.Where(e => App.PatchEngine.PatchDefinitions.Where(p => p.Name == "SecureBootHack-V2-EFIESP").First().TargetVersions.Any(v => v.Description == e.OSVersion)).Count() == 0)
|
||||
throw new WPinternalsException("Unable to find compatible FFU");
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
break;
|
||||
case "downloadallbyproductcode":
|
||||
@@ -1523,7 +1523,7 @@ namespace WPinternals
|
||||
App.Config.AddFfuToRepository(FFUFilePath);
|
||||
|
||||
if (App.Config.FFURepository.Where(e => App.PatchEngine.PatchDefinitions.Where(p => p.Name == "SecureBootHack-V2-EFIESP").First().TargetVersions.Any(v => v.Description == e.OSVersion)).Count() == 0)
|
||||
throw new WPinternalsException("Unable to find compatible FFU");
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
break;
|
||||
case "downloadallbyoperatorcode":
|
||||
@@ -1605,7 +1605,7 @@ namespace WPinternals
|
||||
App.Config.AddFfuToRepository(FFUFilePath);
|
||||
|
||||
if (App.Config.FFURepository.Where(e => App.PatchEngine.PatchDefinitions.Where(p => p.Name == "SecureBootHack-V2-EFIESP").First().TargetVersions.Any(v => v.Description == e.OSVersion)).Count() == 0)
|
||||
throw new WPinternalsException("Unable to find compatible FFU");
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
+14
-14
@@ -53,7 +53,7 @@ namespace WPinternals
|
||||
this.GPTBuffer = GPTBuffer;
|
||||
UInt32? TempHeaderOffset = ByteOperations.FindAscii(GPTBuffer, "EFI PART");
|
||||
if (TempHeaderOffset == null)
|
||||
throw new WPinternalsException("Bad GPT");
|
||||
throw new WPinternalsException("Bad GPT", "The GPT read isn't valid. Couldn't find the text \"EFI PART\".");
|
||||
HeaderOffset = (UInt32)TempHeaderOffset;
|
||||
HeaderSize = ByteOperations.ReadUInt32(GPTBuffer, HeaderOffset + 0x0C);
|
||||
TableOffset = HeaderOffset + 0x200;
|
||||
@@ -63,7 +63,7 @@ namespace WPinternals
|
||||
PartitionEntrySize = ByteOperations.ReadUInt32(GPTBuffer, HeaderOffset + 0x54);
|
||||
TableSize = MaxPartitions * PartitionEntrySize;
|
||||
if ((TableOffset + TableSize) > GPTBuffer.Length)
|
||||
throw new WPinternalsException("Bad GPT");
|
||||
throw new WPinternalsException("Bad GPT", "The GPT read isn't valid. The sizes defined in the GPT header exceed the provided GPT size.");
|
||||
|
||||
UInt32 PartitionOffset = TableOffset;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace WPinternals
|
||||
Partition SBL2 = Partitions.Where(p => (p.Name == "SBL2")).FirstOrDefault();
|
||||
|
||||
if ((SBL1 == null) || (SBL2 == null))
|
||||
throw new WPinternalsException("Bad GPT");
|
||||
throw new WPinternalsException("Bad GPT", "Can't patch GPT for the Secure Boot hack for Spec A devices. The provided GPT does not include a SBL1 and/or SBL2 partition.");
|
||||
|
||||
if (HackPartition == null)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ namespace WPinternals
|
||||
Partition SBL2 = Partitions.Where(p => (p.Name == "SBL2")).FirstOrDefault();
|
||||
|
||||
if ((SBL1 == null) || (SBL2 == null))
|
||||
throw new WPinternalsException("Bad GPT");
|
||||
throw new WPinternalsException("Bad GPT", "Can't un-patch GPT for the Secure Boot hack for Spec A devices. The provided GPT does not include a SBL1 and/or SBL2 partition.");
|
||||
|
||||
if (HackPartition != null)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ namespace WPinternals
|
||||
|
||||
if (NewPartition.LastSector == 0)
|
||||
{
|
||||
throw new WPinternalsException("Unknown length for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Unknown length for partition \"" + NewPartition.Name + "\". The last sector property is set to 0 and the partition doesn't exist on the device currently.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -234,9 +234,9 @@ namespace WPinternals
|
||||
// If the location of the new partition is specified, it must be the same as the current partition.
|
||||
|
||||
if ((NewPartition.FirstSector != 0) && (NewPartition.FirstSector != OldPartition.FirstSector))
|
||||
throw new WPinternalsException("Incorrect location for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Incorrect location for partition \"" + NewPartition.Name + "\". A partition defined in the xml file got its boundaries updated, but as the partition isn't provided in the archive, it is not possible to relocate it.");
|
||||
if ((NewPartition.LastSector != 0) && (NewPartition.LastSector != OldPartition.LastSector))
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + NewPartition.Name + "\". A partition defined in the xml file got its boundaries updated, but as the partition isn't provided in the archive, it is not possible to relocate it.");
|
||||
|
||||
NewPartition.FirstSector = OldPartition.FirstSector;
|
||||
NewPartition.LastSector = OldPartition.LastSector;
|
||||
@@ -264,7 +264,7 @@ namespace WPinternals
|
||||
else
|
||||
{
|
||||
if (NewPartition.SizeInSectors != StreamLengthInSectors)
|
||||
throw new WPinternalsException("Inconsistent length specified for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Inconsistent length specified for partition \"" + NewPartition.Name + "\". The provided partition in the archive does not match the length specified in the xml file.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ namespace WPinternals
|
||||
|
||||
if (NewPartition.LastSector == 0)
|
||||
{
|
||||
throw new WPinternalsException("Unknown length for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Unknown length for partition \"" + NewPartition.Name + "\". The last sector property is set to 0 and the partition doesn't exist on the device currently.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -293,9 +293,9 @@ namespace WPinternals
|
||||
// If the location of the new partition is specified, it must be the same as the current partition.
|
||||
|
||||
if ((NewPartition.FirstSector != 0) && (NewPartition.FirstSector != OldPartition.FirstSector))
|
||||
throw new WPinternalsException("Incorrect location for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Incorrect location for partition \"" + NewPartition.Name + "\". A partition defined in the xml file got its boundaries updated, but as the partition isn't provided in the archive, it is not possible to relocate it.");
|
||||
if ((NewPartition.LastSector != 0) && (NewPartition.LastSector != OldPartition.LastSector))
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + NewPartition.Name + "\"");
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + NewPartition.Name + "\". A partition defined in the xml file got its boundaries updated, but as the partition isn't provided in the archive, it is not possible to relocate it.");
|
||||
|
||||
NewPartition.FirstSector = OldPartition.FirstSector;
|
||||
NewPartition.LastSector = OldPartition.LastSector;
|
||||
@@ -348,7 +348,7 @@ namespace WPinternals
|
||||
|
||||
// Sanity check
|
||||
if (NewPartition.FirstSector < LowestSector)
|
||||
throw new WPinternalsException("Bad sector alignment for partition: " + NewPartition.Name);
|
||||
throw new WPinternalsException("Bad sector alignment for partition: " + NewPartition.Name + ". The partition is located before DPP.");
|
||||
|
||||
Partition CurrentPartition = this.GetPartition(NewPartition.Name);
|
||||
if (CurrentPartition == null)
|
||||
@@ -426,7 +426,7 @@ namespace WPinternals
|
||||
MaxPartitionSizeInSectors = NextPartition.FirstSector - OldPartition.FirstSector;
|
||||
if (StreamLengthInSectors > MaxPartitionSizeInSectors)
|
||||
{
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + OldPartition.Name + "\"");
|
||||
throw new WPinternalsException("Incorrect length for partition \"" + OldPartition.Name + "\". The provided partition in the archive does not match the length specified in the xml file.");
|
||||
}
|
||||
|
||||
if (OldPartition.SizeInSectors != StreamLengthInSectors)
|
||||
@@ -528,7 +528,7 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
if (RevisePartition.LastSector >= 0xF400)
|
||||
throw new WPinternalsException("Unsupported partition layout!");
|
||||
throw new WPinternalsException("Unsupported partition layout!", "The last sector of one of the BACKUP partitions defined in GPT exceeds the maximum threshold expected in order to restore BACKUP partitions to the device.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
if (Package == null)
|
||||
throw new WPinternalsException("FFU not found");
|
||||
throw new WPinternalsException("FFU not found", "No FFU has been found in the remote software repository for the requested model.");
|
||||
|
||||
FoundProductType = Package.manufacturerHardwareModel[0];
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
if (Package == null)
|
||||
throw new WPinternalsException("ENOSW package not found");
|
||||
throw new WPinternalsException("ENOSW package not found", "No ENOSW package has been found in the remote software repository for the requested model.");
|
||||
|
||||
SoftwareFile FileInfo = Package.files.Where(f => f.fileName.EndsWith(".secwim", StringComparison.OrdinalIgnoreCase)).First();
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
if (DPLUrl == "")
|
||||
throw new WPinternalsException("DPL not found");
|
||||
throw new WPinternalsException("DPL not found", "No DPL has been found in the remote software repository for the requested model.");
|
||||
|
||||
Task<string> GetDPLStrTask = HttpClient.GetStringAsync(DPLUrl);
|
||||
GetDPLStrTask.Wait();
|
||||
|
||||
+19
-6
@@ -35,7 +35,7 @@ namespace WPinternals
|
||||
internal IntPtr hDrive = (IntPtr)(-1);
|
||||
private bool OpenWithWriteAccess;
|
||||
|
||||
private QualcommSerial Serial;
|
||||
private string Serial;
|
||||
|
||||
internal MassStorage(string DevicePath) : base(DevicePath)
|
||||
{
|
||||
@@ -77,10 +77,16 @@ namespace WPinternals
|
||||
{
|
||||
try
|
||||
{
|
||||
Serial = new QualcommSerial(DevicePath);
|
||||
Serial.EncodeCommands = false;
|
||||
QualcommSerial SerialDevice = new QualcommSerial(DevicePath);
|
||||
SerialDevice.Close();
|
||||
SerialDevice.Dispose();
|
||||
|
||||
Serial = DevicePath;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogFile.Log(ex.Message);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal bool DoesDeviceSupportReboot()
|
||||
@@ -95,11 +101,18 @@ namespace WPinternals
|
||||
|
||||
try
|
||||
{
|
||||
QualcommSerial SerialDevice = new QualcommSerial(Serial);
|
||||
|
||||
SerialDevice.EncodeCommands = false;
|
||||
|
||||
// This will succeed on new models
|
||||
Serial.SendData(new byte[] { 0x7, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0 });
|
||||
SerialDevice.SendData(new byte[] { 0x7, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0 });
|
||||
|
||||
// This will succeed on old models
|
||||
Serial.SendData(new byte[] { 0x7E, 0xA, 0x0, 0x0, 0xB6, 0xB5, 0x7E });
|
||||
SerialDevice.SendData(new byte[] { 0x7E, 0xA, 0x0, 0x0, 0xB6, 0xB5, 0x7E });
|
||||
|
||||
SerialDevice.Close();
|
||||
SerialDevice.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace WPinternals
|
||||
if (Response == null)
|
||||
throw new BadConnectionException();
|
||||
if (Response.Length == 4)
|
||||
throw new WPinternalsException("Flash protocol v2 not supported");
|
||||
throw new WPinternalsException("Flash protocol v2 not supported", "The device reported that the Flash protocol v2 was not supported while sending the FFU header.");
|
||||
int ResultCode = (Response[6] << 8) + Response[7];
|
||||
if (ResultCode != 0)
|
||||
ThrowFlashError(ResultCode);
|
||||
@@ -345,7 +345,7 @@ namespace WPinternals
|
||||
ThrowFlashError(ResultCode);
|
||||
}
|
||||
else
|
||||
throw new WPinternalsException("Specified partition cannot be backupped to RAM");
|
||||
throw new WPinternalsException("Specified partition cannot be backupped to RAM", "Partition name: \"" + PartitionName + "\".");
|
||||
}
|
||||
|
||||
public void LoadMmosBinary(UInt32 TotalLength, UInt32 Offset, bool SkipMmosSupportCheck, byte[] MmosPart)
|
||||
@@ -450,7 +450,7 @@ namespace WPinternals
|
||||
|
||||
PhoneInfo Info = ReadPhoneInfo();
|
||||
if ((Info.SecureFfuSupportedProtocolMask & ((ushort)FfuProtocol.ProtocolSyncV1 | (ushort)FfuProtocol.ProtocolSyncV2)) == 0)
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported");
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported. The device reports that both Protocol Sync v1 and Protocol Sync v2 are not supported for FFU flashing. Is this an old device?");
|
||||
|
||||
UInt64 CombinedFFUHeaderSize = FFU.HeaderSize;
|
||||
byte[] FfuHeader = new byte[CombinedFFUHeaderSize];
|
||||
@@ -518,7 +518,7 @@ namespace WPinternals
|
||||
|
||||
PhoneInfo Info = ReadPhoneInfo();
|
||||
if (!Info.MmosOverUsbSupported)
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported");
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported. The device reports that loading Microsoft Manufacturing Operating System over USB is not supported.");
|
||||
|
||||
FileInfo info = new FileInfo(MMOSPath);
|
||||
uint length = uint.Parse(info.Length.ToString());
|
||||
@@ -986,7 +986,7 @@ namespace WPinternals
|
||||
if (Response == null)
|
||||
throw new BadConnectionException();
|
||||
if (ByteOperations.ReadAsciiString(Response, 0, 4) != "NOKI")
|
||||
throw new WPinternalsException("Bad response from phone!");
|
||||
throw new WPinternalsException("Bad response from phone!", "The phone did not answer properly to the Hello message sent.");
|
||||
}
|
||||
|
||||
internal UInt16 ReadSecureFfuSupportedProtocolMask()
|
||||
@@ -1199,7 +1199,7 @@ namespace WPinternals
|
||||
LogFile.Log("Product code: " + ProductCode, Type);
|
||||
if (RKH != null)
|
||||
LogFile.Log("Root key hash: " + Converter.ConvertHexToString(RKH, ""), Type);
|
||||
if (Firmware.Length > 0)
|
||||
if (Firmware != null && Firmware.Length > 0)
|
||||
LogFile.Log("Firmware version: " + Firmware, Type);
|
||||
if (!(Type == LogType.ConsoleOnly) && (Imei != null))
|
||||
LogFile.Log("IMEI: " + Imei, LogType.FileOnly);
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace WPinternals
|
||||
internal FilePatcher(string FilePath, Stream FileStream)
|
||||
{
|
||||
if (!FileStream.CanSeek || !FileStream.CanWrite)
|
||||
throw new WPinternalsException("Incorrect filestream");
|
||||
throw new WPinternalsException("Incorrect filestream", "The provided file stream for patching does not support seeking and/or writing.");
|
||||
|
||||
this.FilePath = FilePath;
|
||||
this.Stream = FileStream;
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace WPinternals
|
||||
HeaderOffset = ImageOffset + 8;
|
||||
}
|
||||
else
|
||||
throw new WPinternalsException("Invalid programmer");
|
||||
throw new WPinternalsException("Invalid programmer", "The type of elf image could not be determined from the provided programmer.");
|
||||
}
|
||||
else if (ByteOperations.FindPattern(Binary, Offset, (uint)LongHeaderPattern.Length, LongHeaderPattern, LongHeaderMask, null) == null)
|
||||
{
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ namespace WPinternals
|
||||
Info.Log(LogType.ConsoleOnly);
|
||||
await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Qualcomm_Download);
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Download)
|
||||
throw new WPinternalsException("Switching mode failed.");
|
||||
throw new WPinternalsException("Switching mode failed.", "Could not switch the phone to Qualcomm Emergency 9008.");
|
||||
LogFile.Log("Phone is in emergency mode.", LogType.FileAndConsole);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace WPinternals
|
||||
case null:
|
||||
case PhoneInterfaces.Lumia_Bootloader:
|
||||
ActivateSubContext(null);
|
||||
//ActivateSubContext(new NokiaBootloaderViewModel((NokiaFlashModel)CurrentModel, ModeSwitchRequestCallback, SwitchToGettingStarted));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ActivateSubContext(new NokiaNormalViewModel((NokiaPhoneModel)CurrentModel, ModeSwitchRequestCallback));
|
||||
|
||||
@@ -78,7 +78,11 @@ namespace WPinternals
|
||||
switch (CurrentInterface)
|
||||
{
|
||||
case null:
|
||||
ActivateSubContext(null);
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_Bootloader:
|
||||
ActivateSubContext(null);
|
||||
//ActivateSubContext(new NokiaModeBootloaderViewModel((NokiaFlashModel)CurrentModel, OnModeSwitchRequested));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ActivateSubContext(new NokiaModeNormalViewModel((NokiaPhoneModel)CurrentModel, OnModeSwitchRequested));
|
||||
|
||||
@@ -134,11 +134,14 @@ namespace WPinternals
|
||||
TestPos = 1;
|
||||
|
||||
UefiSecurityStatusResponse SecurityStatus = ((NokiaFlashModel)PhoneNotifier.CurrentModel).ReadSecurityStatus();
|
||||
IsBootLoaderUnlocked = (SecurityStatus.AuthenticationStatus || SecurityStatus.RdcStatus || !SecurityStatus.SecureFfuEfuseStatus);
|
||||
if (SecurityStatus != null)
|
||||
IsBootLoaderUnlocked = (SecurityStatus.AuthenticationStatus || SecurityStatus.RdcStatus || !SecurityStatus.SecureFfuEfuseStatus);
|
||||
|
||||
TestPos = 2;
|
||||
|
||||
PhoneInfo Info = ((NokiaFlashModel)PhoneNotifier.CurrentModel).ReadPhoneInfo();
|
||||
if (SecurityStatus == null)
|
||||
IsBootLoaderUnlocked = (Info.Authenticated || Info.RdcPresent || !Info.SecureFfuEnabled);
|
||||
|
||||
TestPos = 3;
|
||||
|
||||
@@ -255,7 +258,7 @@ namespace WPinternals
|
||||
if (FFUs.Count() > 0)
|
||||
ProfileFFU = new FFU(FFUs[0].Path);
|
||||
else
|
||||
throw new WPinternalsException("Profile FFU missing");
|
||||
throw new WPinternalsException("Profile FFU missing", "No profile FFU has been found in the repository for your device. You can add a profile FFU within the download section of the tool or by using the command line.");
|
||||
|
||||
LogFile.Log("Profile FFU: " + ProfileFFU.Path);
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in bootloader mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
NewGPT = ((NokiaFlashModel)Notifier.CurrentModel).ReadGPT();
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -501,7 +501,7 @@ namespace WPinternals
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Download)
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Download)
|
||||
throw new WPinternalsException("Phone failed to switch to DLOAD.");
|
||||
throw new WPinternalsException("Phone failed to switch to emergency download mode.");
|
||||
}
|
||||
|
||||
// Send loader
|
||||
@@ -512,7 +512,7 @@ namespace WPinternals
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Flash)
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Flash)
|
||||
throw new WPinternalsException("Phone failed to switch to DLOAD.");
|
||||
throw new WPinternalsException("Phone failed to switch to emergency flash mode.");
|
||||
}
|
||||
|
||||
// Flash bootloader
|
||||
@@ -584,7 +584,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader && Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
@@ -593,7 +593,7 @@ namespace WPinternals
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash, download, or emergency flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
|
||||
SetWorkingStatus("Rebooting phone...");
|
||||
@@ -603,7 +603,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader && Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
NokiaFlashModel FlashModel = (NokiaFlashModel)Notifier.CurrentModel;
|
||||
if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Flash && FlashModel.ReadParam("FS")[3] > 0)
|
||||
@@ -750,7 +750,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in bootloader mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
NewGPT = ((NokiaFlashModel)Notifier.CurrentModel).ReadGPT();
|
||||
|
||||
@@ -760,7 +760,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1122,7 +1122,7 @@ namespace WPinternals
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Download)
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Download)
|
||||
throw new WPinternalsException("Phone failed to switch to DLOAD.");
|
||||
throw new WPinternalsException("Phone failed to switch to emergency download mode.");
|
||||
}
|
||||
|
||||
// Send loader
|
||||
@@ -1133,7 +1133,7 @@ namespace WPinternals
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Flash)
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Qualcomm_Flash)
|
||||
throw new WPinternalsException("Phone failed to switch to DLOAD.");
|
||||
throw new WPinternalsException("Phone failed to switch to emergency flash mode.");
|
||||
}
|
||||
|
||||
// Flash bootloader
|
||||
@@ -1211,7 +1211,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader && Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
@@ -1222,7 +1222,7 @@ namespace WPinternals
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash, download or emergency flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
|
||||
await LumiaUnlockBootloaderViewModel.LumiaUnlockUEFI(Notifier, FFUPath, LoadersPath, SupportedFFUPath, SetWorkingStatus, UpdateWorkingStatus, null, (string Message, string SubMessage) =>
|
||||
@@ -1346,7 +1346,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in bootloader mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
|
||||
byte[] GPTChunk = GetGptChunk(((NokiaFlashModel)Notifier.CurrentModel), 0x20000);
|
||||
@@ -1368,7 +1368,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.");
|
||||
throw new WPinternalsException("Phone is in an unexpected mode.", "The phone should have been detected in flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
|
||||
if (IsSpecB || IsUnlockedPartitionSBL3 != null)
|
||||
@@ -1794,7 +1794,7 @@ namespace WPinternals
|
||||
|
||||
Partition EFIESPPartition = GPT.GetPartition("EFIESP");
|
||||
if (EFIESPPartition == null)
|
||||
throw new WPinternalsException("EFIESP partition not found!");
|
||||
throw new WPinternalsException("EFIESP partition not found!", "No EFIESP partition was found in the provided FFU's GPT.");
|
||||
|
||||
if ((UInt64)UnlockedEFIESP.Length != (EFIESPPartition.SizeInSectors * 0x200))
|
||||
throw new WPinternalsException("New EFIESP partition has wrong size. Size = 0x" + UnlockedEFIESP.Length.ToString("X8") + ". Expected size = 0x" + (EFIESPPartition.SizeInSectors * 0x200).ToString("X8"));
|
||||
@@ -1866,7 +1866,7 @@ namespace WPinternals
|
||||
await Notifier.WaitForArrival();
|
||||
|
||||
if ((Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader) && (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash))
|
||||
throw new WPinternalsException("Error: Phone is in wrong mode");
|
||||
throw new WPinternalsException("Error: Phone is in wrong mode", "The phone should have been detected in bootloader or flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
if (!IsSpecB && !SBL3Eng)
|
||||
{
|
||||
@@ -1994,7 +1994,7 @@ namespace WPinternals
|
||||
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
throw new WPinternalsException("Phone is in wrong mode");
|
||||
throw new WPinternalsException("Phone is in wrong mode", "The phone should have been detected in bootloader mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
|
||||
((NokiaFlashModel)Notifier.CurrentModel).SwitchToFlashAppContext();
|
||||
|
||||
@@ -2140,7 +2140,7 @@ namespace WPinternals
|
||||
|
||||
await Notifier.WaitForArrival();
|
||||
if (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
throw new WPinternalsException("Phone is in wrong mode");
|
||||
throw new WPinternalsException("Phone is in wrong mode", "The phone should have been detected in bootloader mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
}
|
||||
((NokiaFlashModel)Notifier.CurrentModel).SwitchToFlashAppContext();
|
||||
|
||||
@@ -2356,7 +2356,7 @@ namespace WPinternals
|
||||
|
||||
PatchResult = App.PatchEngine.Patch(PatchDefinition);
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Failed to patch bootloader");
|
||||
throw new WPinternalsException("Failed to patch bootloader", "An error occured while patching Operating System files on the EFIESP partition provided. Make sure no boot files have been tampered with and you use the latest version of the tool. This error cannot be caused by an incorrect Operating System version as the tool automatically uses replacement if the version isn't supported, unless the replacement files have been tampered with or are not compatible.");
|
||||
}
|
||||
|
||||
LogFile.Log("Edit BCD");
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace WPinternals
|
||||
|
||||
Partition TargetPartition = GPT.GetPartition(PartitionName);
|
||||
if (TargetPartition == null)
|
||||
throw new WPinternalsException("Target partition not found!");
|
||||
throw new WPinternalsException("Target partition not found!", "Couldn't find \"" + PartitionName + "\" from the device GPT.");
|
||||
LogFile.Log("Target-partition found at sector: 0x" + TargetPartition.FirstSector.ToString("X8") + " - 0x" + TargetPartition.LastSector.ToString("X8"), LogType.FileAndConsole);
|
||||
|
||||
bool IsUnlocked = false;
|
||||
@@ -498,7 +498,7 @@ namespace WPinternals
|
||||
FFU FFU = new FFU(FFUPath);
|
||||
UInt32 UpdateType = ByteOperations.ReadUInt32(FFU.StoreHeader, 0);
|
||||
if (UpdateType != 0)
|
||||
throw new WPinternalsException("Only Full Flash images supported");
|
||||
throw new WPinternalsException("Only Full Flash images supported", "The provided FFU file reports that it doesn't support Full Flash updates, but may support something else such as Partial Flash updates. This is not supported.");
|
||||
|
||||
if (FlashParts != null)
|
||||
{
|
||||
@@ -519,9 +519,9 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
if ((Info.SecureFfuSupportedProtocolMask & ((ushort)FfuProtocol.ProtocolSyncV2)) == 0) // Exploit needs protocol v2 -> This check is not conclusive, because old phones also report support for this protocol, although it is really not supported.
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported");
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported. The phone reports that it does not support the Protocol Sync V2.");
|
||||
if (Info.FlashAppProtocolVersionMajor < 2) // Old phones do not support the hack. These phones have Flash protocol 1.x.
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported");
|
||||
throw new WPinternalsException("Flash failed!", "Protocols not supported. The phone reports that Flash App communication protocol is lower than 2. Reported version by the phone: " + Info.FlashAppProtocolVersionMajor + ".");
|
||||
UEFI UEFI = new UEFI(FFU.GetPartition("UEFI"));
|
||||
string BootMgrName = UEFI.EFIs.Where(efi => ((efi.Name != null) && (efi.Name.Contains("BootMgrApp")))).First().Name;
|
||||
UInt32 EstimatedSizeOfMemGap = (UInt32)UEFI.GetFile(BootMgrName).Length;
|
||||
@@ -689,7 +689,7 @@ namespace WPinternals
|
||||
#endregion
|
||||
|
||||
if ((Notifier.CurrentInterface != PhoneInterfaces.Lumia_Flash) && (Notifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader))
|
||||
throw new WPinternalsException("Phone is in wrong mode");
|
||||
throw new WPinternalsException("Phone is in wrong mode", "The phone should have been detected in bootloader or flash mode. Instead it has been detected in " + Notifier.CurrentInterface.ToString() + " mode.");
|
||||
Model = (NokiaFlashModel)Notifier.CurrentModel;
|
||||
UpdateWorkingStatus("Initializing flash...", null, null);
|
||||
}
|
||||
@@ -2076,7 +2076,7 @@ namespace WPinternals
|
||||
App.PatchEngine.TargetPath = ((MassStorage)Notifier.CurrentModel).Drive + "\\";
|
||||
bool PatchResult = App.PatchEngine.Patch("SecureBootHack-MainOS");
|
||||
if (!PatchResult)
|
||||
throw new WPinternalsException("Patch failed");
|
||||
throw new WPinternalsException("Patch failed", "An error occured while patching Operating System files on the MainOS partition of your phone. Make sure your phone runs a supported Operating System version.");
|
||||
LogFile.Log("Fixed bootloader", LogType.FileAndConsole);
|
||||
LogFile.Log("The phone is left in Mass Storage mode", LogType.FileAndConsole);
|
||||
LogFile.Log("Press and hold the power-button of the phone for at least 10 seconds to reset the phone", LogType.FileAndConsole);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace WPinternals
|
||||
{
|
||||
// Create this class on the UI thread, after the main-window of the application is initialized.
|
||||
// It is necessary to create the object on the UI thread, because notification events to the View need to be fired on that thread.
|
||||
// The Model for this ViewModel communicates over USB and for that it uses the hWnd of the main window.
|
||||
// Therefore the main window must be created before the ViewModel is created.
|
||||
|
||||
internal class NokiaBootloaderViewModel : ContextViewModel
|
||||
{
|
||||
private NokiaFlashModel CurrentModel;
|
||||
private Action<PhoneInterfaces> RequestModeSwitch;
|
||||
internal Action SwitchToGettingStarted;
|
||||
private object LockDeviceInfo = new object();
|
||||
|
||||
internal NokiaBootloaderViewModel(NokiaPhoneModel CurrentModel, Action<PhoneInterfaces> RequestModeSwitch, Action SwitchToGettingStarted)
|
||||
: base()
|
||||
{
|
||||
this.CurrentModel = (NokiaFlashModel)CurrentModel;
|
||||
this.RequestModeSwitch = RequestModeSwitch;
|
||||
this.SwitchToGettingStarted = SwitchToGettingStarted;
|
||||
}
|
||||
|
||||
// Device info should be loaded only one time and only when the ViewModel is active
|
||||
internal override void EvaluateViewState()
|
||||
{
|
||||
if (IsActive)
|
||||
new Thread(() => StartLoadDeviceInfo()).Start();
|
||||
}
|
||||
|
||||
private void StartLoadDeviceInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void RebootTo(string Mode)
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case "Normal":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Normal);
|
||||
break;
|
||||
case "Label":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Label);
|
||||
break;
|
||||
case "MassStorage":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_MassStorage);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,6 +125,11 @@ namespace WPinternals
|
||||
Array.Copy(RawPublicID, 4, PublicID, 0, RawPublicID.Length - 4);
|
||||
LogFile.Log("Public ID: " + Converter.ConvertHexToString(PublicID, " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
PublicID = new byte[20];
|
||||
LogFile.Log("Public ID: " + Converter.ConvertHexToString(PublicID, " "));
|
||||
}
|
||||
RootKeyHash = CurrentModel.ReadParam("RRKH");
|
||||
if (RootKeyHash != null)
|
||||
LogFile.Log("Root Key Hash: " + Converter.ConvertHexToString(RootKeyHash, " "));
|
||||
@@ -153,50 +158,66 @@ namespace WPinternals
|
||||
|
||||
byte[] CID = CurrentModel.ReadParam("CID");
|
||||
byte[] EMS = CurrentModel.ReadParam("EMS");
|
||||
UInt16 MID = (UInt16)(((UInt16)CID[0] << 8) + CID[1]);
|
||||
UInt64 MemSize = (UInt64)(((UInt32)EMS[0] << 24) + ((UInt32)EMS[1] << 16) + ((UInt32)EMS[2] << 8) + EMS[3]) * 0x200;
|
||||
double MemSizeDouble = (double)MemSize / 1024 / 1024 / 1024;
|
||||
MemSizeDouble = (double)(int)(MemSizeDouble * 10) / 10;
|
||||
string Manufacturer = null;
|
||||
switch (MID)
|
||||
if (CID != null && EMS != null)
|
||||
{
|
||||
case 0x0002:
|
||||
case 0x0045:
|
||||
Manufacturer = "SanDisk";
|
||||
break;
|
||||
case 0x0011:
|
||||
Manufacturer = "Toshiba";
|
||||
break;
|
||||
case 0x0013:
|
||||
Manufacturer = "Micron";
|
||||
break;
|
||||
case 0x0015:
|
||||
Manufacturer = "Samsung";
|
||||
break;
|
||||
case 0x0090:
|
||||
Manufacturer = "Hynix";
|
||||
break;
|
||||
case 0x0070:
|
||||
Manufacturer = "Kingston";
|
||||
break;
|
||||
case 0x00EC:
|
||||
Manufacturer = "GigaDevice";
|
||||
break;
|
||||
UInt16 MID = (UInt16)(((UInt16)CID[0] << 8) + CID[1]);
|
||||
UInt64 MemSize = (UInt64)(((UInt32)EMS[0] << 24) + ((UInt32)EMS[1] << 16) + ((UInt32)EMS[2] << 8) + EMS[3]) * 0x200;
|
||||
double MemSizeDouble = (double)MemSize / 1024 / 1024 / 1024;
|
||||
MemSizeDouble = (double)(int)(MemSizeDouble * 10) / 10;
|
||||
string Manufacturer = null;
|
||||
switch (MID)
|
||||
{
|
||||
case 0x0002:
|
||||
case 0x0045:
|
||||
Manufacturer = "SanDisk";
|
||||
break;
|
||||
case 0x0011:
|
||||
Manufacturer = "Toshiba";
|
||||
break;
|
||||
case 0x0013:
|
||||
Manufacturer = "Micron";
|
||||
break;
|
||||
case 0x0015:
|
||||
Manufacturer = "Samsung";
|
||||
break;
|
||||
case 0x0090:
|
||||
Manufacturer = "Hynix";
|
||||
break;
|
||||
case 0x0070:
|
||||
Manufacturer = "Kingston";
|
||||
break;
|
||||
case 0x00EC:
|
||||
Manufacturer = "GigaDevice";
|
||||
break;
|
||||
}
|
||||
if (Manufacturer == null)
|
||||
eMMC = MemSizeDouble.ToString() + " GB";
|
||||
else
|
||||
eMMC = Manufacturer + " " + MemSizeDouble.ToString() + " GB";
|
||||
SamsungWarningVisible = (MID == 0x0015);
|
||||
}
|
||||
if (Manufacturer == null)
|
||||
eMMC = MemSizeDouble.ToString() + " GB";
|
||||
else
|
||||
eMMC = Manufacturer + " " + MemSizeDouble.ToString() + " GB";
|
||||
SamsungWarningVisible = (MID == 0x0015);
|
||||
{
|
||||
eMMC = "Unknown";
|
||||
SamsungWarningVisible = true;
|
||||
}
|
||||
|
||||
int chargecurrent = CurrentModel.ReadCurrentChargeCurrent().Value;
|
||||
int? chargecurrent = CurrentModel.ReadCurrentChargeCurrent();
|
||||
|
||||
if (chargecurrent < 0)
|
||||
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + ((-1) * CurrentModel.ReadCurrentChargeCurrent()) + " mA (discharging)";
|
||||
if (chargecurrent.HasValue)
|
||||
{
|
||||
if (chargecurrent < 0)
|
||||
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + ((-1) * CurrentModel.ReadCurrentChargeCurrent()) + " mA (discharging)";
|
||||
else
|
||||
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + CurrentModel.ReadCurrentChargeCurrent() + " mA (charging)";
|
||||
|
||||
LogFile.Log("Charging status: " + ChargingStatus);
|
||||
}
|
||||
else
|
||||
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + CurrentModel.ReadCurrentChargeCurrent() + " mA (charging)";
|
||||
|
||||
LogFile.Log("Charging status: " + ChargingStatus);
|
||||
{
|
||||
ChargingStatus = "Unknown";
|
||||
LogFile.Log("Charging status: " + ChargingStatus);
|
||||
}
|
||||
|
||||
PhoneInfo Info = CurrentModel.ReadPhoneInfo(true);
|
||||
if (Info.FlashAppProtocolVersionMajor < 2)
|
||||
@@ -210,6 +231,53 @@ namespace WPinternals
|
||||
|
||||
ProductType = Info.Type;
|
||||
LogFile.Log("ProductType: " + ProductType);
|
||||
|
||||
if (RootKeyHash == null)
|
||||
{
|
||||
LogFile.Log("Root Key Hash was null. Gathering information from an alternative source.");
|
||||
|
||||
RootKeyHash = Info.RKH;
|
||||
|
||||
if (RootKeyHash != null)
|
||||
LogFile.Log("Root Key Hash: " + Converter.ConvertHexToString(RootKeyHash, " "));
|
||||
else
|
||||
{
|
||||
RootKeyHash = new byte[32];
|
||||
LogFile.Log("Root Key Hash: " + Converter.ConvertHexToString(RootKeyHash, " "));
|
||||
}
|
||||
}
|
||||
|
||||
if (PlatformName == null)
|
||||
{
|
||||
LogFile.Log("Platform Name was null. Gathering information from an alternative source.");
|
||||
|
||||
PlatformName = Info.PlatformID;
|
||||
LogFile.Log("Platform Name: " + PlatformName);
|
||||
}
|
||||
|
||||
if (SecurityStatus == null)
|
||||
{
|
||||
LogFile.Log("Security Status was null. Gathering information from an alternative source.");
|
||||
|
||||
PlatformSecureBootStatus = Info.PlatformSecureBootEnabled;
|
||||
LogFile.Log("Platform Secure Boot Status: " + PlatformSecureBootStatus.ToString());
|
||||
UefiSecureBootStatus = Info.UefiSecureBootEnabled;
|
||||
LogFile.Log("Uefi Secure Boot Status: " + UefiSecureBootStatus.ToString());
|
||||
EffectiveSecureBootStatus = Info.PlatformSecureBootEnabled && Info.UefiSecureBootEnabled;
|
||||
LogFile.Log("Effective Secure Boot Status: " + EffectiveSecureBootStatus.ToString());
|
||||
|
||||
BootloaderSecurityQfuseStatus = Info.SecureFfuEnabled;
|
||||
LogFile.Log("Bootloader Security Qfuse Status: " + BootloaderSecurityQfuseStatus.ToString());
|
||||
BootloaderSecurityAuthenticationStatus = Info.Authenticated;
|
||||
LogFile.Log("Bootloader Security Authentication Status: " + BootloaderSecurityAuthenticationStatus.ToString());
|
||||
BootloaderSecurityRdcStatus = Info.RdcPresent;
|
||||
LogFile.Log("Bootloader Security Rdc Status: " + BootloaderSecurityRdcStatus.ToString());
|
||||
EffectiveBootloaderSecurityStatus = Info.SecureFfuEnabled && !Info.Authenticated && !Info.RdcPresent;
|
||||
LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString());
|
||||
|
||||
NativeDebugStatus = !Info.JtagDisabled;
|
||||
LogFile.Log("Native Debug Status: " + NativeDebugStatus.ToString());
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
// Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace WPinternals
|
||||
{
|
||||
internal class NokiaModeBootloaderViewModel : ContextViewModel
|
||||
{
|
||||
private NokiaFlashModel CurrentModel;
|
||||
Action<PhoneInterfaces?> RequestModeSwitch;
|
||||
private object LockDeviceInfo = new object();
|
||||
bool DeviceInfoLoaded = false;
|
||||
|
||||
internal NokiaModeBootloaderViewModel(NokiaPhoneModel CurrentModel, Action<PhoneInterfaces?> RequestModeSwitch)
|
||||
: base()
|
||||
{
|
||||
this.CurrentModel = (NokiaFlashModel)CurrentModel;
|
||||
this.RequestModeSwitch = RequestModeSwitch;
|
||||
}
|
||||
|
||||
internal override void EvaluateViewState()
|
||||
{
|
||||
if (IsActive)
|
||||
new Thread(() => StartLoadDeviceInfo()).Start();
|
||||
}
|
||||
|
||||
private bool? _EffectiveBootloaderSecurityStatus = null;
|
||||
public bool? EffectiveBootloaderSecurityStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EffectiveBootloaderSecurityStatus;
|
||||
}
|
||||
set
|
||||
{
|
||||
_EffectiveBootloaderSecurityStatus = value;
|
||||
OnPropertyChanged("EffectiveBootloaderSecurityStatus");
|
||||
}
|
||||
}
|
||||
|
||||
internal void StartLoadDeviceInfo()
|
||||
{
|
||||
lock (LockDeviceInfo)
|
||||
{
|
||||
if (!DeviceInfoLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
PhoneInfo Info = CurrentModel.ReadPhoneInfo();
|
||||
|
||||
if (Info.FlashAppProtocolVersionMajor < 2)
|
||||
{
|
||||
UefiSecurityStatusResponse SecurityStatus = CurrentModel.ReadSecurityStatus();
|
||||
|
||||
if (SecurityStatus != null)
|
||||
{
|
||||
EffectiveBootloaderSecurityStatus = SecurityStatus.SecureFfuEfuseStatus && !SecurityStatus.AuthenticationStatus && !SecurityStatus.RdcStatus;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EffectiveBootloaderSecurityStatus = Info.UefiSecureBootEnabled;
|
||||
}
|
||||
|
||||
LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
LogFile.Log("Reading status from Flash interface was aborted.");
|
||||
}
|
||||
DeviceInfoLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void RebootTo(string Mode)
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case "Normal":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Normal);
|
||||
break;
|
||||
case "Flash":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Flash);
|
||||
break;
|
||||
case "Label":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Label);
|
||||
break;
|
||||
case "MassStorage":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_MassStorage);
|
||||
break;
|
||||
case "Shutdown":
|
||||
RequestModeSwitch(null);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,10 @@ namespace WPinternals
|
||||
{
|
||||
EffectiveBootloaderSecurityStatus = SecurityStatus.SecureFfuEfuseStatus && !SecurityStatus.AuthenticationStatus && !SecurityStatus.RdcStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
EffectiveBootloaderSecurityStatus = Info.SecureFfuEnabled && !Info.Authenticated && !Info.RdcPresent;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -67,6 +67,9 @@ namespace WPinternals
|
||||
case "Flash":
|
||||
RequestModeSwitch(PhoneInterfaces.Lumia_Flash);
|
||||
break;
|
||||
case "Shutdown":
|
||||
RequestModeSwitch(null);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ namespace WPinternals
|
||||
NewDeviceArrived(new ArrivalEventArgs((PhoneInterfaces)CurrentInterface, CurrentModel));
|
||||
}
|
||||
else if ((e.DevicePath.IndexOf("VID_0421&PID_0661", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_06FC", StringComparison.OrdinalIgnoreCase) >= 0) || // VID_0421&PID_06FC is for Lumia 930
|
||||
(e.DevicePath.IndexOf("vid_045e&pid_0a00", StringComparison.OrdinalIgnoreCase) >= 0)) // vid_045e & pid_0a00 & mi_03 = Lumia 950 XL normal mode
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_06FC", StringComparison.OrdinalIgnoreCase) >= 0) || // VID_0421&PID_06FC is for Lumia 930
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A00", StringComparison.OrdinalIgnoreCase) >= 0)) // vid_045e & pid_0a00 & mi_03 = Lumia 950 XL normal mode
|
||||
{
|
||||
if (((USBNotifier)sender).Guid == OldCombiInterfaceGuid)
|
||||
{
|
||||
@@ -215,18 +215,16 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
else if ((e.DevicePath.IndexOf("VID_0421&PID_066E", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0714", StringComparison.OrdinalIgnoreCase) >= 0) || // VID_0421&PID_0714 is for Lumia 930
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A02", StringComparison.OrdinalIgnoreCase) >= 0)) // VID_045E&PID_0A02 is for Lumia 950
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0714", StringComparison.OrdinalIgnoreCase) >= 0) || // VID_0421&PID_0714 is for Lumia 930
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A02", StringComparison.OrdinalIgnoreCase) >= 0)) // VID_045E&PID_0A02 is for Lumia 950
|
||||
{
|
||||
CurrentModel = new NokiaFlashModel(e.DevicePath);
|
||||
((NokiaFlashModel)CurrentModel).InterfaceChanged += InterfaceChanged;
|
||||
|
||||
// Attempt to request a param.
|
||||
// When it succeeds we have full Flash mode.
|
||||
// When it fails we are in a limited Flash mode, like Bootmanager or Hardreset-screen.
|
||||
// Limited Flash mode only supports boot-commands; not querying info.
|
||||
byte[] QueryResult = ((NokiaFlashModel)CurrentModel).ReadParam("SS");
|
||||
if (QueryResult == null)
|
||||
FlashAppType type = ((NokiaFlashModel)CurrentModel).GetFlashAppType();
|
||||
LogFile.Log("Flash App Type: " + type.ToString(), LogType.FileOnly);
|
||||
|
||||
if (type == FlashAppType.BootManager)
|
||||
{
|
||||
CurrentInterface = PhoneInterfaces.Lumia_Bootloader;
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
@@ -235,6 +233,15 @@ namespace WPinternals
|
||||
LogFile.Log("Mode: Bootloader", LogType.FileAndConsole);
|
||||
NewDeviceArrived(new ArrivalEventArgs((PhoneInterfaces)CurrentInterface, CurrentModel));
|
||||
}
|
||||
else if (type == FlashAppType.PhoneInfoApp)
|
||||
{
|
||||
CurrentInterface = PhoneInterfaces.Lumia_Bootloader;
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
LogFile.Log("Device path: " + e.DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Connected device: Lumia", LogType.FileAndConsole);
|
||||
LogFile.Log("Mode: Bootloader (Phone Info)", LogType.FileAndConsole);
|
||||
NewDeviceArrived(new ArrivalEventArgs((PhoneInterfaces)CurrentInterface, CurrentModel));
|
||||
}
|
||||
else
|
||||
{
|
||||
((NokiaFlashModel)CurrentModel).DisableRebootTimeOut();
|
||||
@@ -246,8 +253,8 @@ namespace WPinternals
|
||||
NewDeviceArrived(new ArrivalEventArgs((PhoneInterfaces)CurrentInterface, CurrentModel));
|
||||
}
|
||||
}
|
||||
else if ((e.DevicePath.IndexOf(@"disk&ven_qualcomm&prod_mmc_storage", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf(@"DISK&VEN_MSFT&PROD_PHONE_MMC_STOR", StringComparison.OrdinalIgnoreCase) >= 0))
|
||||
else if ((e.DevicePath.IndexOf(@"DISK&VEN_QUALCOMM&PROD_MMC_STORAGE", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf(@"DISK&VEN_MSFT&PROD_PHONE_MMC_STOR", StringComparison.OrdinalIgnoreCase) >= 0))
|
||||
{
|
||||
#if DEBUG
|
||||
LogFile.Log("Mass storage arrived: " + e.DevicePath, LogType.FileOnly);
|
||||
@@ -266,11 +273,14 @@ namespace WPinternals
|
||||
{
|
||||
MassStorage NewModel = new MassStorage(e.DevicePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(Qcom9006DevicePath))
|
||||
NewModel.AttachQualcommSerial(Qcom9006DevicePath);
|
||||
|
||||
if (NewModel.Drive != null) // When logical drive is already known, we use this model. Or else we wait for the logical drive to arrive.
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Qcom9006DevicePath))
|
||||
{
|
||||
LogFile.Log("Found 9006 device previously on: " + Qcom9006DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Attaching 9006 device", LogType.FileOnly);
|
||||
NewModel.AttachQualcommSerial(Qcom9006DevicePath);
|
||||
}
|
||||
CurrentInterface = PhoneInterfaces.Lumia_MassStorage;
|
||||
CurrentModel = NewModel;
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
@@ -301,11 +311,14 @@ namespace WPinternals
|
||||
{
|
||||
MassStorage NewModel = new MassStorage(e.DevicePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(Qcom9006DevicePath))
|
||||
NewModel.AttachQualcommSerial(Qcom9006DevicePath);
|
||||
|
||||
if (NewModel.Drive != null) // When logical drive is already known, we use this model. Or else we wait for the logical drive to arrive.
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Qcom9006DevicePath))
|
||||
{
|
||||
LogFile.Log("Found 9006 device previously on: " + Qcom9006DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Attaching 9006 device", LogType.FileOnly);
|
||||
NewModel.AttachQualcommSerial(Qcom9006DevicePath);
|
||||
}
|
||||
CurrentInterface = PhoneInterfaces.Lumia_MassStorage;
|
||||
CurrentModel = NewModel;
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
@@ -355,12 +368,28 @@ namespace WPinternals
|
||||
// It is a slightly different version of the Qualcomm Emergency interface, which is implemented in SBL3.
|
||||
// One important difference is that the base address for sending a loader is not 0x2A000000, but it is 0x82F00000.
|
||||
|
||||
Qcom9006DevicePath = e.DevicePath;
|
||||
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
LogFile.Log("Device path: " + e.DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Device path: " + Qcom9006DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Connected device: Lumia", LogType.FileAndConsole);
|
||||
LogFile.Log("Mode: Qualcomm Emergency 9006", LogType.FileAndConsole);
|
||||
|
||||
Qcom9006DevicePath = e.DevicePath;
|
||||
if (CurrentModel is MassStorage)
|
||||
{
|
||||
LogFile.Log("Found Mass Storage device previously", LogType.FileOnly);
|
||||
LogFile.Log("Attaching 9006 device", LogType.FileOnly);
|
||||
((MassStorage)CurrentModel).AttachQualcommSerial(Qcom9006DevicePath);
|
||||
}
|
||||
}
|
||||
else if (e.DevicePath.IndexOf("VID_05C6&PID_F006", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
// This is part of the charging inteface.
|
||||
|
||||
LogFile.Log("Found device on interface: " + ((USBNotifier)sender).Guid.ToString(), LogType.FileOnly);
|
||||
LogFile.Log("Device path: " + e.DevicePath, LogType.FileOnly);
|
||||
LogFile.Log("Connected device: Lumia", LogType.FileAndConsole);
|
||||
LogFile.Log("Mode: Qualcomm Emergency Charging F006", LogType.FileAndConsole);
|
||||
}
|
||||
}
|
||||
catch (Exception Ex)
|
||||
@@ -386,14 +415,15 @@ namespace WPinternals
|
||||
if (
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0660&MI_04", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0713&MI_04", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A01&MI_04", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0661", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_06FC", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_066E", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_0421&PID_0714", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("vid_045e&pid_0a00", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A00", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_045E&PID_0A02", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf("VID_05C6&PID_9008", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf(@"disk&ven_qualcomm&prod_mmc_storage", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf(@"DISK&VEN_QUALCOMM&PROD_MMC_STORAGE", StringComparison.OrdinalIgnoreCase) >= 0) ||
|
||||
(e.DevicePath.IndexOf(@"DISK&VEN_MSFT&PROD_PHONE_MMC_STOR", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
)
|
||||
{
|
||||
|
||||
@@ -347,6 +347,12 @@ namespace WPinternals
|
||||
ModeSwitchProgressWrapper("Rebooting phone to Flash mode...", null);
|
||||
LogFile.Log("Rebooting phone to Flash mode...", LogType.FileAndConsole);
|
||||
break;
|
||||
case null:
|
||||
((MassStorage)CurrentModel).Reboot();
|
||||
PhoneNotifier.NewDeviceArrived += NewDeviceArrivedFromMassStorageMode;
|
||||
ModeSwitchProgressWrapper("First rebooting phone to Flash mode...", null);
|
||||
LogFile.Log("First rebooting phone to Bootloader mode...", LogType.FileAndConsole);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -389,6 +395,9 @@ namespace WPinternals
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ModeSwitchErrorWrapper("Failed to switch to Normal mode");
|
||||
break;
|
||||
case null:
|
||||
ModeSwitchSuccessWrapper();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -406,6 +415,9 @@ namespace WPinternals
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ModeSwitchErrorWrapper("Failed to switch to Normal mode");
|
||||
break;
|
||||
case null:
|
||||
ModeSwitchErrorWrapper("Failed to shutdown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -30,18 +30,19 @@ DEALINGS IN THE SOFTWARE.
|
||||
d:DesignWidth="700"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<BitmapImage x:Key="Busy" UriSource="..\aerobusy.gif" />
|
||||
<local:BooleanConverter x:Key="VisibilityConverter" OnTrue="Visible" OnFalse="Collapsed" OnNull="Collapsed"/>
|
||||
<local:BooleanConverter x:Key="InverseVisibilityConverter" OnTrue="Collapsed" OnFalse="Visible" OnNull="Collapsed" />
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="1" BorderBrush="#FFD4D4D4" HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="25">
|
||||
<StackPanel>
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,0,20,0" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" Margin="20,0,20,5" Height="50">
|
||||
<local:GifImage x:Name="GifImage" Stretch="None" Margin="0,0,10,0" Visibility="Collapsed"/>
|
||||
<Label x:Name="StatusText" Content="Waiting for connection with phone..." FontSize="20" VerticalContentAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Margin="20,0,20,0" VerticalScrollBarVisibility="Auto">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded">
|
||||
<local:Paragraph TextAlignment="Center">
|
||||
<Run Text="Waiting for connection with phone..." FontSize="20" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="When you connect the phone, it can take a moment before it is recognized. If it still isn't recognized after a while, you might need to install the necessary drivers first. For more information about the drivers, read the " />
|
||||
<Hyperlink NavigateUri="Getting started">Getting started</Hyperlink>
|
||||
<Run Text=" section. If the drivers are installed, but the phone is still not recognized, then try to perform a soft-reset, while the USB of the phone is connected. On Lumia phones you have to press-and-hold the power-button and volume-down-button at the same time for at least 10 seconds. If the tool detects the bootloader of the phone it will try to connect to the phone at this early boot-stage." />
|
||||
|
||||
+53
-6
@@ -19,6 +19,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -32,12 +33,39 @@ namespace WPinternals
|
||||
/// </summary>
|
||||
public partial class Empty : UserControl
|
||||
{
|
||||
static PhoneNotifierViewModel PhoneNotifier;
|
||||
static SynchronizationContext UIContext;
|
||||
|
||||
// Dependency injection is not possible here, because this ViewModel is used in a Style.
|
||||
public Empty()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
InterruptBoot = App.InterruptBoot;
|
||||
UIContext = SynchronizationContext.Current;
|
||||
|
||||
// Setting these properties in XAML results in an error. Why?
|
||||
GifImage.GifSource = @"/aerobusy.gif";
|
||||
GifImage.AutoStart = true;
|
||||
|
||||
Loaded += Empty_Loaded;
|
||||
Unloaded += Empty_Unloaded;
|
||||
}
|
||||
|
||||
private void Empty_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PhoneNotifier.NewDeviceArrived -= PhoneNotifier_NewDeviceArrived;
|
||||
}
|
||||
|
||||
private void Empty_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Find the phone notifier
|
||||
DependencyObject obj = (DependencyObject)sender;
|
||||
while (!(obj is MainWindow))
|
||||
obj = VisualTreeHelper.GetParent(obj);
|
||||
PhoneNotifier = ((MainViewModel)(((MainWindow)obj).DataContext)).PhoneNotifier;
|
||||
|
||||
PhoneNotifier.NewDeviceArrived += PhoneNotifier_NewDeviceArrived;
|
||||
}
|
||||
|
||||
private void HandleHyperlinkClick(object sender, RoutedEventArgs args)
|
||||
@@ -81,12 +109,6 @@ namespace WPinternals
|
||||
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
// Find the phone notifier
|
||||
DependencyObject obj = d;
|
||||
while (!(obj is MainWindow))
|
||||
obj = VisualTreeHelper.GetParent(obj);
|
||||
PhoneNotifierViewModel PhoneNotifier = ((MainViewModel)(((MainWindow)obj).DataContext)).PhoneNotifier;
|
||||
|
||||
if (PhoneNotifier.CurrentInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
App.InterruptBoot = false;
|
||||
@@ -95,5 +117,30 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void PhoneNotifier_NewDeviceArrived(ArrivalEventArgs Args)
|
||||
{
|
||||
if (App.InterruptBoot && Args.NewInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
App.InterruptBoot = false;
|
||||
LogFile.Log("Found Lumia BootMgr and user forced to interrupt the boot process. Force to Flash-mode.");
|
||||
Task.Run(() => SwitchModeViewModel.SwitchTo(PhoneNotifier, PhoneInterfaces.Lumia_Flash));
|
||||
}
|
||||
|
||||
UIContext.Send(s =>
|
||||
{
|
||||
if (!App.InterruptBoot && Args.NewInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
StatusText.Content = "Phone is booting...";
|
||||
GifImage.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (!App.InterruptBoot && Args.NewInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
StatusText.Content = "Waiting for connection with phone...";
|
||||
GifImage.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
<DataTemplate DataType="{x:Type local:NokiaNormalViewModel}">
|
||||
<local:NokiaNormalView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaBootloaderViewModel}">
|
||||
<local:NokiaBootloaderView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaFlashViewModel}">
|
||||
<local:NokiaFlashView />
|
||||
</DataTemplate>
|
||||
@@ -52,6 +55,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
<DataTemplate DataType="{x:Type local:NokiaModeFlashViewModel}">
|
||||
<local:NokiaModeFlashView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaModeBootloaderViewModel}">
|
||||
<local:NokiaModeBootloaderView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaModeLabelViewModel}">
|
||||
<local:NokiaModeLabelView />
|
||||
</DataTemplate>
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<UserControl x:Class="WPinternals.NokiaBootloaderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WPinternals"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="700">
|
||||
<UserControl.Resources>
|
||||
<BitmapImage x:Key="Busy" UriSource="..\aerobusy.gif" />
|
||||
<local:HexConverter x:Key="HexConverter" />
|
||||
<local:BooleanConverter x:Key="VisibilityConverter" OnTrue="Visible" OnFalse="Collapsed" OnNull="Collapsed"/>
|
||||
<local:BooleanConverter x:Key="InverseVisibilityConverter" OnTrue="Collapsed" OnFalse="Visible" OnNull="Collapsed" />
|
||||
<local:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter" />
|
||||
</UserControl.Resources>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<Border BorderThickness="1" BorderBrush="#FFD4D4D4" HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="25" Margin="0,0,0,20">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,0" VerticalScrollBarVisibility="Auto">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" PagePadding="1">
|
||||
<local:Paragraph>
|
||||
<Run Text="General info" FontSize="18" FontWeight="Bold" Foreground="#FF3753A6" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Grid IsHitTestVisible="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Platform name" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding PlatformName, Mode=OneWay}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Operating mode" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="Bootloader" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Product Type" Visibility="{Binding Path=ProductType, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding ProductType}" Visibility="{Binding Path=ProductType, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Product Code" Visibility="{Binding Path=ProductCode, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding ProductCode}" Visibility="{Binding Path=ProductCode, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Charging status" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding ChargingStatus}"/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="Storage" />
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding eMMC}"/>
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="Bootloader" />
|
||||
<TextBlock Grid.Row="6" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding BootloaderDescription}"/>
|
||||
</Grid>
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,0" VerticalScrollBarVisibility="Auto" Visibility="{Binding Path=SamsungWarningVisible, Converter={StaticResource VisibilityConverter}}">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" PagePadding="1">
|
||||
<local:Paragraph>
|
||||
<LineBreak />
|
||||
<local:CollapsibleRun Text="Read the " IsVisible="{Binding SamsungWarningVisible}" />
|
||||
<Hyperlink NavigateUri="GettingStarted">Getting started</Hyperlink>
|
||||
<Run Text=" section for important information about Samsung eMMC." />
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,0" VerticalScrollBarVisibility="Auto">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" PagePadding="1">
|
||||
<local:Paragraph>
|
||||
<LineBreak />
|
||||
<Run Text="To let the phone go back to Windows, boot to " />
|
||||
<Hyperlink NavigateUri="Normal">Normal</Hyperlink>
|
||||
<Run Text=" mode." />
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderThickness="1" BorderBrush="#FFD4D4D4" HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="25" Margin="0,0,0,20">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<local:GifImage x:Name="GifImage" Stretch="None"/>
|
||||
<Label Content="Phone is booting..." FontSize="20" Margin="10,0,0,0" VerticalContentAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderThickness="1" BorderBrush="#FFD4D4D4" HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="25">
|
||||
<Expander Header="Phone identity" HorizontalContentAlignment="Stretch" Template="{DynamicResource TopicExpanderTemplate}" Margin="20,0">
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" VerticalScrollBarVisibility="Auto" >
|
||||
<FlowDocument x:Name="Document" FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" PagePadding="1">
|
||||
<local:Paragraph>
|
||||
<LineBreak />
|
||||
<Grid IsHitTestVisible="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Root Key Hash" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=RootKeyHash, Converter={StaticResource HexConverter}, Mode=OneWay}" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Public Phone ID" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=PublicID, Converter={StaticResource HexConverter}, Mode=OneWay}" TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
</Expander>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace WPinternals
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for NokiaBootloaderView.xaml
|
||||
/// </summary>
|
||||
public partial class NokiaBootloaderView : UserControl
|
||||
{
|
||||
public NokiaBootloaderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Setting these properties in XAML results in an error. Why?
|
||||
GifImage.GifSource = @"/aerobusy.gif";
|
||||
GifImage.AutoStart = true;
|
||||
}
|
||||
|
||||
private void HandleHyperlinkClick(object sender, RoutedEventArgs args)
|
||||
{
|
||||
Hyperlink link = args.Source as Hyperlink;
|
||||
if ((link != null) && (link.NavigateUri != null))
|
||||
{
|
||||
if (link.NavigateUri.ToString() == "GettingStarted")
|
||||
(this.DataContext as NokiaBootloaderViewModel).SwitchToGettingStarted();
|
||||
|
||||
(this.DataContext as NokiaBootloaderViewModel).RebootTo(link.NavigateUri.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Document_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(sender as FlowDocument).AddHandler(Hyperlink.ClickEvent, new RoutedEventHandler(HandleHyperlinkClick));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<!--
|
||||
Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<UserControl x:Class="WPinternals.NokiaModeBootloaderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WPinternals"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="700">
|
||||
<UserControl.Resources>
|
||||
<local:BooleanConverter x:Key="VisibilityConverter" OnTrue="Visible" OnFalse="Collapsed" />
|
||||
<local:BooleanConverter x:Key="InvisibilityConverter" OnTrue="Collapsed" OnFalse="Visible" />
|
||||
<local:BooleanConverter x:Key="InverseConverter" OnTrue="False" OnFalse="True" />
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="1" BorderBrush="#FFD4D4D4" HorizontalAlignment="Stretch" VerticalAlignment="Center" Padding="25">
|
||||
<local:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,0,0,0" VerticalScrollBarVisibility="Auto" >
|
||||
<FlowDocument x:Name="Document" FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" TextAlignment="Left">
|
||||
<FlowDocument.Resources>
|
||||
<!-- This style is used to set the margins for all paragraphs in the FlowDocument to 0. -->
|
||||
<Style TargetType="{x:Type Paragraph}">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Section}">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
</FlowDocument.Resources>
|
||||
<local:Paragraph>
|
||||
<Run Text="Nokia Lumia - Switch mode" FontSize="18" FontWeight="Bold" Foreground="#FF3753A6" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Current mode: " />
|
||||
<Run Text="Bootloader" Foreground="#FF3753A6" FontWeight="Bold" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Hyperlink NavigateUri="Normal">Switch to Normal-mode</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This will switch back to Windows Phone OS." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Hyperlink NavigateUri="Label">Switch to Label-mode</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This interface is meant for querying and provisioning the phone. This is normally used for configuring the phone during manufacturing." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Hyperlink NavigateUri="MassStorage">Switch to Mass-Storage-mode</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This mode allows you to access the complete file-system of the phone. " />
|
||||
<local:CollapsibleRun IsVisible="{Binding EffectiveBootloaderSecurityStatus, Mode=OneWay}" Text="Your security flags indicate that this mode is prohibited on this phone."/>
|
||||
<local:CollapsibleRun IsVisible="{Binding EffectiveBootloaderSecurityStatus, Converter={StaticResource InverseConverter}, Mode=OneWay}" Text="Your security flags indicate the this mode can be accessed. But this switch will only succeed if you took all measures to unlock Mass Storage mode." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Hyperlink NavigateUri="Shutdown">Shutdown the phone</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This will shutdown your phone. After selecting this option, you'll need to unplug your phone from your computer." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 1: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="Once you've entered Mass Storage mode, be very careful with altering files. You can easily brick your phone, when you make invalid changes to the file-system of the phone." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 2: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="Before switching to Mass Storage Mode, verify that you do not have any other Windows Phone disks or partitions mounted. The partitions may have equal identifiers, which will result in a conflict. The phone partitions will be mounted "offline" and if you try to switch them "online" in the Disk Manager, it will corrupt the partitions on the phone. Unmount any Windows Phone partitions before you continue." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 3: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="Switching to Mass Storage mode should take about 10 seconds. Phones with Bootloader Spec A should be unlocked using an Engineering SBL3 to enable Mass Storage mode. When you unlocked the bootloader, but you did not use an Engineering SBL3, an attempt to boot to Mass Storage mode may result in an unresponsive state. Installing drivers for this interface may also cause to hang the PC. So when this switch is taking too long, you should reboot both the PC and the phone." />
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2018, Rene Lergner - wpinternals.net - @Heathcliff74xda
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace WPinternals
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for NokiaModeBootloaderView.xaml
|
||||
/// </summary>
|
||||
public partial class NokiaModeBootloaderView : UserControl
|
||||
{
|
||||
public NokiaModeBootloaderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void HandleHyperlinkClick(object sender, RoutedEventArgs args)
|
||||
{
|
||||
Hyperlink link = args.Source as Hyperlink;
|
||||
if (link != null)
|
||||
{
|
||||
(this.DataContext as NokiaModeBootloaderViewModel).RebootTo(link.NavigateUri.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Document_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(sender as FlowDocument).AddHandler(Hyperlink.ClickEvent, new RoutedEventHandler(HandleHyperlinkClick));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,27 @@ DEALINGS IN THE SOFTWARE.
|
||||
<Hyperlink NavigateUri="Flash">Switch to Flash-mode</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This is the interface that can be used to flash a new ROM image. It can also be used to retrieve additional info and security status." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Hyperlink NavigateUri="Shutdown">Shutdown the phone</Hyperlink>
|
||||
<LineBreak />
|
||||
<Run Text="This will shutdown your phone. After selecting this option, you'll need to unplug your phone from your computer." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 1: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="Be very careful with altering files. You can easily brick your phone, when you make invalid changes to the file-system of the phone." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 2: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="If you try to access a partition and it cannot be accessed, then DO NOT FORMAT IT! Also when you are asked to format it, DON'T DO THAT!" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 3: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="While in Mass Storage Mode the phone-battery will not charge. When battery is low, the phone will automatically reboot to Normal Mode." />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="Warning 4: " Foreground="Red" FontWeight="Bold"/>
|
||||
<Run Text="Never format or delete the boot-partitions! Take special care with the DPP partition. Do not format or delete this partition, bacause there is no known method to recover the phone after that (except with special equipment to access eMMC directly)." />
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
|
||||
@@ -928,6 +928,8 @@
|
||||
<Compile Include="ViewModels\BusyViewModel.cs" />
|
||||
<Compile Include="ViewModels\DisclaimerAndNdaViewModel.cs" />
|
||||
<Compile Include="ViewModels\DownloadsViewModel.cs" />
|
||||
<Compile Include="ViewModels\NokiaBootloaderViewModel.cs" />
|
||||
<Compile Include="ViewModels\NokiaModeBootloaderViewModel.cs" />
|
||||
<Compile Include="ViewModels\RegistrationViewModel.cs" />
|
||||
<Compile Include="ViewModels\DisclaimerViewModel.cs" />
|
||||
<Compile Include="ViewModels\DumpRomTargetSelectionViewModel.cs" />
|
||||
@@ -966,6 +968,12 @@
|
||||
<Compile Include="Views\DisclaimerAndNdaView.xaml.cs">
|
||||
<DependentUpon>DisclaimerAndNdaView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\NokiaBootloaderView.xaml.cs">
|
||||
<DependentUpon>NokiaBootloaderView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\NokiaModeBootloaderView.xaml.cs">
|
||||
<DependentUpon>NokiaModeBootloaderView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\RegistrationView.xaml.cs">
|
||||
<DependentUpon>RegistrationView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -1089,6 +1097,14 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\NokiaBootloaderView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\NokiaModeBootloaderView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\RegistrationView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user