Merge pull request #2800 from nextcloud/fix_cfapi_win32_build

Fix CfAPI wrapper build in Win32 mode
This commit is contained in:
allexzander 2021-01-06 19:08:29 +02:00 committed by GitHub
commit 33fb861ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -346,13 +346,13 @@ OCC::CfApiWrapper::FileHandle OCC::CfApiWrapper::handleForPath(const QString &pa
HANDLE handle = nullptr;
const qint64 openResult = CfOpenFileWithOplock(path.toStdWString().data(), CF_OPEN_FILE_FLAG_NONE, &handle);
if (openResult == S_OK) {
return {handle, CfCloseHandle};
return FileHandle(handle, CfCloseHandle);
}
} else {
const auto handle = CreateFile(path.toStdWString().data(), 0, 0, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (handle != INVALID_HANDLE_VALUE) {
return {handle, [](HANDLE h) { CloseHandle(h); }};
return FileHandle(handle, [](HANDLE h) { CloseHandle(h); });
}
}