我正在使用 Windows Cloud Filter API 创建虚拟驱动器。删除回调在 Windows Home 21H1 19043.1165 (cldflt.sys 10.0.19041.1110) 上按预期停止工作。如果我从 CF_CALLBACK_TYPE_NOTIFY_DELETE 返回错误代码,则无论如何都会删除脱水占位符,无论我返回什么错误代码:
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, ¶ms);
}
我已经测试了从 Windows 资源管理器和 Windows 21H1 上的命令提示符删除。结果是相同的 - 占位符被删除。我还在旧版本上重新测试了删除 - Windows 10 Pro 1909 (18363.1556) (cldflt.sys 10.0.18362.1533) 一切都按预期工作 - 如果我从删除回调中返回错误,文件不会被删除。
我猜这是最新 Windows 更新中的一个错误。有没有人能够为这种行为找到解决方案?
最佳答案
这是 Windows 云过滤器 API 中的一个已知问题。它会影响 Windows 20H1 和更高版本。以下是关于这个问题的讨论:https://docs.microsoft.com/en-us/answers/questions/75240/bug-report-cfapi-ackdelete-borken-on-win10-2004.html据我所知,目前没有任何真正的解决方案。返回任何特定的错误代码无济于事。唯一可能的解决方案是稍后在同步期间在本地文件系统中重新创建已删除的文件。
关于winapi - 云文件 API 中的删除在 Windows 21H1 上停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68887190/