Sunday, May 1, 2011

Why does my Volume Shadow Copy Service requester fail: cannot find CreateVssBackupComponentsInternal

I have implemented a VSS requester, and it links compiles and executes on Windows Server 2008, but does not execute on Windows Server 2003. Since my requester is inside a DLL, my DLL will not load. Using the Dependency Walker, I discovered that my DLL is finding VSSAPI.DLL just fine, but it reports:

Error: At least one required implicit or forwarded dependency was not found.

Looking at my VSSAPI.DLL, it cannot find CreateVssBackupComponentsInternal, while VSSAPI.DLL exports something completely different: ?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z.

From stackoverflow
  • VSS must be compiled and targeted specifically for each platform and OS, including Windows XP, Windows Server 2003, and Vista/Windows Server 2008.

    The first Microsoft SDK to fully support VSS requesters is v6.1, and it only supports requesters running on Vista. If you want to run on Windows Server 2003 or XP:

    • Download VSS SDK 7.2.
    • Set your include and library paths to search the appropriate directory in the VSS SDK.

    The following is what AlphaVSS does in its Config.h, but the VShadow sample in the VSS SDK does not: it only sets the include and library paths. I would suggest that following VShadow is more likely to succeed. But for completeness:

    If targeting Windows XP:

    #define NTDDI_VERSION NTDDI_WINXPSP2
    #define _WIN32_WINNT _WIN32_WINNT_WINXP
    #define WINVER _WIN32_WINNT
    

    If targeting Windows Server 2003:

    #define NTDDI_VERSION NTDDI_WS03SP1
    #define _WIN32_WINNT _WIN32_WINNT_WS03
    #define WINVER 0x501
    

    If targeting Vista, don't reference the VSS SDK. Instead reference the Windows 6.1 SDK and:

    #define NTDDI_VERSION NTDDI_WS08
    #define _WIN32_WINNT _WIN32_WINNT_WS08
    #define WINVER _WIN32_WINNT
    

    I can't take all the credit for this, I figured this out by reading the source code of a project called AlphaVSS (see announcement), which exposes VSS to .NET code. MSDN did not seem to be very helpful. However, the VShadow tool and sample provided an example of how to compile a VSS requester.

    Also note that you must recompile again for x64 or ia64 vs x86. That means in order to support all platforms, you'll need 9 compiled versions of your executable.

    Jared Oberhaus : I also found someone else asking a similar question; they got the error: error LNK2019: unresolved external symbol _CreateVssBackupComponentsInternal@4 referenced in function "long __cdecl CreateVssBackupComponents(class IVssBackupComponents * *)" (?CreateVssBackupComponents@@YAJPAPAVIVssBackupComponents@@@Z) http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/2d096271-df86-4aa0-b14d-3a6415fd534a?prof=required&wa=wsignin1.0
  • Just wanted to add that AlphaVSS also sets the paths, not only the defines. This is needed in either case.

    Jared Oberhaus : Do you mean paths to the DLL's?

0 comments:

Post a Comment