Platform SDK: Files and I/O |
To enumerate all of the volume mount points on a volume, or to manipulate each in turn, scan a volume for volume mount points. Three functions allow an application to enumerate the volume mount points on a specified NTFS volume:
These three functions operate in a manner very similar to the FindFirstFile, FindNextFile, and FindClose functions.
To enumerate volume mount points on a volume, first find out if the volume is a Windows 2000 NTFS volume and thus supports volume mount points. To do so, use the volume name returned by the FindFirstVolume and FindNextVolume functions to call the GetVolumeInformation function. The names returned include a trailing backslash (\) to be compatible with the GetDriveType function and related functions. For more information on the functions used to scan the volumes on a computer, see Enumerating Volumes.
If the volume is an NTFS volume and supports volume mount points, begin a search for the volume's volume mount points with FindFirstVolumeMountPoint. If the search is successful, process the results according to your application's requirements. Then use FindNextVolumeMountPoint in a loop to locate and process each subsequent volume mount point. When the supply of volume mount points is exhausted, close the process with FindVolumeMountPointClose.
Volume mount point searches are confined to the specified volume. To search all of the volume mount points on a computer, use the volume enumerating functions to scan all the volumes, and search each volume in turn. For more information, see Enumerating Volumes.
You should not assume any correlation between the order of volume mount points returned by these functions and the order of volume mount points returned by other tools.
See Volume Mount Point Examples for an example of how to enumerate the mount points on a volume.