diff options
Diffstat (limited to 'lib/ShadowCopy/LockFile.cpp')
-rw-r--r-- | lib/ShadowCopy/LockFile.cpp | 43 |
1 files changed, 0 insertions, 43 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; -} - |