Monday, August 13, 2007

Volume Shadow Copy

The Volume Shadow Copy feature of Windows XP and 2003 provides enterprise grade backup and recovery features in a very simple API.

The problem is that although that API is a COM API it's not very easy to consume - in fact, after spending a couple of days in .Net trying to build a PInvoke wrapper I gave up. It's all because one of the main calls that you require to get things going is CreateVssBackupComponents and that requires a pointer to a COM Interface passed into it - the problem is that that interface has no IID.

Now I never even knew that was possible and I'm sure it must be considered poor COM practice but nethertheless it's too late now - it's now in it's 2nd or 3rd iteration and I'm guessing we're stuck with it.

When I originally starting playing with the VSS SDK I hit this brick wall and never really receovered from it. The plan was to implement Volume Shadow Copy features into Hotspare but we ended up using the vshadow.exe tool in the VSS SDK within our scripts which solved the issue we had at the time.

Well recently I've come across Hobocopy and it looks like the author Craig Andera - who blogs here - had exactly the same experience. So it wasn't just my lack of PInvoke ability after all.

Ever the one to get stuck into a problem I decided to try out some Managed C++ and build a proper managed wrapper around the API. This is my first ever MC++ project and boy I was in for a suprise when I started. What are all the ^'s about! Those are pointers really and everybody know's it!

A couple of days later and the project is now feature complete. I'm waiting on a colleague to code review my C++ to make sure I'm not leaking references left, right and centre and then I'll get the code up onto Sourceforge or somewhere similar for general public consumption.

If you're interested in the code then I'm gonna try and find a way of licensing it for everybodies consumption - contact me if you'd like more info.

1 comment:

Anonymous said...

Hi

I am interested in looking at your code. What kind of arrangement can we come up to?

Regards

Fayyaz
fayyaz(dot)kerawala(at)gmail(dot)com