Ariely_AlphaVSS in

Jun 5, 2014 at 4:53 AM
Hi all,
I try to translate the Ariely_AlphaVSS code in :

Private Sub PerformVSSCopy(ByVal sFilename As String, ByVal TargetFile As String)
    Dim _Volume As String = Mid(sFilename, 1, 3)
    '// VSS step 1: Initialize
    Dim _vssImplementation As IVssImplementation = VssUtils.LoadImplementation()
    Dim _backup As IVssBackupComponents = _vssImplementation.CreateVssBackupComponents()

    '// VSS step 2: Getting Metadata from all the VSS writers

    '// VSS step 3: VSS Configuration
    _backup.SetContext(VssVolumeSnapshotAttributes.Persistent Or VssVolumeSnapshotAttributes.NoAutoRelease)
    _backup.SetBackupState(False, True, Alphaleonis.Win32.Vss.VssBackupType.Full, False)

    '// VSS step 4: Declaring the Volumes that we need to use in this beckup. 
    '// The Snapshot is a volume element (Here come the name "Volume Shadow-Copy")
    '// For each file that we nee to copy we have to make sure that the propere volume is in the "Snapshot Set"
    Dim MyGuid01 As Guid = _backup.StartSnapshotSet()
    Dim MyGuid02 As Guid = _backup.AddToSnapshotSet(_Volume, Guid.Empty)

    '// VSS step 5: Preparation (Writers & Provaiders need to start preparation)
    '// VSS step 6: Create a Snapshot For each volume in the "Snapshot Set"

    '/* At this point we have a snapshot!
    '/* This action should not take more then 60 second, regardless of file or disk size.
    '/* THe snapshot is not a backup or any copy!
    '/* please more information at

    '// VSS step 7: Expose Snapshot
    '/* Snapshot path look like:
    ' * \\?\Volume{011682bf-23d7-11e2-93e7-806e6f6e6963}\
    ' * The build in method System.IO.File.Copy do not work with path like this, 
    ' * Therefor, we are going to Expose the Snapshot to our application, 
    ' * by mapping the Snapshot to new virtual volume
    ' * - Make sure that you are using a volume that is not already exist
    ' * - This is only for learning purposes. usually we will use the snapshot directly as i show in the next example in the blog 
    _backup.ExposeSnapshot(MyGuid02, vbNull, VssVolumeSnapshotAttributes.ExposedLocally, "M:")

    '// VSS step 8: Copy Files!
    '            /***********************************
    '            /* Now we start to copy the files/folders/disk!
    '            /* Execution time can depend on what we are copying
    '            /* We can copy one element or several element. 
    '            /* As long as we are working under the same snapshot, 
    '            /* the element should be in consist state from the same point-in-time
    '            /***********************************/
    Dim sVSSFile1 As String = sFilename.Replace(_Volume, "M:\")
    If IsFileExist(sVSSFile1) Then
        'System.IO.File.Copy(sVSSFile1, TargetFile, True)
        Dim cpr As New CopyProgressRoutine(AddressOf CopyProgress)
        Dim RetourCopy As Long
        RetourCopy = CopyFileEx("\\?\" & sVSSFile1, "\\?\" & TargetFile, cpr, 0, 0, 0)
    End If
    '// VSS step 9: Delete the snapshot (using the Exposed Snapshot name)
    For Each prop In _backup.QuerySnapshots()
        If (prop.ExposedName = "L:\") Then
            _backup.DeleteSnapshot(prop.SnapshotId, True)
        End If
    _backup = Nothing
end sub

When I execute this code, the line
_backup.InitializeForBackup(Nothing) crash with

An unexpected error occurred. The error code is logged in the error log file.
Source : AlphaVSS.60.x86

I don't kwow where is the log file.

(I'm under Win7 pro 64 Bits)

If I execute the CS code of Ariely_AlphaVSS that's work fine...grrrr
Jun 9, 2014 at 9:56 PM
In order to find your log file, go to:

Control Panel-->Administrative Tools-->Event Viewer-->Windows Logs-->Application.

A whole bunch of events will be there. Look underneath Source. Yours will probably say 'VSS' or something similar.

Right click on your event for your application and click 'Event Properties'.

Hope that helps,