Sign in to follow this  
Followers 0
XoloX

USBWritePROTecH

3 posts in this topic

;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!...

Share this post


Link to post
Share on other sites



use this

run("RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll")

it could save some effort.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

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).......

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  
Followers 0