summaryrefslogtreecommitdiff
path: root/lib/ShadowCopy/shadow.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:24:59 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:24:59 +0200
commita1c91f4695e208d5a8f80dc37b1818169b7829ff (patch)
tree52f5134376d17c99b6c9e53133a2eb5cf171377c /lib/ShadowCopy/shadow.cpp
parent5.16 (diff)
downloadFreeFileSync-a1c91f4695e208d5a8f80dc37b1818169b7829ff.tar.gz
FreeFileSync-a1c91f4695e208d5a8f80dc37b1818169b7829ff.tar.bz2
FreeFileSync-a1c91f4695e208d5a8f80dc37b1818169b7829ff.zip
5.17
Diffstat (limited to 'lib/ShadowCopy/shadow.cpp')
-rw-r--r--lib/ShadowCopy/shadow.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp
index 4f6881ad..e915663f 100644
--- a/lib/ShadowCopy/shadow.cpp
+++ b/lib/ShadowCopy/shadow.cpp
@@ -75,7 +75,7 @@ std::wstring formatVssError(HRESULT hr) //at least the one's from IVssBackupComp
}
-shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError
+shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw SysError
{
ComPtr<IVssBackupComponents> backupComp;
{
@@ -83,13 +83,13 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError
if (FAILED(hr))
{
if (hr == E_ACCESSDENIED)
- throw ComError(L"The caller does not have sufficient backup privileges or is not an administrator.", hr);
- throw ComError(L"Error calling \"CreateVssBackupComponents\".", hr);
+ throw SysError(formatComError(L"The caller does not have sufficient backup privileges or is not an administrator.", hr));
+ throw SysError(formatComError(L"Error calling \"CreateVssBackupComponents\".", hr));
}
}
- ZEN_COM_CHECK(backupComp->InitializeForBackup()); //throw ComError
- ZEN_COM_CHECK(backupComp->SetBackupState(false, false, VSS_BT_FULL)); //throw ComError
+ ZEN_COM_CHECK(backupComp->InitializeForBackup()); //throw SysError
+ ZEN_COM_CHECK(backupComp->SetBackupState(false, false, VSS_BT_FULL)); //throw SysError
auto waitForComFuture = [](IVssAsync& fut)
{
@@ -98,7 +98,7 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError
HRESULT hr = S_OK;
ZEN_COM_CHECK(fut.QueryStatus(&hr, nullptr)); //check if the async operation succeeded...
if (FAILED(hr))
- throw ComError(L"Error calling \"fut->QueryStatus\".", hr);
+ throw SysError(formatComError(L"Error calling \"fut->QueryStatus\".", hr));
};
ComPtr<IVssAsync> gatherAsync;
@@ -117,12 +117,12 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError
if (FAILED(hr))
{
if (hr == VSS_E_VOLUME_NOT_SUPPORTED)
- throw ComError(L"Volume Shadow Copy Service is not supported on this volume!");
+ throw SysError(L"Volume Shadow Copy Service is not supported on this volume!");
const std::wstring vssError = formatVssError(hr);
if (!vssError.empty())
- throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\": " + vssError);
+ throw SysError(L"Error calling \"backupComp->AddToSnapshotSet\": " + vssError);
else
- throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr);
+ throw SysError(formatComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr));
}
}
@@ -151,10 +151,10 @@ shadow::ShadowHandle shadow::createShadowCopy(const wchar_t* volumeName)
{
try
{
- ShadowData result = ::createShadowCopy(volumeName); //throw ComError
+ ShadowData result = ::createShadowCopy(volumeName); //throw SysError
return new ShadowData(result); //shadow handle owned by caller! std::bad_alloc?
}
- catch (const zen::ComError& e)
+ catch (const zen::SysError& e)
{
lastErrorMessage.reset(new std::wstring(e.toString()));
return nullptr;
bgstack15