From 97d785f1bb49d77c2c78a00d73b1e5d9cfe5c361 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 22 Apr 2021 19:03:58 +0200 Subject: [PATCH] fix errors when calling CfRegisterSyncRoot by setting more fields sets a reasonable size of the StructSize members in the struct passed to CfRegisterSyncRoot function Signed-off-by: Matthieu Gallien --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 0b09fd2ee..904d6344b 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -467,14 +468,17 @@ OCC::Result OCC::CfApiWrapper::registerSyncRoot(const QString &pa const auto version = std::wstring(providerVersion.toStdWString().data()); CF_SYNC_REGISTRATION info; + info.StructSize = sizeof(info) + (name.length() + version.length()) * sizeof(wchar_t); info.ProviderName = name.data(); info.ProviderVersion = version.data(); info.SyncRootIdentity = nullptr; info.SyncRootIdentityLength = 0; info.FileIdentity = nullptr; info.FileIdentityLength = 0; + info.ProviderId = QUuid::createUuid(); CF_SYNC_POLICIES policies; + policies.StructSize = sizeof(policies); policies.Hydration.Primary = CF_HYDRATION_POLICY_FULL; policies.Hydration.Modifier = CF_HYDRATION_POLICY_MODIFIER_NONE; policies.Population.Primary = CF_POPULATION_POLICY_ALWAYS_FULL;