[CloudMirror] CF_CALLBACK_TYPE_VALIDATE_DATA Does Not Trigger In CloudMirror Provider
ElBooshaberra opened this issue · 4 comments
The cfapi.h header documentation provided by Microsoft Learn does not explain how CF_CALLBACK_TYPE_VALIDATE_DATA is called by the provider, and when testing this callback is not called in the latest Windows 11 Insider Beta of 22623.1037 when running the CloudMirror sample.
The methods implemented by the provider are:
CF_CALLBACK_REGISTRATION FakeCloudProvider::s_MirrorCallbackTable[] =
{
{ CF_CALLBACK_TYPE_FETCH_DATA, FakeCloudProvider::OnFetchData },
{ CF_CALLBACK_TYPE_CANCEL_FETCH_DATA, FakeCloudProvider::OnCancelFetchData },
{ CF_CALLBACK_TYPE_NOTIFY_RENAME_COMPLETION, FakeCloudProvider::OnRenameCompletion },
{ CF_CALLBACK_TYPE_NOTIFY_DELETE_COMPLETION, FakeCloudProvider::OnDeleteCompletion },
{ CF_CALLBACK_TYPE_VALIDATE_DATA, FakeCloudProvider::OnValidateData },
CF_CALLBACK_REGISTRATION_END
};
The method FakeCloudProvider::OnValidateData:
void CALLBACK FakeCloudProvider::OnValidateData(
_In_ CONST CF_CALLBACK_INFO* callbackInfo,
_In_ CONST CF_CALLBACK_PARAMETERS* callbackParameters)
{
printf("Callback Validate Data Issued\n");
}
I have tried hydrating a placeholder, dehydrating a placeholder, opening the file on the system, and opening a Pinned file on the system, all without this method being called, along with Restarting the Cloud Provider. I am using the Microsoft Cloud Mirror Sample.
Is there any way I can find information regarding this feature, or any information on how to fix this in the sample? Thanks In Advance!
@ElBooshaberra Have you tried setting the CF_HYDRATION_POLICY_MODIFIER to CF_HYDRATION_POLICY_MODIFIER_VALIDATION_REQUIRED
during the sync root registration?
- info.HydrationPolicyModifier(winrt::StorageProviderHydrationPolicyModifier::None);
+ info.HydrationPolicyModifier(winrt::StorageProviderHydrationPolicyModifier::ValidationRequired);
@wangfu91 This answer was able to return a callback reply, Thank You Very Much!
If I may ask however, is there any way to configure this callback to return when opening a file, or otherwise blocking a handle on a hydrated placeholder until the provider responds, for example to verify credentials?
is there any way to configure this callback to return when opening a file, or otherwise blocking a handle on a hydrated placeholder until the provider responds, for example to verify credentials?
@ElBooshaberra I don't think CF_CALLBACK_TYPE_VALIDATE_DATA
is designed to be used like that,
you could however (just an idea) subscribe to the NotifyFileCloseCompletion
callback, dehydrate the file immediately after it is closed, then when the user opens the file the next time, the FetchData
callback will be triggered again, you can verify the credentials there.
That is unfortunate, however I believe that solution will work. Thank You For Your Advice!