level20peon Posted October 7, 2009 Share Posted October 7, 2009 (edited) I am trying to lockdown my computer if specific hardware is removed and unlock it if it comes back. The triggering is done in another script, these are the lock and release scripts which are executed in case of the hardware events. I am so far not able to gain control over the computer without resetting it or replugging the specific hardware. Are you ?I know about Win+L but since one couldn't unlock the computer in the "real" lock-state programmatically I am trying to do this whole lock via script.lock.exeexpandcollapse popup#NoTrayIcon #include <misc.au3> while 1 block() sleep(50) for $x=0 to 165 if _IsPressed(Hex($x)) then block() sleep(50) EndIf Next WEnd Func block() Opt("WinTitleMatchMode", 4) ;Deactivate Monitor $HWND = WinGetHandle("classname=Progman") DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", 274, "int", _ 61808, "int", 2) ;Deactivate Taskbar WinSetState("classname=Shell_TrayWnd", "", @SW_HIDE) ;Disable Taskmanager ProcessClose('taskmgr.exe') RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD","1") ;Disable Input BlockInput(1) Opt("WinTitleMatchMode", 1) EndFunc block()release.exe#NoTrayIcon Func unblock() Opt("WinTitleMatchMode", 4) ;Activate Monitor $HWND = WinGetHandle("classname=Progman") DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", 274, "int", _ 61808, "int", -1) ;Activate Taskbar WinSetState("classname=Shell_TrayWnd", "", @SW_SHOW) ;Enable Taskmanager RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD","0") ;Enable Input BlockInput(0) Opt("WinTitleMatchMode", 1) EndFunc ProcessClose('lock.exe') unblock() Edited October 7, 2009 by level20peon Link to comment Share on other sites More sharing options...
CodyBarrett Posted October 7, 2009 Share Posted October 7, 2009 simple enough... though Regwriting...(correct me if i'm wrong) but it needs to be rebooted to take effect [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
level20peon Posted October 7, 2009 Author Share Posted October 7, 2009 I can understand if somebody doesn't want to distribute scripts that include regwriting but since this is for personal use only I am ok if it writes to my computers registry (if this is what you mean). The changes take effect immediately, tested on Windows 7 x64 and Windows Server 2003 x86 which I guess covers most possible kernels of modern windows systems. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now