Merge pull request #3187 from nextcloud/bugfix/fixCfRegisterSyncRoot

fix errors when calling CfRegisterSyncRoot by setting more fields
This commit is contained in:
Matthieu Gallien 2021-04-26 13:13:01 +02:00 committed by GitHub
commit 74b5ca3e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@
#include <QFileInfo>
#include <QLocalSocket>
#include <QLoggingCategory>
#include <QUuid>
#include <sddl.h>
#include <cfapi.h>
@ -467,14 +468,17 @@ OCC::Result<void, QString> 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;