mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
workaround older phone fw issues when retrieving via json rpc and gpt get function failures
This commit is contained in:
@@ -344,7 +344,8 @@ namespace WPinternals
|
|||||||
UInt16 Error = (UInt16)((Buffer[6] << 8) + Buffer[7]);
|
UInt16 Error = (UInt16)((Buffer[6] << 8) + Buffer[7]);
|
||||||
if (Error > 0)
|
if (Error > 0)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("ReadGPT: Error 0x" + Error.ToString("X4"));
|
ThrowFlashError(Error);
|
||||||
|
//throw new NotSupportedException("ReadGPT: Error 0x" + Error.ToString("X4"));
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Buffer.BlockCopy(Buffer, 8, GPTChunk, 0, 0x4400);
|
System.Buffer.BlockCopy(Buffer, 8, GPTChunk, 0, 0x4400);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace WPinternals
|
|||||||
bool ModernFlashApp = info.VersionMajor >= 2;
|
bool ModernFlashApp = info.VersionMajor >= 2;
|
||||||
|
|
||||||
byte[] Request = new byte[7];
|
byte[] Request = new byte[7];
|
||||||
ByteOperations.WriteAsciiString(Request, 0, SwitchModeSignature + "B");
|
ByteOperations.WriteAsciiString(Request, 0, $"{SwitchModeSignature}B");
|
||||||
byte[] Response = ExecuteRawMethod(Request);
|
byte[] Response = ExecuteRawMethod(Request);
|
||||||
if (ByteOperations.ReadAsciiString(Response, 0, 4) == "NOKU")
|
if (ByteOperations.ReadAsciiString(Response, 0, 4) == "NOKU")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ namespace WPinternals
|
|||||||
|
|
||||||
internal void FlashFFUTask(string FFUPath)
|
internal void FlashFFUTask(string FFUPath)
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
new Thread(async () =>
|
||||||
{
|
{
|
||||||
bool Result = true;
|
bool Result = true;
|
||||||
|
|
||||||
@@ -519,8 +519,35 @@ namespace WPinternals
|
|||||||
|
|
||||||
if (Info.FlashAppProtocolVersionMajor >= 2)
|
if (Info.FlashAppProtocolVersionMajor >= 2)
|
||||||
{
|
{
|
||||||
byte[] GPTChunk = Phone.GetGptChunk(0x20000); // TODO: Get proper profile FFU and get ChunkSizeInBytes
|
Phone.SwitchToBootManagerContext();
|
||||||
|
|
||||||
|
if (PhoneNotifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||||
|
{
|
||||||
|
await PhoneNotifier.WaitForArrival();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PhoneNotifier.CurrentInterface != PhoneInterfaces.Lumia_Bootloader)
|
||||||
|
{
|
||||||
|
throw new WPinternalsException("Unexpected Mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] GPTChunk = ((LumiaBootManagerAppModel)PhoneNotifier.CurrentModel).GetGptChunk(0x20000); // TODO: Get proper profile FFU and get ChunkSizeInBytes
|
||||||
GPT GPT = new(GPTChunk);
|
GPT GPT = new(GPTChunk);
|
||||||
|
|
||||||
|
((LumiaBootManagerAppModel)PhoneNotifier.CurrentModel).SwitchToFlashAppContext();
|
||||||
|
|
||||||
|
if (PhoneNotifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||||
|
{
|
||||||
|
await PhoneNotifier.WaitForArrival();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PhoneNotifier.CurrentInterface != PhoneInterfaces.Lumia_Flash)
|
||||||
|
{
|
||||||
|
throw new WPinternalsException("Unexpected Mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
Phone = (LumiaFlashAppModel)PhoneNotifier.CurrentModel;
|
||||||
|
|
||||||
FlashPart Part;
|
FlashPart Part;
|
||||||
List<FlashPart> FlashParts = new();
|
List<FlashPart> FlashParts = new();
|
||||||
|
|
||||||
|
|||||||
@@ -67,17 +67,35 @@ namespace WPinternals
|
|||||||
|
|
||||||
LogFile.Log("IMEI: " + IMEI);
|
LogFile.Log("IMEI: " + IMEI);
|
||||||
PublicID = CurrentModel.ExecuteJsonMethodAsBytes("ReadPublicId", "PublicId"); // 0x14 bytes: a5 e5 ...
|
PublicID = CurrentModel.ExecuteJsonMethodAsBytes("ReadPublicId", "PublicId"); // 0x14 bytes: a5 e5 ...
|
||||||
LogFile.Log("Public ID: " + Converter.ConvertHexToString(PublicID, " "));
|
if (PublicID != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("Public ID: " + Converter.ConvertHexToString(PublicID, " "));
|
||||||
|
}
|
||||||
BluetoothMac = CurrentModel.ExecuteJsonMethodAsBytes("ReadBtId", "BtId"); // 6 bytes: bc c6 ...
|
BluetoothMac = CurrentModel.ExecuteJsonMethodAsBytes("ReadBtId", "BtId"); // 6 bytes: bc c6 ...
|
||||||
LogFile.Log("Bluetooth MAC: " + Converter.ConvertHexToString(BluetoothMac, " "));
|
if (BluetoothMac != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("Bluetooth MAC: " + Converter.ConvertHexToString(BluetoothMac, " "));
|
||||||
|
}
|
||||||
WlanMac1 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress1"); // 6 bytes
|
WlanMac1 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress1"); // 6 bytes
|
||||||
LogFile.Log("WLAN MAC 1: " + Converter.ConvertHexToString(WlanMac1, " "));
|
if (WlanMac1 != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("WLAN MAC 1: " + Converter.ConvertHexToString(WlanMac1, " "));
|
||||||
|
}
|
||||||
WlanMac2 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress2"); // 6 bytes
|
WlanMac2 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress2"); // 6 bytes
|
||||||
LogFile.Log("WLAN MAC 2: " + Converter.ConvertHexToString(WlanMac2, " "));
|
if (WlanMac2 != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("WLAN MAC 2: " + Converter.ConvertHexToString(WlanMac2, " "));
|
||||||
|
}
|
||||||
WlanMac3 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress3"); // 6 bytes
|
WlanMac3 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress3"); // 6 bytes
|
||||||
LogFile.Log("WLAN MAC 3: " + Converter.ConvertHexToString(WlanMac3, " "));
|
if (WlanMac3 != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("WLAN MAC 3: " + Converter.ConvertHexToString(WlanMac3, " "));
|
||||||
|
}
|
||||||
WlanMac4 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress4"); // 6 bytes
|
WlanMac4 = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress4"); // 6 bytes
|
||||||
LogFile.Log("WLAN MAC 4: " + Converter.ConvertHexToString(WlanMac4, " "));
|
if (WlanMac4 != null)
|
||||||
|
{
|
||||||
|
LogFile.Log("WLAN MAC 4: " + Converter.ConvertHexToString(WlanMac4, " "));
|
||||||
|
}
|
||||||
|
|
||||||
bool? ProductionDone = CurrentModel.ExecuteJsonMethodAsBoolean("ReadProductionDoneState", "ProductionDone");
|
bool? ProductionDone = CurrentModel.ExecuteJsonMethodAsBoolean("ReadProductionDoneState", "ProductionDone");
|
||||||
IsBootloaderSecurityEnabled = ProductionDone == null
|
IsBootloaderSecurityEnabled = ProductionDone == null
|
||||||
|
|||||||
Reference in New Issue
Block a user