summaryrefslogtreecommitdiff
path: root/shared/shadow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shared/shadow.cpp')
-rw-r--r--shared/shadow.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/shared/shadow.cpp b/shared/shadow.cpp
index 948050b6..f000a69b 100644
--- a/shared/shadow.cpp
+++ b/shared/shadow.cpp
@@ -3,7 +3,7 @@
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
-//
+
#include "shadow.h"
#include <wx/msw/wrapwin.h> //includes "windows.h"
#include "i18n.h"
@@ -14,8 +14,8 @@
#include "ShadowCopy\shadow.h"
#include "Loki/ScopeGuard.h"
-using shadow::ShadowCopy;
using namespace zen;
+using namespace shadow;
namespace
@@ -23,7 +23,6 @@ namespace
bool newerThanXP()
{
OSVERSIONINFO osvi = {};
- ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (::GetVersionEx(&osvi))
@@ -43,7 +42,7 @@ bool runningWOW64() //test if process is running under WOW64 (reference http://m
HANDLE hProcess,
PBOOL Wow64Process);
- static const IsWow64ProcessFun isWow64Process =
+ const IsWow64ProcessFun isWow64Process =
util::getDllFun<IsWow64ProcessFun>(L"kernel32.dll", "IsWow64Process");
if (isWow64Process)
@@ -87,13 +86,8 @@ public:
ShadowVolume(const Zstring& volumeNameFormatted) : //throw(FileError)
backupHandle(0)
{
- using namespace shadow;
-
- if (!createShadowCopy)
- createShadowCopy = util::getDllFun<CreateShadowCopyFct>(getShadowDllName(), createShadowCopyFctName);
-
- if (!releaseShadowCopy)
- releaseShadowCopy = util::getDllFun<ReleaseShadowCopyFct>(getShadowDllName(), releaseShadowCopyFctName);
+ createShadowCopy = util::getDllFun<CreateShadowCopyFct>(getShadowDllName(), createShadowCopyFctName);
+ releaseShadowCopy = util::getDllFun<ReleaseShadowCopyFct>(getShadowDllName(), releaseShadowCopyFctName);
//check if shadow copy dll was loaded correctly
if (createShadowCopy == NULL ||
@@ -103,8 +97,7 @@ public:
//VSS does not support running under WOW64 except for Windows XP and Windows Server 2003
//(Reference: http://msdn.microsoft.com/en-us/library/aa384627(VS.85).aspx)
- static const bool wow64Active = runningWOW64();
- if (wow64Active)
+ if (runningWOW64())
throw FileError(_("Error starting Volume Shadow Copy Service!") + "\n" +
_("Making shadow copies on WOW64 is not supported. Please use FreeFileSync 64-bit version."));
@@ -140,24 +133,18 @@ private:
ShadowVolume(const ShadowVolume&);
ShadowVolume& operator=(const ShadowVolume&);
- static shadow::CreateShadowCopyFct createShadowCopy;
- static shadow::ReleaseShadowCopyFct releaseShadowCopy;
+ shadow::CreateShadowCopyFct createShadowCopy;
+ shadow::ReleaseShadowCopyFct releaseShadowCopy;
Zstring shadowVol;
ShadowHandle backupHandle;
};
-
-
-shadow::CreateShadowCopyFct ShadowCopy::ShadowVolume::createShadowCopy;
-shadow::ReleaseShadowCopyFct ShadowCopy::ShadowVolume::releaseShadowCopy;
//#############################################################################################################
Zstring ShadowCopy::makeShadowCopy(const Zstring& inputFile)
{
- using namespace zen;
-
wchar_t volumeNameRaw[1000];
if (!::GetVolumePathName(inputFile.c_str(), //__in LPCTSTR lpszFileName,
bgstack15