My code:
HRESULT GetPlaceholderInfoCallback(const PRJ_CALLBACK_DATA* CallbackData)
{
    auto sourcePath = GetSourcePath(CallbackData->FilePathName);
    std:shared_ptr<PRJ_PLACEHOLDER_INFO> p_placeholder = createPlaceholderInfo(sourcePath);
    if (p_placeholder == NULL)
    {
        return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
    }
    auto hr = PrjWritePlaceholderInfo(namespaceVirtualizationContext, CallbackData->FilePathName,
                                               p_placeholder.get(), sizeof(PRJ_PLACEHOLDER_INFO));
    if (S_OK != hr)
    {
        // failed
    }
    return hr;
}
Most of times it works as expected but on some files/dirs PrjWritePlaceholderInfo returns GENERIC_ACCESS_DENIED error (0x80070005).
Files have same DACL/SACL/Owner
I tried even with SYSTEM privileges but still getting same error. 
User contributions licensed under CC BY-SA 3.0