开发者

Programming the Virtual Disk Service API in C# using COM Interop

I would like to write a small utility/class library in C# that can enumerate the primary partitions on the disk associated with volume C on Windows 7. I would like to modify the active flag for any one the primary partitions on that disk. I would like to "consume" this library from managed code (C#). As I understand it, I will need to use the Virtual Disk Service described in http://msdn.microsoft.com/en-us/library/bb986750(v=VS.85).aspx.

There seems to be something like a "primary interop assembly" for this API for Windows 2008: Windows.Storage.Vds.dll (see http://blogs.msdn.com/taylorb/archive/2008/09/19/using-the-virtual-disk-service-vds-from-powershell-to-mount-and-use-vhd-s.aspx). I can't find this for Windows 7. Does it exist? If so, how do I obtain it? I can't find it, so I guess it's not publicly available.

The next step would be to generate this code using tlbimp, but VDS doesn't export a type library. Is this true? I can't find it.

That leaves doing the COM stuff "by hand" either in C++ directly, along the lines of the examples above. These examples work, but are virtually inscrutable. Likewise I could create the client assembly by hand from the midl using techniques described in http://msdn.microsoft.com/en-us/library/aa645736(开发者_StackOverflow社区VS.71).aspx. But I don't enough COM/COM Interop/VDS to do this in a reasonable way.

It strikes me the VDS dcom client api is virtual unusable and therefore everyone ends up scripting diskpart.exe. Surely I'm wrong about this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜