Converting a C++ .exe project to a dll

Malfist picture Malfist · Apr 13, 2009 · Viewed 8.1k times · Source

Microsoft provides the source code of vshadow to manipulate VSS (Volume Shadow Service [shadow copy]), and I've modified it a bit but I want to make it into a dll so I can use it in my C# projects. I don't know exactly how to go about doing that, the source code is fairly simple, and it shouldn't be too hard, but I don't really know where to get started. How should I go about converting it to a usable dll instead of compiling to a executable?

Update: Someone has already done this: http://www.alphaleonis.com/2008/08/alphavss-bringing-windows-shadow-copy-service-vss-to-net/

Answer

Alan picture Alan · Apr 13, 2009

You will need to change your project settings in Visual Studio to create a DLL. In addition you will need to define dll entry points.

However, the VSS is a set of COM API's, so you can call them directly from C# with pinvoke, instead of using this wrapper C++ executable.

Since the SDK only contains libs, not DLL's you'll have to create a dll project to use it.

This is a good blog-how-to.

You'll need to download the VSS SDK (if you haven't already).

Decent article on pinvoke.

Hope this helps.