I am trying to figure out how to detect if a drive is a mass storage device. I can get the drive letters but cannot figure out how to detect what sort of device it is. I am trying to detect if a Garmin GPS receiver is connected to a PC in mass storage mode.
Share
You can use the WMI for this task, exist several classes which can help you to determine that information, start with the
Win32_USBHubchecking for the valueMass Storage Devicein the the property Description, also take a look in theWin32_PNPEntityclass. If you don’t have experience accesing the WMI from Delphi, try using the Wmi delphi code creatorUPDATE
To associate the values returned by the Win32_USBHub or Win32_USBControllerDevice WMI classes with a Disk Drive letter, you must follow the next steps
DeviceIDextracted of thedependentproperty of each returned instance(record) check the Win32_PnPEntity class loinked to a Win32_DiskDrive using a WQL sentence like so :ASSOCIATORS OF {Win32_PnPEntity.DeviceID="DeviceID"} WHERE ResultClass = Win32_DiskDriveCheck this sample code
Which will return some thing like this.