I played around with DefineDosDevice and CreateSymbolicLink.
First let me state that mounting and unmounting capabilities of my tool are somehow meant as an addition - nothing more. Till now the only advantage to mountvol is that my app also creates non-existing path structures while mounting a volume or a NTFS folder. Otherwise (without re-inventing a wheel) any user could use already build-in command line utilities. However, mounting a vhd or a network share would be a great addition.
Some background info if I may:
My test system is win8.1x64, UAC off, logged in with an admin account.
Network shares added via elevated cmd prompt (e.g. net use) are not visible in a normal explorer window or cmd prompt (not elevated). You're in need to define (or delete) them in elevated and/or non elevated mode.
I once added the following dword key in HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System (for Win8/Win8.1):
In this way explorer shows connections created via elevated AND non elevated privileges.
But anyway, I use a commander that can be either started in elevated or non elevated mode to compare if a new drive has been added/removed.
For me, mapping a network path or a vhd is of main interest (SetVolumeMountPoint can't), although it lasts for the current session only. For testing purposes I quickly created a vhd of my system via volume shadow copy (using Disk2VHD by SysInternals).
Works as expected.
In dependence of the used flag, deleting the drive link inside this session is only possible with DefineDosDevice or subst.exe.
Whatever I try, usage after mounting this vhd (e.g. as Z:) via DefineDosDevice fails (used Flag = 0).
Although this API succeeds, the harddisk icon shown in explorer or my commander contains a blue question mark. Trying to open this drive results in following error (translated):
"Z: cannot be accessed. Wrong syntax for filename, directory name or volume name."
Device path is like this "\\??\FilePath" (invalid for further use).
Deleting the drive link inside this session is only possible with DefineDosDevice or subst.exe.
API succeeds but icon shown in explorer or commander is marked with a red cross (Not connected network share). However, it can be opened - content of this link is accessable.
DevicePath is like this "\\??\Server\Share" (invalid for further use).
In dependence of the used flag, disconnecting is only possible with DefineDosDevice or subst.exe.
Means, DefineDosDevice seems to be able to temporary mount a network share (which is good).
CreateSymbolicLink works very well for local files and volumes as well as for network shares.
Created SymLinks do not work with virtual drives (it succeeds but content is also not accessable).
SymLinks can be removed by deleting the file.
Erwan, did I miss something here?
The advantage of mapping a network share (e.g. using DefineDosDevices) is negated through the fact that it can be removed by recalling DefineDosDevice or subst.exe (or restarting the system) only. I think this could confuse a normal user who might not be familar with command line usage.
BTW, I suppose you're using the MS-virtual disk functions to handle virtual devices in clonedisk.exe?
Most of them at least need Vista or 7 which is a no-go for my command line tool.
May I ask what API is used by pressing the "Information" button? I've seen virtual disk info also works under XP.