mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-15 03:46:40 +10:00
Code update
- WPinternals is now a .NET Core 3.0 application - Implemented new unlock process for Spec A devices - Updated logic for unlocking Spec B devices - Implemented MMOS support for Spec B devices - Implemented battery status in Flash Mode - Implemented Fuse configuration information in Flash Mode - Implemented Reboot from mass storage for Spec A and some Spec B devices - Implemented shutdown from flash mode (preliminary) - Fixed label mode support for Spec B
This commit is contained in:
@@ -427,18 +427,17 @@ namespace WPinternals
|
||||
}
|
||||
|
||||
// Backup original owner and ACL
|
||||
OriginalACL = File.GetAccessControl(FilePath);
|
||||
|
||||
OriginalACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
|
||||
// And take the original security to create new security rules.
|
||||
FileSecurity NewACL = File.GetAccessControl(FilePath);
|
||||
FileSecurity NewACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
|
||||
// Take ownership
|
||||
NewACL.SetOwner(WindowsIdentity.GetCurrent().User);
|
||||
File.SetAccessControl(FilePath, NewACL);
|
||||
|
||||
// And create a new access rule
|
||||
NewACL.SetAccessRule(new FileSystemAccessRule(WindowsIdentity.GetCurrent().User, FileSystemRights.FullControl, AccessControlType.Allow));
|
||||
File.SetAccessControl(FilePath, NewACL);
|
||||
|
||||
// Open the file for patching
|
||||
Stream = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite);
|
||||
@@ -460,9 +459,8 @@ namespace WPinternals
|
||||
{
|
||||
// Restore original owner and access rules.
|
||||
// The OriginalACL cannot be reused directly.
|
||||
FileSecurity NewACL = File.GetAccessControl(FilePath);
|
||||
FileSecurity NewACL = new FileSecurity(FilePath, AccessControlSections.Owner | AccessControlSections.Group | AccessControlSections.Access);
|
||||
NewACL.SetSecurityDescriptorBinaryForm(OriginalACL.GetSecurityDescriptorBinaryForm());
|
||||
File.SetAccessControl(FilePath, NewACL);
|
||||
|
||||
// Revert to self
|
||||
RestorePrivilege.Revert();
|
||||
|
||||
Reference in New Issue
Block a user