Skip to content
Snippets Groups Projects
Commit 80c76536 authored by Steve Lhomme's avatar Steve Lhomme Committed by Alaric Senat
Browse files

LockFile: favor CreateFile2 over CreateFileW

The API is always available in Win8+ even in UWP builds, unlike CreateFileW.
The API is pretty much the same.

(cherry picked from commit 8d4514b1)
parent 75e3bc83
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment