Delete in Cloud Files API stopped working on Windows 21H1
Asked Answered
P

2

6

I am creating virtual drive using Windows Cloud Filter API. The delete callback stopped working as expected on Windows Home 21H1 19043.1165 (cldflt.sys 10.0.19041.1110). If I return an error code from the CF_CALLBACK_TYPE_NOTIFY_DELETE, the dehydrated placeholder is deleted anyway, regardless of the error code that I return:

void CALLBACK FakeCloudProvider::OnNotifyDelete(
    _In_ CONST CF_CALLBACK_INFO* callbackInfo,
    _In_ CONST CF_CALLBACK_PARAMETERS* callbackParameters)
{
    CF_OPERATION_INFO opInfo = { 0 };
    
    opInfo.StructSize = sizeof(CF_OPERATION_INFO);
    opInfo.Type = CF_OPERATION_TYPE_ACK_DELETE;
    opInfo.ConnectionKey = callbackInfo->ConnectionKey;
    opInfo.TransferKey = callbackInfo->TransferKey;
    opInfo.CorrelationVector = callbackInfo->CorrelationVector;
    opInfo.RequestKey = callbackInfo->RequestKey;

    CF_SYNC_STATUS_MSG* syncStatus = new CF_SYNC_STATUS_MSG;
    syncStatus->Code = STATUS_FILE_LOCKED_WITH_WRITERS;
    syncStatus->SetMsg(L"MY TEST");

    opInfo.SyncStatus = syncStatus;
    
    CF_OPERATION_PARAMETERS params = {0};
    params.ParamSize = sizeof(CF_OPERATION_PARAMETERS);
    params.AckDelete.Flags = CF_OPERATION_ACK_DELETE_FLAG_NONE;

    // I have also tested many other error codes.
    params.AckDelete.CompletionStatus = STATUS_FILE_LOCKED_WITH_WRITERS; 
    
    HRESULT res = CfExecute(&opInfo, &params);
}

I have tested delete from both Windows Explorer and from command prompt on Windows 21H1. The result is identical - placeholder is deleted.

I have also retested delete on the older version - Windows 10 Pro 1909 (18363.1556) (cldflt.sys 10.0.18362.1533) and everything worked as expected - if I return an error from the delete callback the file is NOT deleted.

I guess this is a bug in latest Windows update. Was anybody able to find a solution for this behavior?

Pageboy answered 23/8, 2021 at 4:7 Comment(0)
F
7

This is a known issue in Windows cloud filter API. It affects Windows 20H1 and later versions. Here is the discussion about this issue: https://learn.microsoft.com/en-us/answers/questions/75240/bug-report-cfapi-ackdelete-borken-on-win10-2004.html There is no any real solution for now as far as I know. Returning any specific error code does not help. The only possible solution would be recreating the deleted file in the local file system during synchronization at some later time.

Forensics answered 23/8, 2021 at 5:36 Comment(0)
A
2

Just tested on Windows 11 (build 10.0.22000.194), it seems this bug has finally been fixed.

Archaeology answered 18/9, 2021 at 1:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.