Jump to content
Sign in to follow this  

how can i detect mass storage device

Recommended Posts


hello i trying to make a mini antivirus for usb storage device so

i need the script to detect any usb mass storage plugin to my computer !

Share this post

Link to post
Share on other sites

DriveGetType() returns the type of drive. Usually a removable device with a drive letter is a mass storage device. (consult the help file)

If you want to be notified when a device is entered, you can create a hook. There is an example in the Example Scripts forum. Search and your should find it.

[Not using this account any more. Using "iShafayet" instead]

Share this post

Link to post
Share on other sites

i have used this code but sometime it didn't detect the usb storage

Func getdriver()
$var = DriveGetDrive( "all" )
If NOT @error Then
;~     MsgBox(4096,"", "Found " & $var[0] & " drives")
    For $i = 1 to $var[0]
    $var2 = DriveGetType( $var[$i] & "\" )
    $var3 = DriveStatus( $var[$i] & "\" )
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\miniantivirus\drivers\" & $i ,$i,"REG_SZ",$var[$i] & "\")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\miniantivirus\drivers\" & $i ,"type","REG_SZ",$var2)
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\miniantivirus\drivers\" & $i ,"statue","REG_SZ",$var3)
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\miniantivirus\drivers\count" ,"dcount","REG_SZ",$i)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.