Jump to content
Sign in to follow this  
LiquidNitrogen

Administrator System - Block Applications

Recommended Posts

This is Something i Made to block Applications from Being Used without Using the Windows UAC and Stuff. Its Quicker and it Works. Let me know what You Think.

You Need the config.ini file in the Folder with the Script.

Admin System.rar

Edited by ReaperX

Formerly ReaperX

Share this post


Link to post
Share on other sites

i dont find anything related to Windows UAC in your code


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

i dont find anything related to Windows UAC in your code

Its Not Related to it at All. I Just said that this blocks applications without using the UAC.


Formerly ReaperX

Share this post


Link to post
Share on other sites

ReaperX,

Upon using your code i found that because of the for while loop the more number of applications , much more time it takes for the script to block the program
Due to which sometimes i see a white glance of notepad

Solution:

I have already made a script like that, it uses registry
Just have a look
Code :

#OnAutoItStartRegister "Startup"
#RequireAdmin
#include <File.au3>

;Author Phoenix XL
;modified 21/05/2013

;block notepad
BlockApplication('notepad.exe')

;unblock when the user closes the Msgbox
MsgBox(64, 'Phoenix XL', 'Notepad Blocked as a Demo...' & @CRLF & 'Notepad would be unblocked upon exit.')
BlockApplication('notepad.exe', 0)
Exit

Func Startup()

    Global $s_regpath
    If @OSArch = "X86" Then
        $s_regpath = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
    Else
        $s_regpath = 'HKCU64\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
    EndIf

    ;all okay then return
    If RegRead($s_regpath, "DisallowRun") = 1 Then Return

    ;we have to write the registry and restart the explorer.
    RegWrite($s_regpath, 'DisallowRun', 'REG_DWORD', 1)
    If @error Then Exit -1

    ;killing explorer and restarting the same would create a unwanted window. Therefore use a batch file.

    ;make the batch file to run the explorer.
    $s_batch = _TempFile(@TempDir, "~", ".bat")
    FileWrite($s_batch, "taskkill /im explorer.exe /f" & @CRLF & "start explorer" & @CRLF & "exit")
    ProcessClose("explorer.exe")


    ;kill and restart.
    ShellExecuteWait($s_batch, "", "", "open", @SW_HIDE)
    FileDelete($s_batch) ;delete the temp file.

EndFunc   ;==>Startup


Func BlockApplication($sAppname, $fBlock = True)

    ;block or unblock an application.
    Switch $fBlock
        Case True
            Return RegWrite($s_regpath & '\DisallowRun', 'block ' & _GetAppName($sAppname), 'REG_SZ', $sAppname)
        Case Else
            Return RegDelete($s_regpath & '\DisallowRun', 'block ' & _GetAppName($sAppname))
    EndSwitch

    ;set error otherwise.
    Return SetError(1, 1, 0)
EndFunc   ;==>BlockApplication

Func _GetAppName($sAppname)
    ;delete the extension from the name of the application
    Return StringRegExpReplace($sAppname, "(.*)\..*$", "\1")
EndFunc   ;==>_GetAppName

Regards
Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

tell me what do u think about my code

Due to which sometimes i see a white glance of notepad

Upon seeing it the user may try to find your process and kill it Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

tell me what do u think about my code

Upon seeing it the user may try to find your process and kill it

Yeah i Didnt think of that and your code is good

Formerly ReaperX

Share this post


Link to post
Share on other sites

Thnx for the feedback ;)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Hi PhoenixXL,

nice code. I'am using Windows7 Prof. 64Bit and i get a returncode of 0 when the RegWrite within the BlockApplication function is called. Somehow i can't write into the DisallowRun Key. (by the way: i can't see the key. Is it normal?). Some idea?

thanks in advance

Sundance

Share this post


Link to post
Share on other sites

the script was for 32bit only, i have updated it for to support 64bit windows even.

Recheck if it works..!

P.S. its almost a year the last post of this topic was made, therefore please don't post new queries(Necroing), rather start a new topic.

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Hi PhoenixXL,

thanks for the headsup and the modification of the code. I've tried it today on both 32 and 64bit but both show the same error. Win7 won't let me write to that reg position. Will see if i can identify the problem more closer...

 

PS: So this is now no more an old topic i guess?   :huh2:

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nacerbaaziz
      hello autoit team
      is there any wey to check if any process run as admin or no?
      i mean e.g if i want to restart any process, now i have the ability to get the process path and commands line
      what i need is a wey to check if the process was runing as admin or no to restart it with the same state.
      here is the part that am using it to restart the process
      func _processRestart($i_pid, $s_ProcessPath) if not (ProcessExists($i_ProcessPid)) then return SetError(1, 0, -1) local $s_ProcessWorkDir = _WinAPI_GetProcessWorkingDirectory($i_ProcessPid) ProcessClose($i_ProcessPid) ProcessWaitClose($i_ProcessPid) ProcessWait(ShellExecute($i_pid,"", $s_ProcessWorkDir)) ProcessesGetList() return true endFunc thanks in advance
    • By morion84
      Hi, when I call a MsgBox function I can use a "$MB_SERVICE_NOTIFICATION" flag so it will be displayed "on the current active desktop, even if there is no user logged on to the computer.". That works just great. Is there a way to do the same to Autoit GUI Form so it will be visible on desktop even if running from system account and user is not logged?
    • By Psyllex
      I'm trying to install some setup stuff on Win10. 
       
      One part of the script requires just regular user privileges but the other requires admin privileges.  When I run it from the Autoit Editor it works like a champ.  When I build it, Windows slaps the admin stamp on it and then when I attempt to run the part that only requires regular users....it gets all hosed up. 
      Is there a way to remove #RequireAdmin? 

      I've tried RunAs(username, "", myPassword, "", "cmd.exe", "") but that never seems to work.
      Can someone help me out?
    • By nacerbaaziz
      Hello all
      I have a question please
      Is there a way to request the script for administrator privileges if a particular condition is met??
      example
      local $path = RegRead("HKEY_CURRENT_USER\Software\test", "fullpath")
      if $fullPath = @scriptFullPath then
      Request for administrator privileges
      main()
      else
      main()
      endIf
      I hope to find a solution here
      Greetings to all
    • By nacerbaaziz
      Hi dear
      I have a question
      about the display language of the system
      How can I get the current display language and how can I change it by autoit
      Of course, if this is possible
      Greetings to all and hope you help me
×
×
  • Create New...