Share via


How to edit a vhd file or a vfd file without mounting on computer as a local drive.

Question

Saturday, March 2, 2013 4:46 AM

Hey guys, i have wmi code written in c# to mount and unmount a vhd ... but that is happening in computer and it is adding as an extra drive. But my requirement is that i dont want to mount it as a drive in computer , all i need is to explore the vhd or vfd and add a file and then unmount it..

If i go with the approach of mounting as a  local drive, then the max mounted drives would be 26 only, but in my case the count may be much higher

how can i edit those file???? .. i have already tried reading teh file using streamreader in c#, changing the content and teh writing back as a new file, But then the format of the vfd is not preserved and it says the specified file is not a valid virual floppy disk image... (I tried this on vfd since it was of small size)

Can any one plz help me here.

All replies (2)

Saturday, March 2, 2013 10:25 AM âś…Answered

You'll need VHD accessing library. You may try using MS only API:

http://msdn.microsoft.com/en-us/magazine/dd569754.aspx

http://code.msdn.microsoft.com/windowshardware/CppVhdAPI-4412d182

http://msdn.microsoft.com/en-us/library/dd323700(VS.85).aspx

... or use open-source library w/o any source code interferences. See DiscUtils:

http://discutils.codeplex.com/

Hope this helped :)

StarWind iSCSI SAN & NAS


Saturday, March 2, 2013 1:33 PM

thank you very much brother...

all i need was the discutils... love it!