user1232138
user1232138

Reputation: 5541

Name and number of partitions on a hard drive

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

Answers (2)

Chibueze Opata
Chibueze Opata

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

RRUZ
RRUZ

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

Related Questions