in ProjectedFSLib.Managed.API/VirtualizationInstance.cpp [912:974]
HResult VirtualizationInstance::UpdateFileIfNeeded(String^ relativePath,
DateTime creationTime,
DateTime lastAccessTime,
DateTime lastWriteTime,
DateTime changeTime,
FileAttributes fileAttributes,
long long endOfFile,
array<Byte>^ contentId,
array<Byte>^ providerId,
UpdateType updateFlags,
[Out] UpdateFailureCause% failureReason)
{
HResult result;
if (m_apiHelper->UseBetaApi)
{
std::shared_ptr<PRJ_PLACEHOLDER_INFORMATION> fileInformation = CreatePlaceholderInformation(
creationTime,
lastAccessTime,
lastWriteTime,
changeTime,
fileAttributes,
endOfFile,
false, // directory
contentId,
providerId);
unsigned long updateFailureReason = 0;
pin_ptr<const WCHAR> path = PtrToStringChars(relativePath);
result = static_cast<HResult>(m_apiHelper->_PrjUpdatePlaceholderIfNeeded(reinterpret_cast<PRJ_VIRTUALIZATIONINSTANCE_HANDLE>(m_virtualizationContext),
path,
fileInformation.get(),
FIELD_OFFSET(PRJ_PLACEHOLDER_INFORMATION, VariableData), // We have written no variable data
CastToUnderlyingType(updateFlags),
&updateFailureReason));
failureReason = static_cast<UpdateFailureCause>(updateFailureReason);
}
else
{
std::shared_ptr<PRJ_PLACEHOLDER_INFO> placeholderInfo = CreatePlaceholderInfo(creationTime,
lastAccessTime,
lastWriteTime,
changeTime,
fileAttributes,
endOfFile,
false, // directory
contentId,
providerId);
PRJ_UPDATE_FAILURE_CAUSES updateFailureCause = PRJ_UPDATE_FAILURE_CAUSE_NONE;
pin_ptr<const WCHAR> path = PtrToStringChars(relativePath);
result = static_cast<HResult>(m_apiHelper->_PrjUpdateFileIfNeeded(m_virtualizationContext,
path,
placeholderInfo.get(),
sizeof(PRJ_PLACEHOLDER_INFO),
static_cast<PRJ_UPDATE_TYPES>(updateFlags),
&updateFailureCause));
failureReason = static_cast<UpdateFailureCause>(updateFailureCause);
}
return result;
}