diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:18:53 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:18:53 +0200 |
commit | 32cb97237e7691d31977ab503c6ea4511e8eb3a8 (patch) | |
tree | 4e97b53e9f7b74e8cc5d7548507d9e82ae38e36f /lib/ShadowCopy | |
parent | 4.6 (diff) | |
download | FreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.tar.gz FreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.tar.bz2 FreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.zip |
5.0
Diffstat (limited to 'lib/ShadowCopy')
-rw-r--r-- | lib/ShadowCopy/LockFile.cpp | 2 | ||||
-rw-r--r-- | lib/ShadowCopy/dll_main.cpp | 2 | ||||
-rw-r--r-- | lib/ShadowCopy/shadow.cpp | 39 | ||||
-rw-r--r-- | lib/ShadowCopy/shadow.h | 2 |
4 files changed, 39 insertions, 6 deletions
diff --git a/lib/ShadowCopy/LockFile.cpp b/lib/ShadowCopy/LockFile.cpp index 7df3ec66..523b01bb 100644 --- a/lib/ShadowCopy/LockFile.cpp +++ b/lib/ShadowCopy/LockFile.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * // ************************************************************************** diff --git a/lib/ShadowCopy/dll_main.cpp b/lib/ShadowCopy/dll_main.cpp index 3805c99d..46c65311 100644 --- a/lib/ShadowCopy/dll_main.cpp +++ b/lib/ShadowCopy/dll_main.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * // ************************************************************************** diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp index 5047a698..fc95381d 100644 --- a/lib/ShadowCopy/shadow.cpp +++ b/lib/ShadowCopy/shadow.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "shadow.h" @@ -46,6 +46,35 @@ struct shadow::ShadowData namespace { +std::wstring formatVssError(HRESULT hr) //at least the one's from IVssBackupComponents::AddToSnapshotSet; return empty if no format found +{ + switch (hr) + { + case VSS_E_BAD_STATE: + return L"VSS_E_BAD_STATE"; + case VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED: + return L"VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED"; + case VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED: + return L"VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED"; + case VSS_E_OBJECT_NOT_FOUND: + return L"VSS_E_OBJECT_NOT_FOUND"; + case VSS_E_PROVIDER_NOT_REGISTERED: + return L"VSS_E_PROVIDER_NOT_REGISTERED"; + case VSS_E_PROVIDER_VETO: + return L"VSS_E_PROVIDER_VETO"; + case VSS_E_VOLUME_NOT_SUPPORTED: + return L"VSS_E_VOLUME_NOT_SUPPORTED"; + case VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER: + return L"VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER"; + case VSS_E_UNEXPECTED_PROVIDER_ERROR: + return L"VSS_E_UNEXPECTED_PROVIDER_ERROR"; + default: + return std::wstring(); + } +} + + + inline void copyString(const std::wstring& input, wchar_t* buffer, size_t bufferSize) { @@ -92,7 +121,7 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError VSS_ID snapshotSetId = {}; ZEN_CHECK_COM(backupComp->StartSnapshotSet(&snapshotSetId)); - ScopeGuard guardSnapShot = makeGuard([&]() { backupComp->AbortBackup(); }); + ScopeGuard guardSnapShot = makeGuard([&] { backupComp->AbortBackup(); }); //Quote: "This method must be called if a backup operation terminates after the creation of a //shadow copy set with "StartSnapshotSet" and before "DoSnapshotSet" returns." @@ -103,7 +132,11 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError { if (hr == VSS_E_VOLUME_NOT_SUPPORTED) throw ComError(L"Volume Shadow Copy Service is not supported on this volume!"); - throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr); + const std::wstring vssError = formatVssError(hr); + if (!vssError.empty()) + throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\": " + vssError); + else + throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr); } } diff --git a/lib/ShadowCopy/shadow.h b/lib/ShadowCopy/shadow.h index 68b7141f..ea113dae 100644 --- a/lib/ShadowCopy/shadow.h +++ b/lib/ShadowCopy/shadow.h @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #ifndef SHADOWCOPY_H |