Here are some links I promised:
- Source code for virtual disk management sample
- VHD install
- Fixing bootable VHD
- Quick VHD install
- Quick VHD creation
If you are interested in this topic, you may wish to check this blog at later times also. I will be adding more detailed explanations of VHD API and updates to this C# implementation.
P.S. If you get "Privilege not held" exception message, run Visual Studio 2008 as administrator. VHD API requires elevated rights.
[2009-04-27: Windows 7 RC will have some changes regarding Virtual Disk API. Major ones include changing names of some functions (E.g. what was SurfaceVirtualDisk is now AttachVirtualDisk, what was UnsurfaceVirtualDisk is now DetachVirtualDisk) and structures. Once RC is out and I install it, I will release update of code.]
[2009-05-01: Code is updated.]