From: DavidL on
Hello,
I am using XP SP2, and I'm trying to use the VSS to make a copy of some
files that are opened exclusively. so, these are the steps I followed:

CreateVssBackupComponents
SetBackupState
StartSnapshotSet
AddToSnapshotSet
AddComponent
PrepareForBackup, wait
DoSnapshotSet, wait
GetSnapshotProperties
(do actual file copying, from snapshot location to another directory)
VssFreeSnapshotProperties
SetBackupSucceeded
BackupComplete <-------------------


But the last part, BackupComplete, always give me a VSS_E_BAD_STATE error. I
don't know what went wrong. I tried using different writers, even some
"non-existing writer" (I just gave it some all-zero writerID), all the above
work, and the locked-file is actually copied to my desired location.

But, the writer still has a status of "Waiting" (after my program crash
because of runtime error by VSS_E_BAD_STATE).

Strangely SetBackupSucceeded always give me an OK result,

What should I do to gracefully close the writers ?

Thanks

David