Tech Support > Microsoft Windows > Drivers > Retrieve disk partitions (volumes) from Disk DevicePath
Retrieve disk partitions (volumes) from Disk DevicePath
Posted by dataman on August 23rd, 2007


I have trouble finding a way to retrieve/enumerate the volumes of Disk
by using the DevicePath of the disk.

The DevicePath is found by enumerating the GUID_DEVINTERFACE_DISK and
querying SetupDiGetDeviceInterfaceDetail.

Thanks for the help.

Posted by Uwe Sieber on August 23rd, 2007


dataman wrote:
Enumerate GUID_DEVINTERFACE_VOLUME the same way. For each volume which
has DriveType DRIVE_FIXED or DRIVE_REMOVABLE (but not floppy drives!)
match the DeviceNumber (got with IOCTL_STORAGE_GET_DEVICE_NUMBER) with
the one of the disk device in question.
DeviceNumbers are unique within a device class only, so for the
volume of an USB floppy (DRIVE_REMOVABLE, GUID_DEVINTERFACE_FLOPPY)
you get a DeviceNumber which cannot be matched with the one of your
DISK. The only way I know to recognize a floppy as such is the
appearance of the string 'floppy' in several of it's ID strings.


Greetings from Germany

Uwe



Posted by dataman on August 24th, 2007


On Aug 23, 6:41 pm, Uwe Sieber <m...@uwe-sieber.de> wrote:
Thank you Uwe, your method works.

By any chance you may know how to mount a disk (make it show in
GUID_DEVINTERFACE_DISK ) when knowing it's DeviceID.

Is there a way to reinit a USB connected disk. My problem is, when
there are corrupted files on USB disk, ReadFile fails with
ERROR_INVALID_PARAMETER. If i try to skip the file, every consecutive
ReadFile returns ERROR_INVALID_PARAMETER. I tried to sleep for 30 sec,
but ReadFile continues to return the same error. The communication
becomes normal after physically reconnecting of the drive. I suspect
that the firmware or the driver is "stuck" on a the corrupted sector.
How to "unstuck it"

Thanks


Posted by Uwe Sieber on August 24th, 2007


dataman wrote:

No idea, I never had to deal with this type of problem.
Maybe FSCTL_DISMOUNT_VOLUME is worth a try. Deactivating and
reactivating the storage volume device would be the brutal way,
check out the DDK DEVCON sample for this...


Uwe






Uwe

Posted by dataman on August 27th, 2007


On Aug 24, 6:16 pm, Uwe Sieber <m...@uwe-sieber.de> wrote:
Will try, tanks



Similar Posts