I am developing an application that needs to copy some files from the Windows XP file system to several USB mass storage devices. I need to come up with a way to programatically detect these devices and mount them to empty NTFS folders. Mapping them to drive letters (or allowing XP to assign them to drive letters automatically) is not an acceptable solution because there may very well be more than 26 of these devices attached.
I have gone into the Control Panel->Computer Management->Disk Management tool and verified that it is within the capability of Windows XP to mount these devices to a folder as opposed to a drive letter.
So here is the scenario:
1) User attaches an indeterminate number of USB mass storage devices to one or more USB hubs that are connected to the XP system.
2) User initiates a program which automatically detects all of the attached USB devices and mounts each of them to a folder.
3) Our existing software iterates over all of the folders and copies the appropriate files to the devices.
Step 2 is where my problem is. I have seen the "MOUNTVOL" command line program that appears to be able to support this functionality, but I am unsure as to exactly how to approach the scripting of this command. Another issue is that if you run "MOUNTVOL" without any parameters in order to get a listing of possible VolumeNames, I cannot immediately see any way to distinguish between the native hardware of the XP system (hard drives, CD-ROMs, etc.) and the USB devices.
Once we have solved this problem, we will be deploying several of these XP systems, each with their own set of USB devices. Since each XP system will have its own GUIDs for its native hardware, we cannot expect to be able to hard code the GUIDs of the native hardware for exclusion from the MOUNTVOL script. So we need a way to iterate over the VolumeNames that are listed by MOUNTVOL, detect whether each of them is a USB mass storage device or not, and if so, mount the device to a folder.
I am not committed to trying to solve this by scripting around the MOUNTVOL command. If there is a library that would allow us to accomplish this from a C++ or .NET program, that would be preferable.