I am trying to implement CF_CALLBACK_TYPE_NOTIFY_DELETE callback in Cloud Filter API. Whatever error code I return from the delete callback the placeholder is always deleted. This issue appeared in the recent Windows update 21H1. It was working properly on the previous Windows versions.
The expected behaviour is:
If the file fails to delete in my remote storage, I set the error code in CompletionStatus and the placeholder is NOT deleted in the client file system.
Here is my code:
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_OPERATION_PARAMETERS params = {0};
params.ParamSize = sizeof(CF_OPERATION_PARAMETERS);
params.AckDelete.Flags = CF_OPERATION_ACK_DELETE_FLAG_NONE;
// Whatever code I set here the file is always deleted
params.AckDelete.CompletionStatus = STATUS_IO_DEVICE_ERROR;
HRESULT res = CfExecute(&opInfo, ¶ms);
}