Skip to content
Snippets Groups Projects
Commit 8d4514b1 authored by Steve Lhomme's avatar Steve Lhomme
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.
parent 1af3f54f
No related branches found
No related tags found
1 merge request!756LockFile: favor CreateFile2 over CreateFileW
Pipeline #352647 passed with stages
in 1 minute and 26 seconds
......@@ -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