Platform SDK: Files and I/O

Enumerating Volumes

To make a complete list of the volumes on a computer, or to manipulate each volume in turn, you can enumerate volumes. Within a volume, you can scan for volume mount points or other objects on the volume.

Three functions allow an application to enumerate volumes on a computer:

These three functions operate in a manner very similar to the FindFirstFile, FindNextFile, and FindClose functions.

Begin a search for volumes with FindFirstVolume. If the search is successful, process the results according to the design of your application. Then use FindNextVolume in a loop to locate and process each subsequent volume. When the supply of volumes is exhausted, close the search with FindVolumeClose.

You should not assume any correlation between the order of volumes returned with these functions and the order of volumes returned by other tools. In particular, do not assume any correlation between volume order and drive letters as assigned by the BIOS (if any) or the Disk Administrator.

See Volume Mount Point Examples for an example of how to enumerate the volumes on a computer.