How to register a drive as a sync root for the cloud sync provider

71861387 5 Reputation points
2023-02-13T09:56:09.2566667+00:00

I want to register a disk drive (say D drive) as a sync root for a cloud sync provider built on top of windows cloud filter APIs.
When i tried passing the drive path "D:\" as the syncRootPath to the cloud filter CfRegisterSyncRoot API, it fails with HRESULT
error code as ERROR_*FILE_*CORRUPT.

I want to check if there is any specific configuration which would make this possible ?
if not, is this a limitation from the OS or a possible bug ?

//
// MessageId: ERROR_FILE_CORRUPT
//
// MessageText:
//
//  The file or directory is corrupted and unreadable.
//
#define ERROR_FILE_CORRUPT               1392L
HRESULT CfRegisterSyncRoot(
  [in] LPCWSTR                    SyncRootPath,
  [in] const CF_SYNC_REGISTRATION *Registration,
  [in] const CF_SYNC_POLICIES     *Policies,
  [in] CF_REGISTER_FLAGS          RegisterFlags
);
Windows development | Windows App SDK
Windows development | Windows API - Win32
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2023-02-14T02:33:34.1+00:00

    Hello,

    Welcome to Microsoft Q&A!

    According to the thread: https://github.com/nextcloud/desktop/pull/3290

    CfAPI doesn't work for root partitions on Windows (drive letters like c:/, d:/, e:/, etc.).

    If you want to use a root partition as a sync folder, I suggest you could try to create a subfolder under D:/ in your case.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.