summaryrefslogtreecommitdiff
path: root/lib/ShadowCopy/shadow.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
commitb916407a2a06f8452e82b74dc44c54acbcc572b0 (patch)
tree46358e0bb035fca0f42edb4b5b8aa5f1613814af /lib/ShadowCopy/shadow.cpp
parent5.20 (diff)
downloadFreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.gz
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.bz2
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.zip
5.21
Diffstat (limited to 'lib/ShadowCopy/shadow.cpp')
-rw-r--r--lib/ShadowCopy/shadow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp
index e915663f..adc7c5c2 100644
--- a/lib/ShadowCopy/shadow.cpp
+++ b/lib/ShadowCopy/shadow.cpp
@@ -89,8 +89,27 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw SysError
}
ZEN_COM_CHECK(backupComp->InitializeForBackup()); //throw SysError
+
+ //SetContext() only required if different than the default, VSS_CTX_BACKUP; not implemented on XP!!!
+ //ZEN_COM_CHECK(backupComp->SetContext(VSS_CTX_BACKUP)); //throw SysError
+
ZEN_COM_CHECK(backupComp->SetBackupState(false, false, VSS_BT_FULL)); //throw SysError
+
+ //the Shadow Copy Optimization Writer removes items it considers non-essential,
+ //http://msdn.microsoft.com/en-US/library/bb968827#shadow_copy_optimization_writer
+ //like the exclusions in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot
+ //http://msdn.microsoft.com/en-us/library/aa819132%28v=vs.85%29.aspx
+ //Outlook *.ost files in particular:
+ //https://sourceforge.net/p/freefilesync/discussion/help/thread/722dcbfb
+ const VSS_ID disabledWriters[] = { { 0x4dc3bdd4, 0xab48, 0x4d07, { 0xad, 0xb0, 0x3b, 0xee, 0x29, 0x26, 0xfd, 0x7f } } }; //Shadow Copy Optimization Writer
+ {
+ HRESULT hr = backupComp->DisableWriterClasses(disabledWriters, 1);
+ if (FAILED(hr) && hr != E_NOTIMPL) //DisableWriterClasses() is not implemented on Windows XP, although MSDN documented otherwise!
+ throw SysError(formatComError(L"Error calling \"backupComp->DisableWriterClasses\".", hr));
+ }
+
+
auto waitForComFuture = [](IVssAsync& fut)
{
ZEN_COM_CHECK(fut.Wait());
bgstack15