STORAGE_PROPERTY_ID = (StorageDeviceProperty = 0, StorageAdapterProperty) STORAGE_QUERY_TYPE = (PropertyStandardQuery = 0, PropertyExistsQuery, PropertyMaskQuery, PropertyQueryMaxDefined) IOCTL_STORAGE_QUERY_PROPERTY = $002D1400 Now I would like to just know how to enumerate all the drive letters. If DriveHandle = INVALID_HANDLE_VALUE thenĭeviceIoControl(DriveHandle, IOCTL_STORAGE_GET_HOTPLUG_INFO, nil, 0, nil) Procedure TForm1.Button1Click(Sender: TObject) ĭriveCmdStr := Format('\\.\%s:', ) ĭriveHandle := CreateFile(PChar(DriveCmdStr), GENERIC_READ, FILE_SHARE_WRITE, I just found some sample code and am posting it here: uses. I wonder if anyone can help me with the proper way / code to list USB storage devices? I believe there is DeviceIoControl function (I saw it on MSDN) but I have no idea of how to use it. However, I only want to list the external drives. There is a Jvcl component JvDriveCombo, and it has the DriveType property - the problem is if I select DriveType := Fixed then in addition to the external drive, it also lists the internal drives ( C:\, D:\ etc). These can be either flash memory sticks or external storage drives. In my application (Delphi), I need to list all the USB storage devices.
0 Comments
Leave a Reply. |