mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
Fixed an issue regarding ACLs and Sahara handling
This commit is contained in:
@@ -155,7 +155,8 @@ namespace WPinternals
|
||||
FlowDirection.LeftToRight,
|
||||
new Typeface(PathTextBlock.FontFamily, PathTextBlock.FontStyle, PathTextBlock.FontWeight, PathTextBlock.FontStretch),
|
||||
FontSize,
|
||||
Foreground
|
||||
Foreground,
|
||||
100 / 96
|
||||
);
|
||||
|
||||
resultSize.Height = formatted.Height;
|
||||
@@ -175,7 +176,8 @@ namespace WPinternals
|
||||
FlowDirection.LeftToRight,
|
||||
new Typeface(CaptionTextBlock.FontFamily, CaptionTextBlock.FontStyle, CaptionTextBlock.FontWeight, CaptionTextBlock.FontStretch),
|
||||
FontSize,
|
||||
Foreground
|
||||
Foreground,
|
||||
100 / 96
|
||||
);
|
||||
double CaptionWidth = formatted.Width;
|
||||
if (CaptionWidth > 0)
|
||||
@@ -203,7 +205,8 @@ namespace WPinternals
|
||||
FlowDirection.LeftToRight,
|
||||
new Typeface(PathTextBlock.FontFamily, PathTextBlock.FontStyle, PathTextBlock.FontWeight, PathTextBlock.FontStretch),
|
||||
FontSize,
|
||||
Foreground
|
||||
Foreground,
|
||||
100 / 96
|
||||
);
|
||||
|
||||
if (NewWidth < 0)
|
||||
@@ -275,7 +278,8 @@ namespace WPinternals
|
||||
FlowDirection.LeftToRight,
|
||||
new Typeface(PathTextBlock.FontFamily, PathTextBlock.FontStyle, PathTextBlock.FontWeight, PathTextBlock.FontStretch),
|
||||
FontSize,
|
||||
Foreground
|
||||
Foreground,
|
||||
100 / 96
|
||||
);
|
||||
|
||||
widthOK = formatted.Width < MaxWidth;
|
||||
|
||||
@@ -267,10 +267,8 @@ namespace WPinternals
|
||||
public static extern bool DeviceIoControl(
|
||||
IntPtr hDevice,
|
||||
uint IoControlCode,
|
||||
[MarshalAs(UnmanagedType.AsAny)]
|
||||
[In] object InBuffer,
|
||||
uint nInBufferSize,
|
||||
[MarshalAs(UnmanagedType.AsAny)]
|
||||
[Out] object OutBuffer,
|
||||
uint nOutBufferSize,
|
||||
ref uint pBytesReturned,
|
||||
|
||||
+10
-4
@@ -413,6 +413,8 @@ namespace WPinternals
|
||||
{
|
||||
if (FilePath.Contains(':'))
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(FilePath);
|
||||
|
||||
// Enable Take Ownership AND Restore ownership to original owner
|
||||
// Take Ownership Privilge is not enough.
|
||||
// We need Restore Privilege.
|
||||
@@ -427,17 +429,18 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
// Backup original owner and ACL
|
||||
|
||||
OriginalACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
OriginalACL = fileInfo.GetAccessControl();
|
||||
|
||||
// And take the original security to create new security rules.
|
||||
FileSecurity NewACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
FileSecurity NewACL = fileInfo.GetAccessControl();
|
||||
|
||||
// Take ownership
|
||||
NewACL.SetOwner(WindowsIdentity.GetCurrent().User);
|
||||
fileInfo.SetAccessControl(NewACL);
|
||||
|
||||
// And create a new access rule
|
||||
NewACL.SetAccessRule(new FileSystemAccessRule(WindowsIdentity.GetCurrent().User, FileSystemRights.FullControl, AccessControlType.Allow));
|
||||
fileInfo.SetAccessControl(NewACL);
|
||||
|
||||
// Open the file for patching
|
||||
Stream = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite);
|
||||
@@ -457,10 +460,13 @@ namespace WPinternals
|
||||
|
||||
if (FilePath.Contains(':'))
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(FilePath);
|
||||
|
||||
// Restore original owner and access rules.
|
||||
// The OriginalACL cannot be reused directly.
|
||||
FileSecurity NewACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
FileSecurity NewACL = fileInfo.GetAccessControl();
|
||||
NewACL.SetSecurityDescriptorBinaryForm(OriginalACL.GetSecurityDescriptorBinaryForm());
|
||||
fileInfo.SetAccessControl(NewACL);
|
||||
|
||||
// Revert to self
|
||||
RestorePrivilege.Revert();
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace WPinternals
|
||||
{
|
||||
LogFile.Log("Problem while starting programmer. Attempting again.", LogType.FileAndConsole);
|
||||
}
|
||||
} while (!Started || count >= 3);
|
||||
} while (!Started || count < 3);
|
||||
if (count >= 3 && !Started)
|
||||
{
|
||||
LogFile.Log("Maximum number of attempts to start the programmer exceeded.", LogType.FileAndConsole);
|
||||
|
||||
+12
-10
@@ -48,16 +48,18 @@ DEALINGS IN THE SOFTWARE.
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
<TextBlock TextAlignment="Center" HorizontalAlignment="Center" Text="{Binding SubMessage}" Visibility="{Binding Path=SubMessage, Converter={StaticResource ObjectToVisibilityConverter}}" Margin="0,10,0,0" TextWrapping="WrapWithOverflow" />
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0" Visibility="{Binding Path=ShowRebootHelp, Converter={StaticResource VisibilityConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="RebootImage" Source="pack://application:,,,/PhoneReboot.png" Height="200"/>
|
||||
<StackPanel Margin="20,0,0,0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock TextAlignment="Center" HorizontalAlignment="Center" Text="To reboot your device manually, press the power and volume down button as shown in the picture at the same time until the phone vibrates, then release both buttons. The phone will get automatically detected by the tool and the process will continue where it left off." TextWrapping="WrapWithOverflow" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Expander Header="Reboot instructions" HorizontalContentAlignment="Stretch" Template="{DynamicResource TopicExpanderTemplate}" Margin="20,10,20,0" Visibility="{Binding Path=ShowRebootHelp, Converter={StaticResource VisibilityConverter}}">
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="RebootImage" Source="pack://application:,,,/PhoneReboot.png" Height="200"/>
|
||||
<StackPanel Margin="20,0,0,0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock TextAlignment="Center" HorizontalAlignment="Center" Text="To reboot your device manually, press the power and volume down button as shown in the picture at the same time until the phone vibrates, then release both buttons. The phone will get automatically detected by the tool and the process will continue where it left off." TextWrapping="WrapWithOverflow" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="3.0.0-preview7.19362.9" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="3.1.0" />
|
||||
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0-preview7.19362.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>G:\Projects\WPinternals\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
<_LastSelectedProfileId>M:\Projects\WPinternals\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="App.xaml">
|
||||
|
||||
Reference in New Issue
Block a user