Jump to content

Remove Protected File of Windows


Recommended Posts

I would like to make something just like unlocker. That can remove any file but in autoit :unsure:

Edit: Everything work but I can't remove file from System32 dir because they are protected by "TrustedInstaller" but Unlocker works... How plz :> ?

Edited by jamesstp20
Link to comment
Share on other sites

You need to change advanced security settings

and be the owner of locked file !

Example found :

#RequireAdmin

Local $sFile = 'C:\SomePath\SomeFile.exe'

File_Unlock($sFile)

Func File_Unlock($sPath)
    If StringInStr(FileGetAttrib($sPath), 'D') Then Return SetError(-1)
    If StringInStr($sPath, '/') Then Return SetError(-2)
    If Not FileExists($sPath) Then Return SetError(-3)
    Local $exe = @ScriptDir & '\SetACL.exe'
    If Not FileExists($exe) Then Return SetError(-4)
    Local $cmd = $exe & ' -on "' & $sPath & '" -ot file' & _
            ' -actn clear -clr "dacl,sacl"' & _
            ' -actn setprot -op "dacl:np"' & _
            ' -actn ace -ace "n:administrators;m:grant;p:full"'
    RunWait($cmd, @ScriptDir, @SW_HIDE)
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...