To mount vhds on windows, we can use OpenVirtualDisk
then AttachVirtualDisk
to attach a virtual disk, then GetVirtualDiskPhysicalPath
can be used to obtain a physical path to the vhd, in the form of \\.\PhysicalDrive1
.
Next we can use FindFirstVolume
and friends to find the volume names the vhd contains. But this does not always work, as it can take some time for the mount manager to create a volume name symlink in the dos devices namespace to point to the physical volume.
How can we wait for this to happen, without doing busy-waits?