Sign in to follow this  
Followers 0
Skitty

Setting file permissions.

3 posts in this topic

#1 ·  Posted (edited)

I have this script I made to enable my script to install procexp.exe in place of taskmgr.exe @SystemDir and I want to know how I could set the rights back to the new file after replacing it.

Func _TAKEOWN($File)
    If StringInStr($File, " ") Then
        $I1 = 0
        while 1
            If $I1 >= 3 Then ExitLoop
            RunWait('TAKEOWN /F "' & $File & '"',"",@SW_HIDE)
            Sleep(2000)
            run('icacls "' & $File & '" /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW)
            $I1 += 1
        WEnd
    Else
        $I2 = 0
        While 1
            If $I2 >= 3 Then ExitLoop
            RunWait('TAKEOWN /F ' & $File,"",@SW_HIDE)
            Sleep(2000)
            run('icacls ' & $File & ' /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW)
            $I2 += 1
        WEnd
    EndIf
    FileSetAttrib($File,"-RSH")
EndFunc
Edited by System238

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites



I have this script I made to enable my script to install procexp.exe in place of taskmgr.exe @SystemDir and I want to know how I could set the rights back to the new file after replacing it.

Func _TAKEOWN($File)
    If StringInStr($File, " ") Then
        $I1 = 0
        while 1
            If $I1 >= 3 Then ExitLoop
            RunWait('TAKEOWN /F "' & $File & '"',"",@SW_HIDE)
            Sleep(2000)
            run('icacls "' & $File & '" /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW)
            $I1 += 1
        WEnd
    Else
        $I2 = 0
        While 1
            If $I2 >= 3 Then ExitLoop
            RunWait('TAKEOWN /F ' & $File,"",@SW_HIDE)
            Sleep(2000)
            run('icacls ' & $File & ' /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW)
            $I2 += 1
        WEnd
    EndIf
    FileSetAttrib($File,"-RSH")
EndFunc

Well, this is dumb... I just found out that there is an option in options to replace the task manager...

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Hi.

Well, this is dumb... I just found out that there is an option in options to replace the task manager...

In case you should want to roll out this replacement, this is the value you need (beside pushing procexp.exe to %windir%):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe]
"Debugger"="\"C:\\WINDOWS\\PROCEXP.EXE\""

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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  
Followers 0