mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
fix: PhoneInfo app handling + label parsing issues
This commit is contained in:
@@ -952,8 +952,11 @@ namespace WPinternals
|
||||
case 0x01:
|
||||
Result.TransferSize = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
break;
|
||||
case 0x1F:
|
||||
Result.MmosOverUsbSupported = Response[SubblockPayloadOffset] == 1;
|
||||
case 0x02:
|
||||
Result.WriteBufferSize = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
break;
|
||||
case 0x03:
|
||||
Result.EmmcSizeInSectors = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
break;
|
||||
case 0x04:
|
||||
if (Result.App == FlashAppType.BootManager)
|
||||
@@ -968,12 +971,6 @@ namespace WPinternals
|
||||
Result.SdCardSizeInSectors = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
Result.WriteBufferSize = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
break;
|
||||
case 0x03:
|
||||
Result.EmmcSizeInSectors = BigEndian.ToUInt32(Response, SubblockPayloadOffset);
|
||||
break;
|
||||
case 0x05:
|
||||
Result.PlatformID = ByteOperations.ReadAsciiString(Response, (uint)SubblockPayloadOffset, SubblockLength).Trim([' ', '\0']);
|
||||
break;
|
||||
@@ -994,6 +991,9 @@ namespace WPinternals
|
||||
SubblockVersion = Response[SubblockPayloadOffset]; // 0x01
|
||||
Result.SecureFfuSupportedProtocolMask = BigEndian.ToUInt16(Response, SubblockPayloadOffset + 0x01);
|
||||
break;
|
||||
case 0x1F:
|
||||
Result.MmosOverUsbSupported = Response[SubblockPayloadOffset] == 1;
|
||||
break;
|
||||
case 0x20:
|
||||
// CRC header info
|
||||
break;
|
||||
@@ -1154,7 +1154,7 @@ namespace WPinternals
|
||||
|
||||
//DisableRebootTimeOut();
|
||||
Info.App = FlashAppType.PhoneInfoApp;
|
||||
InterfaceChanged(PhoneInterfaces.Lumia_Bootloader);
|
||||
InterfaceChanged(PhoneInterfaces.Lumia_PhoneInfo);
|
||||
}
|
||||
|
||||
internal void SwitchAwayToPhoneInfoAppContextLegacy()
|
||||
@@ -1164,8 +1164,33 @@ namespace WPinternals
|
||||
ExecuteRawVoidMethod(Request);
|
||||
|
||||
//DisableRebootTimeOut();
|
||||
//Info.App = FlashAppType.FlashApp;
|
||||
//InterfaceChanged(PhoneInterfaces.Lumia_Flash);
|
||||
Info.App = FlashAppType.FlashApp;
|
||||
InterfaceChanged(PhoneInterfaces.Lumia_Flash);
|
||||
}
|
||||
|
||||
internal string GetPhoneInfo()
|
||||
{
|
||||
// NOKH = Get Phone Info (IMEI and info from Product.dat) - Not available on some phones, like Lumia 640.
|
||||
// NOKV = Info Query
|
||||
|
||||
if (Info.FlashAppProtocolVersionMajor >= 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] Request = new byte[4];
|
||||
ByteOperations.WriteAsciiString(Request, 0, "NOKH");
|
||||
byte[] Response = ExecuteRawMethod(Request);
|
||||
if ((Response == null) || (ByteOperations.ReadAsciiString(Response, 0, 4) == "NOKU"))
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
UInt16 Length = BigEndian.ToUInt16(Response, 0x04);
|
||||
|
||||
string PhoneInfoData = ByteOperations.ReadAsciiString(Response, 0x8, Length);
|
||||
|
||||
return PhoneInfoData;
|
||||
}
|
||||
|
||||
internal void SwitchToFlashAppContext()
|
||||
|
||||
@@ -70,6 +70,9 @@ namespace WPinternals
|
||||
ActivateSubContext(null);
|
||||
//ActivateSubContext(new NokiaBootloaderViewModel((NokiaFlashModel)CurrentModel, ModeSwitchRequestCallback, SwitchToGettingStarted));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_PhoneInfo:
|
||||
ActivateSubContext(new NokiaPhoneInfoViewModel((NokiaFlashModel)CurrentModel, ModeSwitchRequestCallback, SwitchToGettingStarted));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ActivateSubContext(new NokiaNormalViewModel((NokiaPhoneModel)CurrentModel, ModeSwitchRequestCallback));
|
||||
break;
|
||||
|
||||
@@ -90,6 +90,9 @@ namespace WPinternals
|
||||
ActivateSubContext(null);
|
||||
//ActivateSubContext(new NokiaModeBootloaderViewModel((NokiaFlashModel)CurrentModel, OnModeSwitchRequested));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_PhoneInfo:
|
||||
ActivateSubContext(new NokiaModePhoneInfoViewModel((NokiaFlashModel)CurrentModel, OnModeSwitchRequested));
|
||||
break;
|
||||
case PhoneInterfaces.Lumia_Normal:
|
||||
ActivateSubContext(new NokiaModeNormalViewModel((NokiaPhoneModel)CurrentModel, OnModeSwitchRequested));
|
||||
break;
|
||||
|
||||
@@ -45,7 +45,8 @@ namespace WPinternals
|
||||
Lumia_Bootloader,
|
||||
Qualcomm_Download,
|
||||
Qualcomm_Flash,
|
||||
Lumia_BadMassStorage
|
||||
Lumia_BadMassStorage,
|
||||
Lumia_PhoneInfo
|
||||
};
|
||||
|
||||
// Create this class on the UI thread, after the main-window of the application is initialized.
|
||||
|
||||
@@ -101,11 +101,20 @@ namespace WPinternals
|
||||
IMEI = CurrentModel.ExecuteJsonMethodAsString("ReadSerialNumber", "SerialNumber"); // IMEI
|
||||
LogFile.Log("IMEI: " + IMEI);
|
||||
BluetoothMac = CurrentModel.ExecuteJsonMethodAsBytes("ReadBtId", "BtId"); // 6 bytes: bc c6 ...
|
||||
LogFile.Log("Bluetooth MAC: " + Converter.ConvertHexToString(BluetoothMac, " "));
|
||||
WlanMac = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress1"); // 6 bytes
|
||||
LogFile.Log("WLAN MAC: " + Converter.ConvertHexToString(WlanMac, " "));
|
||||
|
||||
IsBootloaderSecurityEnabled = (bool)CurrentModel.ExecuteJsonMethodAsBoolean("ReadProductionDoneState", "ProductionDone");
|
||||
if (BluetoothMac != null)
|
||||
{
|
||||
LogFile.Log("Bluetooth MAC: " + Converter.ConvertHexToString(BluetoothMac, " "));
|
||||
}
|
||||
|
||||
WlanMac = CurrentModel.ExecuteJsonMethodAsBytes("ReadWlanMacAddress", "WlanMacAddress1"); // 6 bytes
|
||||
|
||||
if (WlanMac != null)
|
||||
{
|
||||
LogFile.Log("WLAN MAC: " + Converter.ConvertHexToString(WlanMac, " "));
|
||||
}
|
||||
|
||||
IsBootloaderSecurityEnabled = CurrentModel.ExecuteJsonMethodAsBoolean("ReadProductionDoneState", "ProductionDone") ?? false;
|
||||
LogFile.Log("Bootloader Security: " + ((bool)IsBootloaderSecurityEnabled ? "Enabled" : "Disabled"));
|
||||
|
||||
Params = new Dictionary<string, object>
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
// Copyright (c) 2018, Rene Lergner - @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 NokiaModePhoneInfoViewModel : ContextViewModel
|
||||
{
|
||||
private readonly NokiaFlashModel CurrentModel;
|
||||
private readonly Action<PhoneInterfaces?> RequestModeSwitch;
|
||||
private readonly object LockDeviceInfo = new();
|
||||
private bool DeviceInfoLoaded = false;
|
||||
|
||||
internal NokiaModePhoneInfoViewModel(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? _EffectivePhoneInfoSecurityStatus = null;
|
||||
public bool? EffectivePhoneInfoSecurityStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EffectivePhoneInfoSecurityStatus;
|
||||
}
|
||||
set
|
||||
{
|
||||
_EffectivePhoneInfoSecurityStatus = value;
|
||||
OnPropertyChanged(nameof(EffectivePhoneInfoSecurityStatus));
|
||||
}
|
||||
}
|
||||
|
||||
internal void StartLoadDeviceInfo()
|
||||
{
|
||||
lock (LockDeviceInfo)
|
||||
{
|
||||
if (!DeviceInfoLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
PhoneInfo Info = CurrentModel.ReadPhoneInfo();
|
||||
|
||||
if (Info.FlashAppProtocolVersionMajor < 2)
|
||||
{
|
||||
UefiSecurityStatusResponse SecurityStatus = CurrentModel.ReadSecurityStatus();
|
||||
|
||||
if (SecurityStatus != null)
|
||||
{
|
||||
EffectivePhoneInfoSecurityStatus = SecurityStatus.SecureFfuEfuseStatus && !SecurityStatus.AuthenticationStatus && !SecurityStatus.RdcStatus;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EffectivePhoneInfoSecurityStatus = Info.UefiSecureBootEnabled;
|
||||
}
|
||||
|
||||
LogFile.Log("Effective PhoneInfo Security Status: " + EffectivePhoneInfoSecurityStatus.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) 2018, Rene Lergner - @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.Collections.Generic;
|
||||
using System.Linq;
|
||||
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 NokiaPhoneInfoViewModel : ContextViewModel
|
||||
{
|
||||
private readonly NokiaFlashModel CurrentModel;
|
||||
private readonly Action<PhoneInterfaces> RequestModeSwitch;
|
||||
internal Action SwitchToGettingStarted;
|
||||
private readonly object LockDeviceInfo = new();
|
||||
private bool DeviceInfoLoaded = false;
|
||||
|
||||
internal NokiaPhoneInfoViewModel(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()
|
||||
{
|
||||
lock (LockDeviceInfo)
|
||||
{
|
||||
if (!DeviceInfoLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Version: 1.1.1.3
|
||||
* TYPE: RM-885
|
||||
* BTR: 059R0M0
|
||||
* LPSN: ...
|
||||
* HWID: 1000
|
||||
* CTR: 059S4B1
|
||||
* MC: 0205354
|
||||
* IMEI: ...
|
||||
*/
|
||||
string PhoneInfoData = CurrentModel.GetPhoneInfo();
|
||||
if (!string.IsNullOrEmpty(PhoneInfoData))
|
||||
{
|
||||
string[] Variables = PhoneInfoData.Split("\n");
|
||||
Dictionary<string, string> FormattedVariables = [];
|
||||
foreach (string Variable in Variables)
|
||||
{
|
||||
if (!Variable.Contains(":"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FormattedVariables.Add(Variable.Split(":")[0].Trim(), Variable.Split(":")[1].Trim());
|
||||
}
|
||||
|
||||
HWID = FormattedVariables["HWID"];
|
||||
LogFile.Log("HWID: " + HWID);
|
||||
}
|
||||
|
||||
PhoneInfo Info = CurrentModel.ReadPhoneInfo(true);
|
||||
BootloaderDescription = Info.FlashAppProtocolVersionMajor < 2 ? "Lumia Bootloader Spec A" : "Lumia Bootloader Spec B";
|
||||
|
||||
LogFile.Log("Bootloader: " + BootloaderDescription);
|
||||
|
||||
ProductCode = Info.ProductCode;
|
||||
LogFile.Log("ProductCode: " + ProductCode);
|
||||
|
||||
ProductType = Info.Type;
|
||||
LogFile.Log("ProductType: " + ProductType);
|
||||
|
||||
IMEI = Info.Imei;
|
||||
LogFile.Log("IMEI: " + ProductType);
|
||||
}
|
||||
catch
|
||||
{
|
||||
LogFile.Log("Reading status from Flash interface was aborted.");
|
||||
}
|
||||
DeviceInfoLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _ProductType = null;
|
||||
public string ProductType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ProductType;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ProductType = value;
|
||||
OnPropertyChanged(nameof(ProductType));
|
||||
}
|
||||
}
|
||||
|
||||
private string _ProductCode = null;
|
||||
public string ProductCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ProductCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ProductCode = value;
|
||||
OnPropertyChanged(nameof(ProductCode));
|
||||
}
|
||||
}
|
||||
|
||||
private string _BootloaderDescription = null;
|
||||
public string BootloaderDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BootloaderDescription;
|
||||
}
|
||||
set
|
||||
{
|
||||
_BootloaderDescription = value;
|
||||
OnPropertyChanged(nameof(BootloaderDescription));
|
||||
}
|
||||
}
|
||||
|
||||
private string _HWID = null;
|
||||
public string HWID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _HWID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_HWID = value;
|
||||
OnPropertyChanged(nameof(HWID));
|
||||
}
|
||||
}
|
||||
|
||||
private string _IMEI = null;
|
||||
public string IMEI
|
||||
{
|
||||
get
|
||||
{
|
||||
return _IMEI;
|
||||
}
|
||||
set
|
||||
{
|
||||
_IMEI = value;
|
||||
OnPropertyChanged(nameof(IMEI));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,8 @@ namespace WPinternals
|
||||
}
|
||||
case FlashAppType.PhoneInfoApp:
|
||||
{
|
||||
CurrentInterface = PhoneInterfaces.Lumia_Bootloader;
|
||||
((NokiaFlashModel)CurrentModel).DisableRebootTimeOut();
|
||||
CurrentInterface = PhoneInterfaces.Lumia_PhoneInfo;
|
||||
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);
|
||||
|
||||
@@ -37,6 +37,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
<DataTemplate DataType="{x:Type local:NokiaBootloaderViewModel}">
|
||||
<local:NokiaBootloaderView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaPhoneInfoViewModel}">
|
||||
<local:NokiaPhoneInfoView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaFlashViewModel}">
|
||||
<local:NokiaFlashView />
|
||||
</DataTemplate>
|
||||
@@ -58,6 +61,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
<DataTemplate DataType="{x:Type local:NokiaModeBootloaderViewModel}">
|
||||
<local:NokiaModeBootloaderView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaModePhoneInfoViewModel}">
|
||||
<local:NokiaModePhoneInfoView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:NokiaModeLabelViewModel}">
|
||||
<local:NokiaModeLabelView />
|
||||
</DataTemplate>
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<!--
|
||||
Copyright (c) 2018, Rene Lergner - @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.NokiaModePhoneInfoView"
|
||||
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 (Phone Info)" 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,50 @@
|
||||
// Copyright (c) 2018, Rene Lergner - @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 NokiaModePhoneInfoView.xaml
|
||||
/// </summary>
|
||||
public partial class NokiaModePhoneInfoView : UserControl
|
||||
{
|
||||
public NokiaModePhoneInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void HandleHyperlinkClick(object sender, RoutedEventArgs args)
|
||||
{
|
||||
if (args.Source is Hyperlink link)
|
||||
{
|
||||
(this.DataContext as NokiaModePhoneInfoViewModel)?.RebootTo(link.NavigateUri.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Document_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(sender as FlowDocument)?.AddHandler(Hyperlink.ClickEvent, new RoutedEventHandler(HandleHyperlinkClick));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<!--
|
||||
Copyright (c) 2018, Rene Lergner - @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.NokiaPhoneInfoView"
|
||||
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 Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Operating mode" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="Bootloader (Phone Info)" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Product Type" Visibility="{Binding Path=ProductType, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding ProductType}" Visibility="{Binding Path=ProductType, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Product Code" Visibility="{Binding Path=ProductCode, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding ProductCode}" Visibility="{Binding Path=ProductCode, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Hardware version" Visibility="{Binding Path=HWID, Converter={StaticResource ObjectToVisibilityConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" FontWeight="Bold" Foreground="#FF3753A6" TextWrapping="Wrap" Text="{Binding Path=HWID}" Visibility="{Binding Path=HWID, Converter={StaticResource ObjectToVisibilityConverter}}" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Bootloader" />
|
||||
<TextBlock Grid.Row="4" 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">
|
||||
<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 />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="IMEI" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=IMEI}" TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</local:Paragraph>
|
||||
</FlowDocument>
|
||||
</local:FlowDocumentScrollViewerNoMouseWheel>
|
||||
</Expander>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2018, Rene Lergner - @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 NokiaPhoneInfoView.xaml
|
||||
/// </summary>
|
||||
public partial class NokiaPhoneInfoView : UserControl
|
||||
{
|
||||
public NokiaPhoneInfoView()
|
||||
{
|
||||
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?.NavigateUri != null)
|
||||
{
|
||||
if (link.NavigateUri.ToString() == "GettingStarted")
|
||||
{
|
||||
(this.DataContext as NokiaPhoneInfoViewModel)?.SwitchToGettingStarted();
|
||||
} (this.DataContext as NokiaPhoneInfoViewModel)?.RebootTo(link.NavigateUri.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Document_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(sender as FlowDocument)?.AddHandler(Hyperlink.ClickEvent, new RoutedEventHandler(HandleHyperlinkClick));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,4 +114,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Preview-Test|AnyCPU'">
|
||||
<StartArguments>/Test</StartArguments>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Views\NokiaModePhoneInfoView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user