diff --git a/src/LockFile.cpp b/src/LockFile.cpp index 613ff694daea1fb4a778465924d78e915915cba4..acd655029cfb6a66052fd261e5ab0928b9a0ad5c 100644 --- a/src/LockFile.cpp +++ b/src/LockFile.cpp @@ -50,7 +50,11 @@ std::unique_ptr<LockFile> LockFile::lock( const std::string& mlFolderPath ) Handle handle; #ifdef _WIN32 auto wide = charset::ToWide( lockFile.c_str() ); +# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */ + handle = CreateFile2(wide.get(), GENERIC_WRITE, 0, CREATE_ALWAYS, NULL); +# else handle = CreateFileW(wide.get(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); +# endif if ( handle == INVALID_HANDLE_VALUE ) { LOG_ERROR( "Could not open lockfile: ", lockFile );