Reputation: 5541
In windows programming, how can we find out the number of partitions and the name of each partition on the hard drive?
Upvotes: 2
Views: 310
Reputation: 10044
There's a very good article on how to do this at MSDN. It utilizes the GetLogicalDrives
, GetLogicalDriveStrings
, GetDriveType
, and GetVolumeInformation
functions. You can download the source from here.
Upvotes: 1
Reputation: 136441
You can use the DeviceIoControl
function with the IOCTL_DISK_GET_DRIVE_LAYOUT_EX contol code to get a list of partitions.
Upvotes: 3