Jump to content

Need help differentiate between real and virtual drives....


Recommended Posts

I have this code:

#include <string.au3>

Dim $MOUNT = "HKLM" & $PROC & "\SYSTEM\MountedDevices", $TYPE, $ICON, $LIST

$LIST = DriveGetDrive( "CDROM" )
if NOT @error then
    For $i = 1 to $LIST[ 0 ]
        $TYPE = _HexToString( StringReplace( RegRead( $MOUNT, "\DosDevices\" & $TDrv ), "00", "" ) )
        $ICON = _Iif( StringInStr( $Type, "DVD" ) <> 0, 2, _Iif( StringInStr( $Type, "CD" ) <> 0, 1, 3 ) )
        MsgBox( 0, "", $LIST[ $i ] & " is a " & _IIf( $ICON = 1, "CD-ROM", _IIf( $ICON = 2, "DVD-ROM", "Virtual" ) ) )
    Next
endif

It doesn't display the "Virtual" string for my virtual drive. I've tried the following code:

$ICON = _IIf( StringInStr( $TYPE = "SCSI" ) <> 0, 3, _IIf( StringInStr( $Type, "DVD" ) <> 0, 2, 1 ) )

But it reports Serial ATA DVD-RW drives as virtual, because the controllers they are on are reported to Windows as SCSI. (Huh?) Is there any reliable way to differentiate between real and virtual drives, using WMI? Thanks in advance!

Link to comment
Share on other sites

  • 4 months later...

Perhaps a deeper look into the FileSystemObject gives you what you want.

Best regards, Reinhard

Example: DriveTypes

;; Get DriveType
$oFs = ObjCreate("scripting.FileSystemObject")

$drives = $oFs.Drives
for $drive in $Drives
    $x = $drive.DriveType
    if $x = 1 then $y = "Removable"
    if $x = 2 then $y = "Harddrive"
    if $x = 3 then $y = "Remote/NetDrive"
    if $x = 4 then $y = "Cd-Rom"
    if $x = 5 Then $y = "RamDisk"
    if $x = 0 then $y = "I don't know"
    MsgBox(0,"", $x &"=" & $y )
next
Link to comment
Share on other sites

  • 1 month later...

Thanks for the reply, ReFran! I just looked into your suggestion. Since Alcohol 120% appears to Windows as an optical drive, the driver reports the drive as a CD/DVD drive. I also got this from the internal AutoIT function DriveGetDrive.

I looked further into the Scripting thingy call online and can't find anything that might suggest that a particular drive is a virtual and not a physical drive....

Edited by Dougiefresh
Link to comment
Share on other sites

I think the problem is that Alcohol 120% wants it to be indistinguishable from a real drive. If it was just as easy as asking "hey, are you a virtual drive?", it'd be easier on a bunch of the copy-protections for games and such... which would limit its usefulness in backing up your software.

I don't have any way of checking this out myself (I don't have Alcohol 120%), but I'd imagine that there must be a configuration file/registery entry somewhere for it for Alcohol 120% that lists its virtual drives, assuming that you only need it to detect for that one program. However, if you want a truly general case method of determining if it's virtual or not, I doubt it's possible.

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...