Enumerating Mounted Folders

The following functions are used to enumerate the mounted folders on a specified NTFS volume:

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

To enumerate mounted folders on a volume, first find out if the volume supports mounted folders. 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. When you call the GetVolumeInformation function, if "NTFS" is returned in the lpFileSystemNameBuffer parameter, the volume is an NTFS volume. The NTFS file system supports mounted folders.

If the volume is an NTFS volume, begin a search for the mounted folders by calling 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 the mounted folders one at a time. When there are no more mounted folders to be enumerated, close the search handle by calling FindVolumeMountPointClose. Note that the search will find only the mounted folders that are on the specified volume.

You should not assume any correlation between the order of the mounted folders that are returned by these functions and the order of the mounted folders that are returned by other functions or tools.