XoloX Posted June 2, 2007 Posted June 2, 2007 expandcollapse popup;USB WriteProTECH v1.0 ;Coded By XoloX ;Works Only for Xp Sp2 ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ;Operating Instructions: ;1. Copy this to ur PenDrive along with an autorun.inf pointing to this, ;2.Then Put ur Drive Back in and run the app when the XP-Autorun dialog pops up ;3.When it tells u 2 remove the drive do so ;4.Insert the drive again ;5.It shld now b write protected! ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #include <Misc.au3> Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $exit= TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() If $msg=$exit Then Exit EndIf Wend $dll = DllOpen("user32.dll") ;Check For Souvenir ,if there,then stay "Dormant" else rite proteCH and eject If not FileExists("c:\riteprotect.dat") Then _writeprotect() Else _Dormant() EndIf Func _writeprotect() RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies", "WriteProtect", "REG_DWORD", "00000001") FileInstall("riteprotect.dat","C:\riteprotect.dat");A souviner Sleep(100);Adjust As needed MsgBox(64, "Remove Your Device", "You can now safely unplug your USB Device", 5) Sleep(2000) EndFunc ;FUNC DORMANT:Waits for End Key Press and On getting the keystoke it Reverses Changes Func _Dormant() While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies", "WriteProtect", "REG_DWORD", "0") FileDelete("C:\riteprotect.dat") ExitLoop EndIf WEnd DllClose($dll) EndFunc ;; plZ provide positive criticism!...
Somerset Posted June 2, 2007 Posted June 2, 2007 use this run("RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll") it could save some effort.
XoloX Posted June 3, 2007 Author Posted June 3, 2007 I did try that,but then it pops a dialog saying it cant remove the drive... ....Even the 'Deveject' idea went into the trash because it couldnt eject the drive either..... ....So manual unplug is the only way out(i think).......
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