From ae0203c462ee6085cdd0f7b12a11bf8328fbdfae Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 4 Dec 2024 18:33:24 +0100 Subject: [PATCH] dehydrate placeholder files using CfDehydratePlaceholder might be enough to get this working reliably Signed-off-by: Matthieu Gallien --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index ed214b88f9d78..c1d13479f69e5 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -906,19 +906,15 @@ OCC::Result OCC::CfApiWrapper::de const auto info = findPlaceholderInfo(path); if (info) { - CF_FILE_RANGE dehydrationRange; - dehydrationRange.StartingOffset.QuadPart = 0; - dehydrationRange.Length.QuadPart = size; - - const qint64 result = CfUpdatePlaceholder(handleForPath(path).get(), - nullptr, - fileIdentity.data(), - sizeToDWORD(fileIdentitySize), - &dehydrationRange, - 1, - CF_UPDATE_FLAG_MARK_IN_SYNC | CF_UPDATE_FLAG_DEHYDRATE, - nullptr, - nullptr); + LARGE_INTEGER largeStart, largeSize; + largeStart.QuadPart = 0; + largeSize.QuadPart = size; + + const qint64 result = CfDehydratePlaceholder(handleForPath(path).get(), + largeStart, + largeSize, + CF_DEHYDRATE_FLAG_NONE, + 0); if (result != S_OK) { const auto errorMessage = createErrorMessageForPlaceholderUpdateAndCreate(path, "Couldn't update placeholder info");