RE: Enum drives, partitions and finding drive letters for each partition?

Actually what you should do is use SetupDiEnumDeviceInterfaces and
SetupDiGetDeviceInterfaceDetail to enumerate all physical disks on the
system (and use the device change notification interface to make this
dynamic.)

Use IOCTL_STORAGE_GET_DEVICE_NUMBER to get the ‘device number’ for each
physical disk.

Get a list of all volumes on the system using
FindFirstVolume/FindNextVolume.
This produces a list of all volumes, for each volume on your list use
GetVolumePathNamesForVolumeName to find the associated mount points and
drive letters.

For each volume on your list use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS to
find the associated physical disks, using the ‘device number’.

Given your list of physical disk device names you can then produce maps from
volume to disks and from disk to associated volumes.

=====================
Mark Roddy

-----Original Message-----
From: benson [mailto:xxxxx@dchbk.us]
Sent: Tuesday, October 14, 2003 7:19 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: Enum drives, partitions and finding
drive letters for each partition?

ME and 98?

For 2K and above, you use FindVolumeMountPoints after
GetLogicalDriveStrings to find the volumes that are mounted
without drive letters.

Or, are you looking for things that are not mounted at all?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On > Behalf Of
Mattias
Sent: Tuesday, October 14, 2003 2:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Enum drives, partitions and finding drive
letters for each partition?

I want to enumerate all hard drives, their partitions
and list the drive letters for each partition.

It’s *not* sufficient to only call GetLogicalDriveStrings
or GetLogicalDrives, since that only gives me the
partitions.

I would like this to work on XP, ME, 98, and 2K (in that
priority order).

I think I should use the CM_* functions, such as
CM_Locate_DevNode, CM_Get_DevNode_Registry_Property,
CM_Get_Child and CM_Get_Sibling. I’ve managed to enumerate
devices, but I have no clue how to find drive letters.

Thanks in advance.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@dchbk.us
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com