Jump to content
Sign in to follow this  
chrono13

ProcessClose in ver > 3.2.12.0

Recommended Posts

chrono13

My limited-logoff screensaver works simply by using the current logged in (though locked) user's rights to kill their own processes and then logoff. I want to be able to continue to update AutoIt and benifit from the bugfixes and new features, but this change to ProcessClose, without a switch to revert to old behavior (a switch of 2 to indicate only kill the process if it belongs to the current user for example) is preventing me from upgrading.

The program goal: to allow any user to log other limited users and administrators off of the computer, securely.

Implementation: Act as a 'screensaver', spawn a real screensaver to act as the pretty, wait for it to exit, and then ask if the current user should be logged off. If confirmed, then kill all of that users currently running programs *quickly*, then logout all the while not showing any sensitive data to the user at the keyboard.

Currently it works, and works great. However, as of AutoIt version 3.2.12.0 ProcessClose now kills all user processes. This is not desirable for this function:

Func _KillEverything(); "I'm strangely comfortable with it." -Conor, Boondock Saints
; Note that ProcessClose will only kill processes created by the user initiating the ProcessClose. This is desirable.
    Local $list = ProcessList(); List all processes into an array.
    For $i = 1 To $list[0][0]
        Switch $list[$i][0]; Do NOT remove Explorer or the screensaver name (Limited) from this list.
            Case "explorer.exe", "explorer", "Limited.scr", "Limited", "Limited.exe", "logon.scr", "logon", "logon.exe" 
                ContinueLoop; Skip killing the matched process and continue the loop.
            Case "AutoIt3.exe", "AutoIt3Help.exe", "AutoIt3Wrapper.exe", "AutoIt" ; These are for testing purposes.
                ContinueLoop; Skip killing the matched process and continue the loop.
            Case Else
                ProcessClose($list[$i][1]); Instant kill.
                #cs
                    === A Very Important note ==
                    As of this writing, AutoIt's ProcessClose only kills processes from the current user. This could change in the future.
                    Do NOT recompile this with later versions of autoit without first testing whether it will kill System processes and adjusting this program accordingly.
                    === End Important Note ===
                #ce
        EndSwitch
    Next
EndFunc ;==>_KillEverything

Caveats:

1. Simply using Shutdown(4) without using ProcessClose will not work because many apps then pop up confirmations and it is too slow to avoid showing, for example, an employee evaluation.

2. A timed log-off is not what the boss wants, and would not work well for what we are trying to do.

3. With the version of AutoIt I am using, this all works perfectly, but upgrading obviously breaks this because it kills more than the current users process.

Does anyone have any workarounds that will cause ProcessClose to only kill current-user processes, using the most recent versions of AutoIt? Or perhaps ideas on how I could update my program to deal with this AutoIt change. My first thought was to check the process and match the owner, but I have not seen any AutoIt function that can pull the owner detail for a process.

Any help is appreciated, thanks!

Edited by chrono13

Share this post


Link to post
Share on other sites
herewasplato

Welcome to the forum.

This post...

http://www.autoitscript.com/forum/index.ph...st&p=566344

... has a UDF named _ProcessListProperties()

which returns process owner - but there is an OS memory leak issue - read the rest of the posts in that thread.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×