In windows programming, how can we find out the number of partitions and the name of each partition on the hard drive?
Asked
Active
Viewed 234 times
2
-
Have a look at: http://stackoverflow.com/q/286534/1250303. – Java42 Mar 15 '12 at 14:36
2 Answers
3
You can use the DeviceIoControl function with the IOCTL_DISK_GET_DRIVE_LAYOUT_EX contol code to get a list of partitions.
RRUZ
- 133,023
- 16
- 348
- 476
1
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.
Chibueze Opata
- 9,698
- 7
- 41
- 65