eynstyne Posted July 5, 2006 Share Posted July 5, 2006 Locks drive simply by dragging this app inside it and launching it. Known Limitations and instructions... - Can't change password, Password is 12345678 (working on it) - Takes about 3 seconds or more for protection to reactivate when you click enable protection in the tray menu - Drag an icon in with the memoryres.exe file but name it under the extension .kdl - Will close any conflicting windows and subjects which have to do with the drive letter - Doesn't shake window sometimes expandcollapse popup#include <guiconstants.au3> #include <constants.au3> #include <misc.au3> #include <File.au3> #notrayicon Opt("TraymenuMode",1) $gui = Guicreate("Stop Protection...",255,150,-1,-1,$WS_SYSMENU + $DS_SETFOREGROUND,$WS_EX_TOPMOST + $WS_EX_TOOLWINDOW) $protect = Traycreateitem("Enable Protection...") GuiSetFont(8.5,"Tahoma") guisetbkcolor(0xffffff, $GUI) GuiCtrlCreatelabel(" Enter Password to stop protection. If you cancel, the program will close all conflicting windows...", 30, 5, 235, 75, -1) $read = GuiCtrlCreateInput("", 10, 71, 225, 20, $ES_PASSWORD) $icon = GuiCtrlCreateIcon("", 0,5, 5, 32,32, $SS_ICON) GuiCtrlCreatelabel("Password:", 10, 55, 150, 23, 0) $button = GuiCtrlCreatebutton("Unlock", 50, 100, 150, 23, $BS_DEFPUSHBUTTON) $getfile = FileFindfirstFile("*.kdl") $find = FileFindnextFile($getfile) GuiCtrlSetImage($icon, @workingdir & $find, 0) guisetstate() Winsetstate("Stop Protection...","",@SW_HIDE) $count = 0 controlfocus("Stop Protection...","",$read) while 1 $listwin = WinList() $msg = GuiGetMsg() $tray = Traygetmsg() hideitall() Select case $tray = $protect Opt("TrayIconHide", 1) guictrlsetdata($read,"") case $msg = $GUI_EVENT_CLOSE for $i = 1 to $listwin[0][0] $text = WingetText($listwin[$i][0]) $check = stringinstr($text, @scriptdir) if $check > 0 then winclose($listwin[$i][0],"") endif next Winsetstate("Stop Protection...","",@SW_HIDE) for $i = 1 to $listwin[0][0] $stringcheck = stringinstr($listwin[$i][0], @scriptdir) if $stringcheck > 0 then winclose($listwin[$i][0],"") endif next winsetstate("Stop Protection...","",@SW_HIDE) case $msg = $button $getpass = guictrlread($read) if $getpass <> "12345678" then $pos = wingetpos("Stop Protection...","") winmove("Stop Protection...","", $pos[0] -50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0] +50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0] -50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0] +50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0] -50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0] +50, $pos[1]) sleep(20) winmove("Stop Protection...","", $pos[0], $pos[1]) GuiCtrlSetData($read, "") elseif $getpass = "12345678" then Opt("TrayIconHide", 0) $open = fileopen(@scriptdir & "Autorun.inf",2) FileWriteline(@scriptdir & "autorun.inf", "[Autorun]") FileWriteline(@scriptdir & "autorun.inf", "icon=kingston.ico") fileclose($open) Winsetstate("Stop Protection...","",@SW_HIDE) endif EndSelect wend func hideitall() $pass = GuiCtrlRead($read) if $pass <> 12345678" then if winexists("Windows Task Manager","") then winclose("Windows Task Manager","") endif $listwin = WinList() for $i = 1 to $listwin[0][0] $stringcheck = stringinstr($listwin[$i][0], @scriptdir) if $stringcheck > 0 then Winsetstate($listwin[$i][0],"",@SW_MINIMIZE) Winsetstate("Stop Protection...","",@SW_SHOW) return endif $text = WingetText($listwin[$i][0]) $check = stringinstr($text, @scriptdir) if $check > 0 then Winsetstate($listwin[$i][0],"",@SW_MINIMIZE) Winsetstate("Stop Protection...","",@SW_SHOW) return endif Next else winminimizeallundo() return endif endfunc F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent] Link to comment Share on other sites More sharing options...
The_Mega_ZZTer Posted July 6, 2006 Share Posted July 6, 2006 (edited) Nice try, but I'm afraid you took a rather poor approach that can be easily defeated. It's not worth it to disable Task Manager and minimize programs.Here are more ways your protection could be easily subverted:- Services can still run free and do whatever they please.- Existing open file handles and newly opened file handles are unaffected.- Any app that doesn't actually have the full filename path in the titlebar or on a first-level child control will go unaffected.- Any app can kill your app with a single Windows API call, including another AutoIt script.Furthermore, your app is very intrusive and would doubtless get annoying after a little bit. And since it only stops the APPEARANCE of filenames and does nothing to stop actual file operations, it's not very useful.Locking a drive would be best done using the Windows API... I'm sure there's functions somewhere for that sort of thing.AutoIt is good for some things but not for others. Manipulating the GUI is best done for GUI operations only. Edited July 6, 2006 by The_Mega_ZZTer 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