diff options
Diffstat (limited to 'lib/ShadowCopy')
-rw-r--r-- | lib/ShadowCopy/LockFile.cpp | 43 | ||||
-rw-r--r-- | lib/ShadowCopy/shadow.cpp | 4 |
2 files changed, 2 insertions, 45 deletions
diff --git a/lib/ShadowCopy/LockFile.cpp b/lib/ShadowCopy/LockFile.cpp deleted file mode 100644 index a09e7f94..00000000 --- a/lib/ShadowCopy/LockFile.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// ************************************************************************** -// * 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) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - - -#include <string> -#include <iostream> -#define WIN32_LEAN_AND_MEAN -#include "windows.h" - -int wmain(int argc, wchar_t* argv[]) -{ - if (argc <= 1) - { - std::wcout << "Please enter the filename to be locked as %1 parameter!" << "\n\n"; - system("pause"); - return -1; - } - std::wstring filename = argv[1]; - - HANDLE hFile = ::CreateFile(filename.c_str(), - GENERIC_READ, - 0, //obtain *exclusive* lock on test file - nullptr, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - nullptr); - if (hFile == INVALID_HANDLE_VALUE) - { - std::wcout << "Error obtaining exclusive lock on test file: " << filename << "\n\n"; - system("pause"); - return -1; - } - - std::wcout << "File " << filename << " is locked! Press a key to unlock." << "\n\n"; - system("pause"); - - ::CloseHandle(hFile); - return 0; -} - diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp index 93026039..65387f3b 100644 --- a/lib/ShadowCopy/shadow.cpp +++ b/lib/ShadowCopy/shadow.cpp @@ -151,8 +151,8 @@ shadow::ShadowHandle shadow::createShadowCopy(const wchar_t* volumeName) { try { - ShadowData result = ::createShadowCopy(volumeName); //shadow handle owned by caller! throw ComError - return new ShadowData(result); //std::bad_alloc? + ShadowData result = ::createShadowCopy(volumeName); //throw ComError + return new ShadowData(result); //shadow handle owned by caller! std::bad_alloc? } catch (const zen::ComError& e) { |