Jump to content
Sign in to follow this  
jamesstp20

Remove Protected File of Windows

Recommended Posts

jamesstp20

Hello, I would like to know how to remove or Move a protected file from WindowsDir.

Like C:\Windows\System32\hal.dll

Thanks you :unsure:

Share this post


Link to post
Share on other sites
jamesstp20

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

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
ricky

Hello,

it's possible to do the same for a folder?

Please see this topic :

Thanks for your help

Share this post


Link to post
Share on other sites
ricky

Hello,

yes, I tried it, but nothing change. I tried the code wakillon, but it doesn't work on Windows 7.

Who can help me?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.